private void setRemoteATCommandRequestValues(byte[] bytes, RemoteATCommandRequestFrame frame)
 {
     for (int i = 0; i < 8; ++i)
     {
         bytes[5 + i] = frame.DestinationAddress64Bit[i];
     }
     bytes[13] = frame.DestinationAddress16Bit[0];
     bytes[14] = frame.DestinationAddress16Bit[1];
     bytes[15] = (byte)frame.CommandOptions;
     byte[] commandName = Encoding.UTF8.GetBytes(frame.ATCommandName);
     bytes[16] = commandName[0];
     bytes[17] = commandName[1];
     Array.Copy(frame.ATCommandData, 0, bytes, 18, frame.ATCommandData.Length);
 }
Example #2
0
        // Builder methods
        public Frame Build()
        {
            Frame frame = null;
            switch (frameType)
            {
                case FrameType.RemoteATCommand:
                {
                    RemoteATCommandRequestFrame _frame = new RemoteATCommandRequestFrame();
                    _frame.type = FrameType;
                    _frame.variableDataLength = ATCommandData.Length;
                    _frame.DestinationAddress16Bit = destinationAddress16Bit;
                    _frame.DestinationAddress64Bit = destinationAddress64Bit;
                    _frame.CommandOptions = CmdOptions;
                    _frame.ATCommandName = ATCommandName;
                    _frame.ATCommandData = ATCommandData;

                    frame = _frame;
                } break;

                case FrameType.ATCommand:
                {
                    ATCommandRequestFrame _frame = new ATCommandRequestFrame();
                    _frame.type = FrameType;
                    _frame.variableDataLength = ATCommandData == null ? 0 : ATCommandData.Length;
                    _frame.ATCommandName = ATCommandName;
                    _frame.ATCommandData = ATCommandData;

                    frame = _frame;
                } break;

                case FrameType.ATCommandResponse:
                {
                    ATCommandResponseFrame _frame = new ATCommandResponseFrame();
                    _frame.type = FrameType;
                    _frame.variableDataLength = ATCommandData==null ? 0 : ATCommandData.Length;
                    _frame.ATCommandName = ATCommandName;
                    _frame.ATCommandData = ATCommandData;
                    _frame.Status = commandStatus;

                    frame = _frame;
                } break;

                default:
                    break;
            }

            return frame;
        }