Search in sources :

Example 1 with GetChannelModeListCommand

use of com.neuronrobotics.sdk.commands.bcs.io.GetChannelModeListCommand in project java-bowler by NeuronRobotics.

the class DyIO method getAvailibleChannelModes.

public ArrayList<DyIOChannelMode> getAvailibleChannelModes(int channel) {
    ArrayList<DyIOChannelMode> modes = new ArrayList<DyIOChannelMode>();
    ByteList m;
    if (isLegacyParser()) {
        BowlerDatagram dg = send(new GetChannelModeListCommand(channel));
        m = dg.getData();
        Log.error("Packet " + channel + "\r\n" + dg);
        Log.error("Data: " + channel + "\r\n" + m);
    } else {
        // int l = Log.getMinimumPrintLevel();
        // Log.enableInfoPrint();
        Object[] args = send("bcs.io.*;0.3;;", BowlerMethod.GET, "gcml", new Object[] { channel });
        m = (ByteList) args[0];
    // Log.setMinimumPrintLevel(l);
    }
    String modeString = " Availible modes on " + channel;
    for (int i = 0; i < m.size(); i++) {
        DyIOChannelMode tmpMode = DyIOChannelMode.get(m.getByte(i));
        modeString += "\r\n\t" + tmpMode.toString() + "\r\n\t";
        modes.add(tmpMode);
    }
    Log.info(modeString);
    return modes;
}
Also used : GetChannelModeListCommand(com.neuronrobotics.sdk.commands.bcs.io.GetChannelModeListCommand) ByteList(com.neuronrobotics.sdk.common.ByteList) BowlerDatagram(com.neuronrobotics.sdk.common.BowlerDatagram) ArrayList(java.util.ArrayList)

Aggregations

GetChannelModeListCommand (com.neuronrobotics.sdk.commands.bcs.io.GetChannelModeListCommand)1 BowlerDatagram (com.neuronrobotics.sdk.common.BowlerDatagram)1 ByteList (com.neuronrobotics.sdk.common.ByteList)1 ArrayList (java.util.ArrayList)1