use of com.neuronrobotics.sdk.common.BowlerDatagram in project java-bowler by NeuronRobotics.
the class BowlerCamDevice method getImageServerURL.
public String getImageServerURL(int chan) {
// Log.info("Requesting image server URL");
while (urls.size() < (chan + 1) && isAvailable()) {
urls.add(null);
}
if (urls.get(chan) != null)
return urls.get(chan);
BowlerDatagram b = send(new ImageURLCommand(chan));
urls.set(chan, b.getData().asString());
return urls.get(chan);
}
use of com.neuronrobotics.sdk.common.BowlerDatagram in project java-bowler by NeuronRobotics.
the class BowlerAbstractDeviceServer method sendSyncResponse.
/**
* Send a sendable to the getConnection().
*
* @param sendable the sendable without expecting a response
* @throws IOException
*/
public void sendSyncResponse(BowlerAbstractCommand command) throws IOException {
BowlerDatagram bd = BowlerDatagramFactory.build(getAddress(), command);
// Log.debug("RESP>>\n"+bd.toString());
getConnection().sendAsync(bd);
getConnection().getDataOuts().flush();
}
use of com.neuronrobotics.sdk.common.BowlerDatagram in project java-bowler by NeuronRobotics.
the class BowlerAbstractServer method processLocal.
private BowlerDatagram processLocal(BowlerDatagram data) {
setup();
if (getNamespaces().size() == 0) {
throw new RuntimeException("No namespaces defined");
}
for (BowlerAbstractDeviceServerNamespace n : getNamespaces()) {
// System.out.println("Checking "+n.getNamespaces().get(0));
if (n.checkRpc(data)) {
BowlerDatagram d = n.process(data);
if (d != null) {
if (!d.getRPC().contains("_err"))
return d;
}
}
}
Log.error("No namespace found for " + data);
return null;
}
use of com.neuronrobotics.sdk.common.BowlerDatagram in project java-bowler by NeuronRobotics.
the class BowlerAbstractServer method pushAsyncPacket.
/**
* THis is the scripting interface to Bowler devices. THis allows a user to
* describe a namespace, rpc, and array or arguments to be paced into the
* packet based on the data types of the argument. The response in likewise
* unpacked into an array of objects.
*
* @param namespace
* The string of the desired namespace
* @param rpcString
* The string of the desired RPC
* @param arguments
* An array of objects corresponding to the data to be stuffed
* into the packet.
* @throws DeviceConnectionException
* If the desired RPC's are not available then this will be
* thrown
*/
public void pushAsyncPacket(int namespaceIndex, String namespace, String rpcString, Object[] arguments, BowlerDataType[] asyncArguments) {
if (arguments.length != asyncArguments.length) {
throw new RuntimeException("Arguments must match argument types exactly, your two arrays are different lengths");
}
RpcEncapsulation rpcl = new RpcEncapsulation(namespaceIndex, namespace, rpcString, BowlerMethod.ASYNCHRONOUS, asyncArguments, null, null);
BowlerAbstractCommand command = BowlerAbstractConnection.getCommand(namespace, BowlerMethod.ASYNCHRONOUS, rpcString, arguments, rpcl);
BowlerDatagram cmd = BowlerDatagramFactory.build(new MACAddress(), command);
Log.debug("Async>>" + cmd);
pushAsyncPacket(cmd);
}
use of com.neuronrobotics.sdk.common.BowlerDatagram in project java-bowler by NeuronRobotics.
the class LegacyPidNamespaceImp method getPIDChannelCount.
@Override
public int getPIDChannelCount() {
if (getChannelCount() == null) {
BowlerDatagram dg = getDevice().send(new GetPIDChannelCountCommand());
setChannelCount(ByteList.convertToInt(dg.getData().getBytes(0, 4)));
}
return getChannelCount();
}
Aggregations