private static void OnStatusChanged(XBeeApi sender, ModemStatus status) { switch (status) { case ModemStatus.HardwareReset: Debug.Print(sender.Config.SerialNumber + " Hardware reset"); break; case ModemStatus.WatchdogTimerReset: Debug.Print(sender.Config.SerialNumber + " Software reset"); break; case ModemStatus.Associated: Debug.Print(sender.Config.SerialNumber + " Associated"); break; case ModemStatus.Disassociated: Debug.Print(sender.Config.SerialNumber + " Not associated"); break; default: Debug.Print(sender.Config.SerialNumber + " Status " + status); break; } }
public static XBeeAddress64 Read(XBeeApi sender, XBeeAddress remoteXbee) { var sh = sender.Send(AtCmd.SerialNumberHigh).To(remoteXbee).GetResponse(); var sl = sender.Send(AtCmd.SerialNumberLow).To(remoteXbee).GetResponse(); return(Parse((AtResponse)sl, (AtResponse)sh)); }
public static XBeeAddress64 Read(XBeeApi xbee) { var sh = xbee.Send(AtCmd.SerialNumberHigh).GetResponse(); var sl = xbee.Send(AtCmd.SerialNumberLow).GetResponse(); return(Parse(sl, sh)); }
public static void Write(XBeeApi sender, XBeeAddress remoteXbee, ApiModes mode) { var request = sender.Send(AtCmd.ApiEnable, new[] {(byte) mode}).To(remoteXbee); var response = (AtResponse) request.GetResponse(); if (!response.IsOk) throw new XBeeException("Failed to write api mode"); }
public static void Write(XBeeApi xbee, ApiModes mode) { var request = xbee.Send(AtCmd.ApiEnable, new[] {(byte) mode}); var response = request.GetResponse(); if (!response.IsOk) throw new XBeeException("Failed to write api mode"); }
public static void Write(XBeeApi xbee, string nodeIdentifier) { var value = Arrays.ToByteArray(nodeIdentifier, 0, MaxNodeIdentifierLength); var response = xbee.Send(AtCmd.NodeIdentifier, value).GetResponse(); if (!response.IsOk) throw new XBeeException("Failed to write node identifier"); }
public static void Write(XBeeApi sender, XBeeAddress remoteXbee, string nodeIdentifier) { var value = Arrays.ToByteArray(nodeIdentifier, 0, MaxNodeIdentifierLength); var request = sender.Send(AtCmd.NodeIdentifier, value).To(remoteXbee); var response = (AtResponse) request.GetResponse(); if (!response.IsOk) throw new XBeeException("Failed to write node identifier"); }
public static void Write(XBeeApi xbee, string nodeIdentifier) { var value = Arrays.ToByteArray(nodeIdentifier, 0, MaxNodeIdentifierLength); var response = xbee.Send(AtCmd.NodeIdentifier, value).GetResponse(); if (!response.IsOk) { throw new XBeeException("Failed to write node identifier"); } }
public static void Write(XBeeApi xbee, ApiModes mode) { var request = xbee.Send(AtCmd.ApiEnable, new[] { (byte)mode }); var response = request.GetResponse(); if (!response.IsOk) { throw new XBeeException("Failed to write api mode"); } }
public static void Write(XBeeApi sender, XBeeAddress remoteXbee, ApiModes mode) { var request = sender.Send(AtCmd.ApiEnable, new[] { (byte)mode }).To(remoteXbee); var response = (AtResponse)request.GetResponse(); if (!response.IsOk) { throw new XBeeException("Failed to write api mode"); } }
public static void Write(XBeeApi sender, XBeeAddress remoteXbee, string nodeIdentifier) { var value = Arrays.ToByteArray(nodeIdentifier, 0, MaxNodeIdentifierLength); var request = sender.Send(AtCmd.NodeIdentifier, value).To(remoteXbee); var response = (AtResponse)request.GetResponse(); if (!response.IsOk) { throw new XBeeException("Failed to write node identifier"); } }
/// <summary> /// Reads remote module basic information /// </summary> /// <param name="sender">XBee module that will send AT command to remote target</param> /// <param name="remoteXbee">XBee module which infomation will be retrieved</param> /// <returns>Remote XBee basic infomation</returns> public static XBeeConfiguration Read(XBeeApi sender, XBeeAddress remoteXbee) { return new XBeeConfiguration(sender, remoteXbee) { ApiMode = Common.ApiMode.Read(sender, remoteXbee), HardwareVersion = Common.HardwareVersion.Read(sender, remoteXbee), Firmware = Common.Firmware.Read(sender, remoteXbee), SerialNumber = Common.SerialNumber.Read(sender, remoteXbee), NodeIdentifier = Common.NodeIdentifier.Read(sender, remoteXbee) }; }
/// <summary> /// Reads module basic information /// </summary> /// <param name="xbee">XBee module to read data from</param> /// <returns>XBee basic information</returns> public static XBeeConfiguration Read(XBeeApi xbee) { return new XBeeConfiguration(xbee) { ApiMode = Common.ApiMode.Read(xbee), HardwareVersion = Common.HardwareVersion.Read(xbee), Firmware = Common.Firmware.Read(xbee), SerialNumber = Common.SerialNumber.Read(xbee), NodeIdentifier = Common.NodeIdentifier.Read(xbee) }; }
/// <summary> /// Reads remote module basic information /// </summary> /// <param name="sender">XBee module that will send AT command to remote target</param> /// <param name="remoteXbee">XBee module which infomation will be retrieved</param> /// <returns>Remote XBee basic infomation</returns> public static XBeeConfiguration Read(XBeeApi sender, XBeeAddress remoteXbee) { return(new XBeeConfiguration(sender, remoteXbee) { ApiMode = Common.ApiMode.Read(sender, remoteXbee), HardwareVersion = Common.HardwareVersion.Read(sender, remoteXbee), Firmware = Common.Firmware.Read(sender, remoteXbee), SerialNumber = Common.SerialNumber.Read(sender, remoteXbee), NodeIdentifier = Common.NodeIdentifier.Read(sender, remoteXbee) }); }
/// <summary> /// Reads module basic information /// </summary> /// <param name="xbee">XBee module to read data from</param> /// <returns>XBee basic information</returns> public static XBeeConfiguration Read(XBeeApi xbee) { return(new XBeeConfiguration(xbee) { ApiMode = Common.ApiMode.Read(xbee), HardwareVersion = Common.HardwareVersion.Read(xbee), Firmware = Common.Firmware.Read(xbee), SerialNumber = Common.SerialNumber.Read(xbee), NodeIdentifier = Common.NodeIdentifier.Read(xbee) }); }
private static void OnDataReceived(XBeeApi receiver, byte[] data, XBeeAddress sender) { var dataStr = new string(Encoding.UTF8.GetChars(data)); switch (dataStr) { case Ping: receiver.Send(Pong).To(sender).NoResponse(); break; case Pong: Debug.Print("Received Pong from " + sender); break; } }
/// <summary> /// Configures this serial line. /// </summary> /// <remarks> /// This should be called at most once. /// </remarks> /// <param name="baudRate">The baud rate.</param> public void Configure(int baudRate = 9600) { if (_api != null) { throw new Exception("XBee.Configure can only be called once"); } Logger.Initialize(ErrorPrint, LogLevel.Error, LogLevel.Fatal); Logger.Initialize(DebugPrint, LogLevel.Warn, LogLevel.Info, LogLevel.Debug, LogLevel.LowDebug); _connection = new SerialConnection(_serialPortName, baudRate); _api = new XBeeApi(_connection); Enable(); _api.Open(); }
public XBeeResponse[] EndReceive(int timeout = -1) { if (_finished) throw new InvalidOperationException("EndReceive can be called only once!"); try { return _responseListener.GetPackets(timeout); } finally { _xbee.RemovePacketListener(_responseListener); _responseListener = null; _xbee = null; _finished = true; } }
public XBeeResponse[] EndReceive(int timeout = -1) { if (_finished) { throw new InvalidOperationException("EndReceive can be called only once!"); } try { return(_responseListener.GetPackets(timeout)); } finally { _xbee.RemovePacketListener(_responseListener); _responseListener = null; _xbee = null; _finished = true; } }
public static string Read(XBeeApi xbee) { var request = xbee.Send(AtCmd.FirmwareVersion); return Parse(request.GetResponse()); }
public static HardwareVersions Read(XBeeApi xbee) { var request = xbee.Send(AtCmd.HardwareVersion); return(Parse(request.GetResponse())); }
public static string Read(XBeeApi sender, XBeeAddress remoteXbee) { var request = sender.Send(AtCmd.NodeIdentifier).To(remoteXbee); return(Parse((AtResponse)request.GetResponse())); }
/// <summary> /// TODO: Update Comments /// /// </summary> /// <param name="xbee" type="NETMF.OpenSource.XBee.Api.XBee"> /// <para> /// /// </para> /// </param> public DataDelegateRequest(XBeeApi xbee) : base(xbee) { }
protected RequestBase(XBeeApi localXBee) { LocalXBee = localXBee; }
/// <summary> /// TODO: Update Comments /// /// </summary> /// <param name="sender" type="NETMF.OpenSource.XBee.Api.XBee"> /// <para> /// /// </para> /// </param> /// <param name="remoteXbee" type="NETMF.OpenSource.XBee.Api.XBeeAddress"> /// <para> /// /// </para> /// </param> public static void Write(XBeeApi sender, XBeeAddress remoteXbee) { var request = sender.Send(AtCmd.Write).To(remoteXbee); Parse((AtResponse)request.GetResponse()); }
public static ApiModes Read(XBeeApi sender, XBeeAddress remoteXbee) { var request = sender.Send(AtCmd.ApiEnable).To(remoteXbee); return(Parse((AtResponse)request.GetResponse())); }
public static string Read(XBeeApi sender, XBeeAddress remoteXbee) { var request = sender.Send(AtCmd.NodeIdentifier).To(remoteXbee); return Parse((AtResponse) request.GetResponse()); }
internal AsyncSendResult(XBeeApi xbee, IPacketListener responseListener) { _xbee = xbee; _responseListener = responseListener; }
/// <summary> /// TODO: Update Comments /// /// </summary> /// <param name="localXBee" type="NETMF.OpenSource.XBee.Api.XBee"> /// <para> /// /// </para> /// </param> public AtRequest(XBeeApi localXBee) : base(localXBee) { }
/// <summary> /// TODO: Update Comments /// /// </summary> /// <param name="xbee" type="NETMF.OpenSource.XBee.Api.XBee"> /// <para> /// /// </para> /// </param> public RawRequest(XBeeApi xbee) : base(xbee) { }
public static XBeeAddress64 Read(XBeeApi sender, XBeeAddress remoteXbee) { var sh = sender.Send(AtCmd.SerialNumberHigh).To(remoteXbee).GetResponse(); var sl = sender.Send(AtCmd.SerialNumberLow).To(remoteXbee).GetResponse(); return Parse((AtResponse)sl, (AtResponse)sh); }
private XBeeConfiguration(XBeeApi xbee, XBeeAddress remoteXbee = null) { _xbee = xbee; _remoteXbee = remoteXbee; }
public static ApiModes Read(XBeeApi xbee) { var request = xbee.Send(AtCmd.ApiEnable); return(Parse(request.GetResponse())); }
/// <summary> /// TODO: Update Comments /// /// </summary> /// <param name="sender" type="NETMF.OpenSource.XBee.Api.XBee"> /// <para> /// /// </para> /// </param> /// <param name="remoteXbee" type="NETMF.OpenSource.XBee.Api.XBeeAddress"> /// <para> /// /// </para> /// </param> public static void Write(XBeeApi sender, XBeeAddress remoteXbee) { var request = sender.Send(AtCmd.Write).To(remoteXbee); Parse((AtResponse) request.GetResponse()); }
public static ApiModes Read(XBeeApi xbee) { var request = xbee.Send(AtCmd.ApiEnable); return Parse(request.GetResponse()); }
/// <summary> /// TODO: Update Comments /// /// </summary> /// <param name="xbee" type="NETMF.OpenSource.XBee.Api.XBee"> /// <para> /// /// </para> /// </param> public static void Write(XBeeApi xbee) { var request = xbee.Send(AtCmd.Write); Parse(request.GetResponse()); }
public static ApiModes Read(XBeeApi sender, XBeeAddress remoteXbee) { var request = sender.Send(AtCmd.ApiEnable).To(remoteXbee); return Parse((AtResponse) request.GetResponse()); }
public DataRequest(XBeeApi xbee) : base(xbee) { }
/// <summary> /// TODO: Update Comments /// /// </summary> /// <param name="payloadDelegate" type="NETMF.OpenSource.XBee.Api.XBee.PayloadDelegate"> /// <para> /// /// </para> /// </param> internal void Init(XBeeApi.PayloadDelegate payloadDelegate) { Init(); _bytesDelegate = payloadDelegate; }
public static HardwareVersions Read(XBeeApi sender, XBeeAddress remoteXBee) { var request = sender.Send(AtCmd.HardwareVersion).To(remoteXBee); return(Parse((AtResponse)request.GetResponse())); }
public static string Read(XBeeApi xbee) { var request = xbee.Send(AtCmd.NodeIdentifier); return(Parse(request.GetResponse())); }
public static string Read(XBeeApi sender, XBeeAddress remoteXbee) { var request = sender.Send(AtCmd.FirmwareVersion).To(remoteXbee); return Parse((AtResponse) request.GetResponse()); }
public static XBeeAddress64 Read(XBeeApi xbee) { var sh = xbee.Send(AtCmd.SerialNumberHigh).GetResponse(); var sl = xbee.Send(AtCmd.SerialNumberLow).GetResponse(); return Parse(sl, sh); }
public static string Read(XBeeApi xbee) { var request = xbee.Send(AtCmd.NodeIdentifier); return Parse(request.GetResponse()); }