public ApiFrame SendRemoteAtCommandSync(ulong destinationSerialNumber, XBeeCommand command) { AutoResetEvent stopWaitHandle = new AutoResetEvent(false); ApiFrame receivedFrame = null; SendRemoteAtCommand(destinationSerialNumber, command, result => { receivedFrame = result; stopWaitHandle.Set(); }); stopWaitHandle.WaitOne(500, false); return(receivedFrame); }
public void SetDigitalOutput(ulong destinationSerialNumber, XBeeCommand command, bool state) { byte stateByte; if (state) { stateByte = 0x5; } else { stateByte = 0x4; } SendRemoteAtCommand(destinationSerialNumber, command, null, stateByte); }
internal void ReceivedAtCommandResponse(ApiFrame frame) { byte frameID = frame.FrameData[FrameIdentifier]; XBeeCommand command = (XBeeCommand)(frame.FrameData[2] << 8 | frame.FrameData[3]); ApiFrame sentFrame = _frameBuffer[frameID]; if (sentFrame != null && sentFrame.Callback != null) { sentFrame.Callback(frame); if (!(command == XBeeCommand.NodeDiscover && frame.Length > 0)) { _frameBuffer[frameID] = null; } } }
public byte SendRemoteAtCommand(ulong destinationSerialNumber, XBeeCommand command, XBeeCallback callback, byte value) { ApiFrame frame = new ApiFrame(); byte frameId = GetNextFrameId(); int txDataLenght; if (value == 0x0) { txDataLenght = 3; } else { txDataLenght = 4; } byte[] txDataContent = new byte[txDataLenght]; txDataContent[0] = 0x02; // appply changes on remote ushort commandUShort = (ushort)command; txDataContent[1] = (byte)(commandUShort >> 8); txDataContent[2] = (byte)commandUShort; if (value != 0x0) { txDataContent[3] = value; } byte[] txData = Utility.CombineArrays(_txDataBase, txDataContent); txData[0] = (byte)ApiFrameName.RemoteCommandRequest; txData[1] = frameId; for (int i = 0; i < 8; i++) { txData[9 - i] = (byte)(destinationSerialNumber >> (8 * i)); } frame.FrameData = txData; frame.Callback = callback; return(SendApiFrame(frame)); }
public byte SendAtCommand(XBeeCommand command, XBeeCallback callback, uint value, int size) { ApiFrame frame = new ApiFrame(); byte frameId = GetNextFrameId(); byte[] buffer = new byte[4 + size]; buffer[ApiIdentifier] = (byte)ApiFrameName.ATCommand; buffer[FrameIdentifier] = frameId; ushort commandUShort = (ushort)command; buffer[2] = (byte)(commandUShort >> 8); buffer[3] = (byte)commandUShort; if (size > 0) { Utility.InsertValueIntoArray(buffer, 4, size, value); } frame.FrameData = buffer; frame.Callback = callback; return(SendApiFrame(frame)); }
public void SendRemoteAtCommand(ulong destinationSerialNumber, XBeeCommand command, XBeeCallback callback) { SendRemoteAtCommand(destinationSerialNumber, command, callback, 0x0); }
public byte SendAtCommand(XBeeCommand command, XBeeCallback callback) { return(SendAtCommand(command, callback, 0, 0)); }
public byte SendAtCommand(XBeeCommand command) { return(SendAtCommand(command, null, 0, 0)); }
public byte SendAtCommand(XBeeCommand command, XBeeCallback callback) { return SendAtCommand(command, callback, 0, 0); }
public byte SendAtCommand(XBeeCommand command, XBeeCallback callback, uint value, int size) { ApiFrame frame = new ApiFrame(); byte frameId = GetNextFrameId(); byte[] buffer = new byte[4 + size]; buffer[ApiIdentifier] = (byte)ApiFrameName.ATCommand; buffer[FrameIdentifier] = frameId; ushort commandUShort = (ushort)command; buffer[2] = (byte)(commandUShort >> 8); buffer[3] = (byte)commandUShort; if (size > 0) { Utility.InsertValueIntoArray(buffer, 4, size, value); } frame.FrameData = buffer; frame.Callback = callback; return SendApiFrame(frame); }
public byte SendAtCommand(XBeeCommand command) { return SendAtCommand(command, null, 0, 0); }
public void SetDigitalOutput(ulong destinationSerialNumber, XBeeCommand command, bool state) { byte stateByte; if (state) stateByte = 0x5; else stateByte = 0x4; SendRemoteAtCommand(destinationSerialNumber, command, null, stateByte); }
public ApiFrame SendRemoteAtCommandSync(ulong destinationSerialNumber, XBeeCommand command) { AutoResetEvent stopWaitHandle = new AutoResetEvent(false); ApiFrame receivedFrame = null; SendRemoteAtCommand(destinationSerialNumber, command, result => { receivedFrame = result; stopWaitHandle.Set(); }); stopWaitHandle.WaitOne(500, false); return receivedFrame; }
public byte SendRemoteAtCommand(ulong destinationSerialNumber, XBeeCommand command, XBeeCallback callback, byte value) { ApiFrame frame = new ApiFrame(); byte frameId = GetNextFrameId(); int txDataLenght; if (value == 0x0) txDataLenght = 3; else txDataLenght = 4; byte[] txDataContent = new byte[txDataLenght]; txDataContent[0] = 0x02; // appply changes on remote ushort commandUShort = (ushort)command; txDataContent[1] = (byte)(commandUShort >> 8); txDataContent[2] = (byte)commandUShort; if (value != 0x0) txDataContent[3] = value; byte[] txData = Utility.CombineArrays(_txDataBase, txDataContent); txData[0] = (byte)ApiFrameName.RemoteCommandRequest; txData[1] = frameId; for (int i = 0; i < 8; i++) { txData[9 - i] = (byte)(destinationSerialNumber >> (8 * i)); } frame.FrameData = txData; frame.Callback = callback; return SendApiFrame(frame); }