internal XBeeSeries1(XBeeControllerBase controller, HardwareVersion hardwareVersion = HardwareVersion.XBeeSeries1, ushort firmwareVersion = 0, XBeeProtocol protocol = XBeeProtocol.Unknown, NodeAddress address = null) : base(controller, hardwareVersion, firmwareVersion, protocol, address) { }
/// <summary> /// Calculates the total value of a combination of several options for the given protocol. /// </summary> /// <param name="protocol">The <see cref="XBeeProtocol"/> to calculate the value of all the given discovery options.</param> /// <param name="options">Collection of options to get the final value.</param> /// <returns>The value to be configured in the module depending on the given collection of options and the protocol.</returns> public static int CalculateDiscoveryValue(this DiscoveryOptions dumb, XBeeProtocol protocol, ISet<DiscoveryOptions> options) { // Calculate value to be configured. int value = 0; switch (protocol) { case XBeeProtocol.ZIGBEE: case XBeeProtocol.ZNET: foreach (DiscoveryOptions op in options) { if (op == DiscoveryOptions.APPEND_RSSI) continue; value = value + op.GetValue(); } break; case XBeeProtocol.DIGI_MESH: case XBeeProtocol.DIGI_POINT: case XBeeProtocol.XLR: // TODO [XLR_DM] The next version of the XLR will add DigiMesh support. // For the moment only point-to-multipoint is supported in this kind of devices. case XBeeProtocol.XLR_DM: foreach (DiscoveryOptions op in options) value = value + op.GetValue(); break; case XBeeProtocol.RAW_802_15_4: case XBeeProtocol.UNKNOWN: default: if (options.Contains(DiscoveryOptions.DISCOVER_MYSELF)) value = 1; // This is different for 802.15.4. break; } return value; }
internal XBeePro900HP(XBeeControllerBase controller, HardwareVersion hardwareVersion, ushort firmwareVersion, XBeeProtocol protocol, NodeAddress address = null) : base(controller, hardwareVersion, firmwareVersion, protocol, address) { }
public XBeeCellular(XBeeControllerBase controller, HardwareVersion hardwareVersion, ushort firmwareVersion, XBeeProtocol protocol, NodeAddress address = null) : base(controller, hardwareVersion, firmwareVersion, protocol, address) { }
public override void Open() /*throws XBeeException */ { base.Open(); if (base.XBeeProtocol != XBeeProtocol.ZIGBEE) { throw new XBeeDeviceException("XBee device is not a " + XBeeProtocol.GetDescription() + " device, it is a " + base.XBeeProtocol.GetDescription() + " device."); } }
/// <summary> /// Opens the connection interface associated with this XBee device. /// </summary> /// <remarks>When opening the device an information reading process is automatically performed. /// This includes:</remarks> /// <list type="bullet"> /// <item><description>64-bit address.</description></item> /// <item><description>Node Identifier.</description></item> /// <item><description>Hardware version</description></item> /// <item><description>Firmware version.</description></item> /// <item><description>XBee device protocol.</description></item> /// <item><description>16-bit address (not for DigiMesh modules).</description></item> /// </list> /// <exception cref="InterfaceAlreadyOpenException">If this device connection is already open.</exception> /// <exception cref="InvalidOperatingModeException">If the operating mode of the device is /// <see cref="OperatingMode.UNKNOWN"/> or <see cref="OperatingMode.AT"/></exception> /// <exception cref="BluetoothAuthenticationException">If the BLE authentication process fails.</exception> /// <exception cref="TimeoutException">If the timeout to read settings when initializing the /// device elapses without response.</exception> /// <exception cref="XBeeException">If there is any problem opening this device connection.</exception> /// <seealso cref="AbstractXBeeDevice.IsOpen"/> /// <seealso cref="AbstractXBeeDevice.Close"/> public override void Open() { base.Open(); if (XBeeProtocol != XBeeProtocol.CELLULAR) { throw new XBeeDeviceException("XBee device is not a " + XBeeProtocol.CELLULAR.GetDescription() + " device, it is a " + XBeeProtocol.GetDescription() + " device."); } }
internal XBeeNode(XBeeControllerBase controller, HardwareVersion hardwareVersion, ushort firmwareVersion, XBeeProtocol protocol, NodeAddress address = null) { Controller = controller; HardwareVersion = hardwareVersion; FirmwareVersion = firmwareVersion; Protocol = protocol; Address = address; Controller.DataReceived += ControllerOnDataReceived; Controller.SampleReceived += ControllerOnSampleReceived; Controller.SensorSampleReceived += ControllerOnSensorSampleReceived; }
/* * (non-Javadoc) * @see com.digi.xbee.api.XBeeDevice#open() */ //@Override public override void Open() /*throws XBeeException */ { base.Open(); if (IsRemote) { return; } if (base.XBeeProtocol != XBeeProtocol.RAW_802_15_4) { throw new XBeeDeviceException("XBee device is not a " + XBeeProtocol.GetDescription() + " device, it is a " + base.XBeeProtocol.GetDescription() + " device."); } }
/// <summary> /// Calculates the total value of a combination of several options for the given protocol. /// </summary> /// <param name="source"></param> /// <param name="protocol">The <see cref="XBeeProtocol"/> to calculate the value of all the given /// discovery options.</param> /// <param name="options">Collection of options to get the final value.</param> /// <returns>The value to be configured in the module depending on the given collection of options /// and the protocol.</returns> /// <seealso cref="XBeeProtocol"/> public static int CalculateDiscoveryValue(this DiscoveryOptions source, XBeeProtocol protocol, ISet <DiscoveryOptions> options) { // Calculate value to be configured. int value = 0; switch (protocol) { case XBeeProtocol.ZIGBEE: case XBeeProtocol.ZNET: foreach (DiscoveryOptions op in options) { if (op == DiscoveryOptions.APPEND_RSSI) { continue; } value = value + op.GetValue(); } break; case XBeeProtocol.DIGI_MESH: case XBeeProtocol.DIGI_POINT: case XBeeProtocol.XLR: // TODO [XLR_DM] The next version of the XLR will add DigiMesh support. // For the moment only point-to-multipoint is supported in this kind of devices. case XBeeProtocol.XLR_DM: foreach (DiscoveryOptions op in options) { value = value + op.GetValue(); } break; case XBeeProtocol.RAW_802_15_4: case XBeeProtocol.UNKNOWN: default: if (options.Contains(DiscoveryOptions.DISCOVER_MYSELF)) { value = 1; // This is different for 802.15.4. } break; } return(value); }
/// <summary> /// Create a node. /// </summary> /// <param name="address">The address of the node or null for the controller node.</param> /// <param name="version">The hardware version to use for the specified node.</param> /// <param name="protocol">The protocol to use or null for default.</param> /// <returns>The specified node.</returns> public Task <XBeeNode> GetNodeAsync(NodeAddress address, HardwareVersion version, XBeeProtocol protocol = XBeeProtocol.Unknown) { return(Task.FromResult(CreateNode(version, 0, address))); }
/// <summary> /// Determines the XBee protocol based on the given Hardware and firmware versions. /// </summary> /// <param name="hardwareVersion">The hardware version of the protocol to determine.</param> /// <param name="firmwareVersion">The firmware version of the protocol to determine.</param> /// <returns>The XBee protocol corresponding to the given hardware and firmware versions.</returns> public static XBeeProtocol DetermineProtocol(this XBeeProtocol dumb, HardwareVersion hardwareVersion, string firmwareVersion) { if (hardwareVersion == null || firmwareVersion == null || hardwareVersion.Value < 0x09) { return(XBeeProtocol.UNKNOWN); } else if (hardwareVersion.Value == HardwareVersionEnum.XC09_009.GetValue() || hardwareVersion.Value == HardwareVersionEnum.XC09_038.GetValue()) { return(XBeeProtocol.XCITE); } else if (hardwareVersion.Value == HardwareVersionEnum.XT09_XXX.GetValue()) { if ((firmwareVersion.Length == 4 && firmwareVersion.StartsWith("8")) || (firmwareVersion.Length == 5 && firmwareVersion[1] == '8')) { return(XBeeProtocol.XTEND_DM); } return(XBeeProtocol.XTEND); } else if (hardwareVersion.Value == HardwareVersionEnum.XB24_AXX_XX.GetValue() || hardwareVersion.Value == HardwareVersionEnum.XBP24_AXX_XX.GetValue()) { if ((firmwareVersion.Length == 4 && firmwareVersion.StartsWith("8"))) { return(XBeeProtocol.DIGI_MESH); } return(XBeeProtocol.RAW_802_15_4); } else if (hardwareVersion.Value == HardwareVersionEnum.XB24_BXIX_XXX.GetValue() || hardwareVersion.Value == HardwareVersionEnum.XBP24_BXIX_XXX.GetValue()) { if ((firmwareVersion.Length == 4 && firmwareVersion.StartsWith("1") && firmwareVersion.EndsWith("20")) || (firmwareVersion.Length == 4 && firmwareVersion.StartsWith("2"))) { return(XBeeProtocol.ZIGBEE); } else if (firmwareVersion.Length == 4 && firmwareVersion.StartsWith("3")) { return(XBeeProtocol.SMART_ENERGY); } return(XBeeProtocol.ZNET); } else if (hardwareVersion.Value == HardwareVersionEnum.XBP09_DXIX_XXX.GetValue()) { if ((firmwareVersion.Length == 4 && firmwareVersion.StartsWith("8") || (firmwareVersion.Length == 4 && firmwareVersion[1] == '8')) || (firmwareVersion.Length == 5 && firmwareVersion[1] == '8')) { return(XBeeProtocol.DIGI_MESH); } return(XBeeProtocol.DIGI_POINT); } else if (hardwareVersion.Value == HardwareVersionEnum.XBP09_XCXX_XXX.GetValue()) { return(XBeeProtocol.XC); } else if (hardwareVersion.Value == HardwareVersionEnum.XBP08_DXXX_XXX.GetValue()) { return(XBeeProtocol.DIGI_POINT); } else if (hardwareVersion.Value == HardwareVersionEnum.XBP24B.GetValue()) { if (firmwareVersion.Length == 4 && firmwareVersion.StartsWith("3")) { return(XBeeProtocol.SMART_ENERGY); } return(XBeeProtocol.ZIGBEE); } else if (hardwareVersion.Value == HardwareVersionEnum.XB24_WF.GetValue() || hardwareVersion.Value == HardwareVersionEnum.WIFI_ATHEROS.GetValue() || hardwareVersion.Value == HardwareVersionEnum.SMT_WIFI_ATHEROS.GetValue()) { return(XBeeProtocol.XBEE_WIFI); } else if (hardwareVersion.Value == HardwareVersionEnum.XBP24C.GetValue() || hardwareVersion.Value == HardwareVersionEnum.XB24C.GetValue()) { if (firmwareVersion.Length == 4 && firmwareVersion.StartsWith("5")) { return(XBeeProtocol.SMART_ENERGY); } return(XBeeProtocol.ZIGBEE); } else if (hardwareVersion.Value == HardwareVersionEnum.XSC_GEN3.GetValue() || hardwareVersion.Value == HardwareVersionEnum.SRD_868_GEN3.GetValue()) { if (firmwareVersion.Length == 4 && firmwareVersion.StartsWith("8")) { return(XBeeProtocol.DIGI_MESH); } else if (firmwareVersion.Length == 4 && firmwareVersion.StartsWith("1")) { return(XBeeProtocol.DIGI_POINT); } return(XBeeProtocol.XC); } else if (hardwareVersion.Value == HardwareVersionEnum.XBEE_CELL_TH.GetValue()) { return(XBeeProtocol.UNKNOWN); } else if (hardwareVersion.Value == HardwareVersionEnum.XLR_MODULE.GetValue()) { // This is for the old version of the XLR we have (K60), and it is // reporting the firmware of the module (8001), this will change in // future (after K64 integration) reporting the hardware and firmware // version of the baseboard (see the case HardwareVersionEnum.XLR_BASEBOARD). // TODO maybe this should be removed in future, since this case will never be released. return(XBeeProtocol.XLR); } else if (hardwareVersion.Value == HardwareVersionEnum.XLR_BASEBOARD.GetValue()) { // XLR devices with K64 will report the baseboard hardware version, // and also firmware version (the one we have here is 1002, but this value // is not being reported since is an old K60 version, the module fw version // is reported instead). // TODO [XLR_DM] The next version of the XLR will add DigiMesh support should be added. // Probably this XLR_DM and XLR will depend on the firmware version. return(XBeeProtocol.XLR); } else if (hardwareVersion.Value == HardwareVersionEnum.XB900HP_NZ.GetValue()) { return(XBeeProtocol.DIGI_POINT); } // If the hardware is not in the list, lets return Generic, at least // the configuration can be done and the console open. else if (HardwareVersionEnum.ABANDONATED.Get(hardwareVersion.Value) == null) { return(XBeeProtocol.UNKNOWN); } // TODO: Logic protocol goes here. return(XBeeProtocol.ZIGBEE); }
/// <summary> /// Gets the XBee protocol description. /// </summary> /// <param name="source"></param> /// <returns>XBee protocol description.</returns> public static string GetDescription(this XBeeProtocol source) { return(lookupTable[source]); }
/// <summary> /// Gets the XBee protocol ID. /// </summary> /// <param name="source"></param> /// <returns>XBee protocol ID.</returns> public static int GetID(this XBeeProtocol source) { return((int)source); }
public static string ToDisplayString(this XBeeProtocol source) { return(lookupTable[source]); }
/// <summary> /// Determines the XBee protocol based on the given Hardware and firmware versions. /// </summary> /// <param name="source"></param> /// <param name="hardwareVersion">The hardware version of the protocol to determine.</param> /// <param name="firmwareVersion">The firmware version of the protocol to determine.</param> /// <returns>The XBee protocol corresponding to the given hardware and firmware versions.</returns> public static XBeeProtocol DetermineProtocol(this XBeeProtocol source, HardwareVersion hardwareVersion, string firmwareVersion) { if (hardwareVersion == null || firmwareVersion == null || hardwareVersion.Value < 0x09) { return(XBeeProtocol.UNKNOWN); } else if (hardwareVersion.Value == HardwareVersionEnum.XC09_009.GetValue() || hardwareVersion.Value == HardwareVersionEnum.XC09_038.GetValue()) { return(XBeeProtocol.XCITE); } else if (hardwareVersion.Value == HardwareVersionEnum.XT09_XXX.GetValue()) { if ((firmwareVersion.Length == 4 && firmwareVersion.StartsWith("8")) || (firmwareVersion.Length == 5 && firmwareVersion[1] == '8')) { return(XBeeProtocol.XTEND_DM); } return(XBeeProtocol.XTEND); } else if (hardwareVersion.Value == HardwareVersionEnum.XB24_AXX_XX.GetValue() || hardwareVersion.Value == HardwareVersionEnum.XBP24_AXX_XX.GetValue()) { if ((firmwareVersion.Length == 4 && firmwareVersion.StartsWith("8"))) { return(XBeeProtocol.DIGI_MESH); } return(XBeeProtocol.RAW_802_15_4); } else if (hardwareVersion.Value == HardwareVersionEnum.XB24_BXIX_XXX.GetValue() || hardwareVersion.Value == HardwareVersionEnum.XBP24_BXIX_XXX.GetValue()) { if ((firmwareVersion.Length == 4 && firmwareVersion.StartsWith("1") && firmwareVersion.EndsWith("20")) || (firmwareVersion.Length == 4 && firmwareVersion.StartsWith("2"))) { return(XBeeProtocol.ZIGBEE); } else if (firmwareVersion.Length == 4 && firmwareVersion.StartsWith("3")) { return(XBeeProtocol.SMART_ENERGY); } return(XBeeProtocol.ZNET); } else if (hardwareVersion.Value == HardwareVersionEnum.XBP09_DXIX_XXX.GetValue()) { if ((firmwareVersion.Length == 4 && firmwareVersion.StartsWith("8") || (firmwareVersion.Length == 4 && firmwareVersion[1] == '8')) || (firmwareVersion.Length == 5 && firmwareVersion[1] == '8')) { return(XBeeProtocol.DIGI_MESH); } return(XBeeProtocol.DIGI_POINT); } else if (hardwareVersion.Value == HardwareVersionEnum.XBP09_XCXX_XXX.GetValue()) { return(XBeeProtocol.XC); } else if (hardwareVersion.Value == HardwareVersionEnum.XBP08_DXXX_XXX.GetValue()) { return(XBeeProtocol.DIGI_POINT); } else if (hardwareVersion.Value == HardwareVersionEnum.XBP24B.GetValue()) { if (firmwareVersion.Length == 4 && firmwareVersion.StartsWith("3")) { return(XBeeProtocol.SMART_ENERGY); } return(XBeeProtocol.ZIGBEE); } else if (hardwareVersion.Value == HardwareVersionEnum.XB24_WF.GetValue() || hardwareVersion.Value == HardwareVersionEnum.WIFI_ATHEROS.GetValue() || hardwareVersion.Value == HardwareVersionEnum.SMT_WIFI_ATHEROS.GetValue()) { return(XBeeProtocol.XBEE_WIFI); } else if (hardwareVersion.Value == HardwareVersionEnum.XBP24C.GetValue() || hardwareVersion.Value == HardwareVersionEnum.XB24C.GetValue()) { if (firmwareVersion.Length == 4 && firmwareVersion.StartsWith("5")) { return(XBeeProtocol.SMART_ENERGY); } return(XBeeProtocol.ZIGBEE); } else if (hardwareVersion.Value == HardwareVersionEnum.XSC_GEN3.GetValue() || hardwareVersion.Value == HardwareVersionEnum.SRD_868_GEN3.GetValue()) { if (firmwareVersion.Length == 4 && firmwareVersion.StartsWith("8")) { return(XBeeProtocol.DIGI_MESH); } else if (firmwareVersion.Length == 4 && firmwareVersion.StartsWith("1")) { return(XBeeProtocol.DIGI_POINT); } return(XBeeProtocol.XC); } else if (hardwareVersion.Value == HardwareVersionEnum.XBEE_CELL_TH.GetValue()) { return(XBeeProtocol.UNKNOWN); } else if (hardwareVersion.Value == HardwareVersionEnum.XLR_MODULE.GetValue()) { // This is for the old version of the XLR we have (K60), and it is // reporting the firmware of the module (8001), this will change in // future (after K64 integration) reporting the hardware and firmware // version of the baseboard (see the case HardwareVersionEnum.XLR_BASEBOARD). // TODO maybe this should be removed in future, since this case will never be released. return(XBeeProtocol.XLR); } else if (hardwareVersion.Value == HardwareVersionEnum.XLR_BASEBOARD.GetValue()) { // XLR devices with K64 will report the baseboard hardware version, // and also firmware version (the one we have here is 1002, but this value // is not being reported since is an old K60 version, the module fw version // is reported instead). // TODO [XLR_DM] The next version of the XLR will add DigiMesh support should be added. // Probably this XLR_DM and XLR will depend on the firmware version. return(XBeeProtocol.XLR); } else if (hardwareVersion.Value == HardwareVersionEnum.XB900HP_NZ.GetValue()) { return(XBeeProtocol.DIGI_POINT); } else if (hardwareVersion.Value == HardwareVersionEnum.XBP24C_TH_DIP.GetValue() || hardwareVersion.Value == HardwareVersionEnum.XB24C_TH_DIP.GetValue() || hardwareVersion.Value == HardwareVersionEnum.XBP24C_S2C_SMT.GetValue()) { if (firmwareVersion.Length == 4 && (firmwareVersion.StartsWith("5") || firmwareVersion.StartsWith("6"))) { return(XBeeProtocol.SMART_ENERGY); } else if (firmwareVersion.StartsWith("2")) { return(XBeeProtocol.RAW_802_15_4); } else if (firmwareVersion.StartsWith("9")) { return(XBeeProtocol.DIGI_MESH); } return(XBeeProtocol.ZIGBEE); } else if (hardwareVersion.Value == HardwareVersionEnum.SX_PRO.GetValue() || hardwareVersion.Value == HardwareVersionEnum.SX.GetValue() || hardwareVersion.Value == HardwareVersionEnum.XTR.GetValue()) { if (firmwareVersion.StartsWith("2")) { return(XBeeProtocol.XTEND); } else if (firmwareVersion.StartsWith("8")) { return(XBeeProtocol.XTEND_DM); } return(XBeeProtocol.SX); } else if (hardwareVersion.Value == HardwareVersionEnum.S2D_SMT_PRO.GetValue() || hardwareVersion.Value == HardwareVersionEnum.S2D_SMT_REG.GetValue() || hardwareVersion.Value == HardwareVersionEnum.S2D_TH_PRO.GetValue() || hardwareVersion.Value == HardwareVersionEnum.S2D_TH_REG.GetValue()) { if (firmwareVersion.StartsWith("8")) { return(XBeeProtocol.THREAD); } return(XBeeProtocol.ZIGBEE); } else if (hardwareVersion.Value == HardwareVersionEnum.CELLULAR_CAT1_LTE_VERIZON.GetValue() || hardwareVersion.Value == HardwareVersionEnum.CELLULAR_3G.GetValue() || hardwareVersion.Value == HardwareVersionEnum.CELLULAR_LTE_VERIZON.GetValue() || hardwareVersion.Value == HardwareVersionEnum.CELLULAR_LTE_ATT.GetValue() || hardwareVersion.Value == HardwareVersionEnum.CELLULAR_NBIOT_EUROPE.GetValue() || hardwareVersion.Value == HardwareVersionEnum.CELLULAR_3_CAT1_LTE_ATT.GetValue() || hardwareVersion.Value == HardwareVersionEnum.CELLULAR_3_LTE_M_VERIZON.GetValue() || hardwareVersion.Value == HardwareVersionEnum.CELLULAR_3_LTE_M_ATT.GetValue() || hardwareVersion.Value == HardwareVersionEnum.CELLULAR_3_LTE_M_ATT_TELIT.GetValue() || hardwareVersion.Value == HardwareVersionEnum.CELLULAR_3_CAT1_LTE_VERIZON.GetValue()) { return(XBeeProtocol.CELLULAR); } else if (hardwareVersion.Value == HardwareVersionEnum.XBEE3_MICRO.GetValue() || hardwareVersion.Value == HardwareVersionEnum.XBEE3_TH.GetValue() || hardwareVersion.Value == HardwareVersionEnum.XBEE3_RESERVED.GetValue()) { if (firmwareVersion.StartsWith("2")) { return(XBeeProtocol.RAW_802_15_4); } else if (firmwareVersion.StartsWith("3")) { return(XBeeProtocol.DIGI_MESH); } return(XBeeProtocol.ZIGBEE); } else if (hardwareVersion.Value == HardwareVersionEnum.XB8X.GetValue()) { return(XBeeProtocol.DIGI_MESH); } return(XBeeProtocol.ZIGBEE); }