/// <summary> /// Creates a /// </summary> /// <param name="packet"></param> /// <returns></returns> /// <exception cref="NotImplementedException">Thrown if device uses 802.15.4 protocol, since that functionality isn't implemented</exception> protected XBeeAPIPacket ExplToNoExpl(ExplicitRXIndicatorPacket packet) { XBee64BitAddress x64addr = packet.X64BitAddress; XBee16BitAddress x16addr = packet.X16BitAddress; XBeeAPIPacket newPacket; if (xbeeDevice.Protocol == XBeeProtocol.Byte.RAW_802_15_4) { throw new NotImplementedException("This method does not support 802.15.4 protocol yet"); } else { newPacket = new ReceivePacket(packet.X64BitAddress, packet.X16BitAddress, packet.ReceiveOptions, packet.RfData); } return(newPacket); }
/// <summary> /// Converts an explicit packet to an explicit message /// </summary> /// <param name="remote">The remote XBee device that sent the packet</param> /// <param name="broadcast">Flag indicating whether the message is broadcast (default is false)</param> /// <param name="packet">The packet to be converted</param> /// <returns>The explicit message genereated from the provided parameters</returns> protected static ExplicitXBeeMessage ExplToMessage(RemoteXBeeDevice remote, bool broadcast, ExplicitRXIndicatorPacket packet) { return(new ExplicitXBeeMessage(packet.RfData, remote, Utils.TimeNow(), packet.SourceEndpoint, packet.DestEndpoint, packet.ClusterID, packet.ProfileID, broadcast)); }
/// <summary> /// Checks if an explicit data packet in 'special' /// </summary> /// <remarks> /// 'Special' means that this XBee has its API Output Mode distinct than Native (it's expecting /// explicit data packets), but some device has sent it a non-explicit data packet (TransmitRequest f.e.). /// In this case, this XBee will receive a explicit data packet with the following values: /// 1. Source endpoint = 0xE8 /// 2. Destination endpoint = 0xE8 /// 3. Cluster ID = 0x0011 /// 4. Profile ID = 0xC105 /// </remarks> /// <param name="packet"></param> /// <returns></returns> protected bool IsSpecialExplicitPacket(ExplicitRXIndicatorPacket packet) { return(packet.SourceEndpoint == 0xE8 && packet.DestEndpoint == 0xE8 && packet.ClusterID == 0x0011 && packet.ProfileID == 0xC105); }