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 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 void SendRemoteAtCommand(ulong destinationSerialNumber, XBeeCommand command, XBeeCallback callback) { SendRemoteAtCommand(destinationSerialNumber, command, callback, 0x0); }
public byte SendData(ulong destinationSerialNumber, ushort destinationAddress, byte[] data, XBeeCallback callback) { ApiFrame frame = new ApiFrame(); byte frameId = GetNextFrameId(); byte[] txDataContent = new byte[2]; txDataContent[0] = 0x0; txDataContent[1] = 0x0; txDataContent = Utility.CombineArrays(txDataContent, data); byte[] txData = Utility.CombineArrays(_txDataBase, txDataContent); txData[0] = (byte)ApiFrameName.ZigBeeTransmitRequest; 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) { 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, XBeeCallback callback) { return SendAtCommand(command, callback, 0, 0); }
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 SendData(ulong destinationSerialNumber, ushort destinationAddress, byte[] data, XBeeCallback callback) { ApiFrame frame = new ApiFrame(); byte frameId = GetNextFrameId(); byte[] txDataContent = new byte[2]; txDataContent[0] = 0x0; txDataContent[1] = 0x0; txDataContent = Utility.CombineArrays(txDataContent, data); byte[] txData = Utility.CombineArrays(_txDataBase, txDataContent); txData[0] = (byte)ApiFrameName.ZigBeeTransmitRequest; 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); }