// 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;
        }
Exemple #2
0
 public NetworkDiscoveryResponseFrame(ATCommandResponseFrame frame)
 {
     this.ATCommandName = frame.ATCommandName;
     this.ATCommandData = frame.ATCommandData;
     this.FrameID = frame.FrameID;
     this.Status = frame.Status;
     this.variableDataLength = frame.variableDataLength;
     this.type = frame.type;
 }