Пример #1
0
        public static NodeIdentifier Parse(IAtCommandResponse cmd)
        {
            if (cmd.Command != NodeIdentifierCommand.command)
            {
                throw new ArgumentException("This method is only applicable for the '" + NodeIdentifierCommand.command + "' command!", "cmd");
            }

            ByteReader br = new ByteReader(cmd.Value, ByteOrder.BigEndian);

            NodeIdentifier ni = new NodeIdentifier();

            ni.ReadBytes(br);

            return(ni);
        }
Пример #2
0
        /// <summary>
        /// Reads the node identifier from the module.
        /// </summary>
        /// <returns>A string containing the node identifier; otherwise null.</returns>
        public string GetNodeIdentifier()
        {
            AtCommandResponse res = Execute(new NodeIdentifierCommand()) as AtCommandResponse;

            if (res == null)
            {
                throw new Exception("Could not execute NodeIdentifier command.");
            }

            NodeIdentifier ni = NodeIdentifier.Parse(res);

            if (ni == null)
            {
                throw new Exception("Could not parse response as NodeIdentifier.");
            }

            return(ni.Identifier);
        }