/// <summary> /// Request X-Plane to close, a notification message will appear /// </summary> public void QuitXPlane() { var dg = new XPDatagram(); dg.Add("QUIT"); client.Send(dg.Get(), dg.Len); }
public void SendCommand(XPlaneCommand command) { var dg = new XPDatagram(); dg.Add("CMND"); dg.Add(command.Command); client.Send(dg.Get(), dg.Len); }
/// <summary> /// Informs X-Plane to change the value of the DataRef /// </summary> /// <param name="dataref">DataRef that will be changed</param> /// <param name="value">New value of the DataRef</param> public void SetDataRefValue(string dataref, string value) { var dg = new XPDatagram(509); dg.Add("DREF"); dg.Add(value); dg.Add(dataref); client.Send(dg.Bytes, dg.Bytes.Length); }
/// <summary> /// Inform X-Plane that a system is back to normal functioning /// </summary> /// <param name="system">Integer value representing the system to recover</param> public void Recover(int system) { var dg = new XPDatagram(); dg.Add("RECO"); dg.Add(system.ToString(EnCulture)); client.Send(dg.Get(), dg.Len); }
/// <summary> /// Inform X-Plane that a system is failed /// </summary> /// <param name="system">Integer value representing the system to fail</param> public void Fail(int system) { var dg = new XPDatagram(); dg.Add("FAIL"); dg.Add(system.ToString(EnCulture)); client.Send(dg.Get(), dg.Len); }
/// <summary> /// Informs X-Plane to change the value of the DataRef /// </summary> /// <param name="dataref">DataRef that will be changed</param> /// <param name="value">New value of the DataRef</param> public void SetDataRefValue(string dataref, string value) { var dg = new XPDatagram(); dg.Add("DREF"); dg.Add(value); dg.Add(dataref); dg.FillTo(509); client.Send(dg.Get(), dg.Len); }
/// <summary> /// Sends a command /// </summary> /// <param name="command">Command to send</param> public void SendCommand(XPlaneCommand command) { if (command == null) { throw new ArgumentNullException(nameof(command)); } var dg = new XPDatagram("CMND", command.Command); client.Send(dg.Bytes, dg.Bytes.Length); }
/// <summary> /// Sends a command /// </summary> /// <param name="command">Command to send</param> public void SendCommand(XPlaneCommand command) { if (command == null) { throw new ArgumentNullException(nameof(command)); } var dg = new XPDatagram(); dg.Add("CMND"); dg.Add(command.Command); client.Send(dg.Get(), dg.Len); }
private void RequestDataRef(DataRefElement element) { if (client != null) { var dg = new XPDatagram(); dg.Add("RREF"); dg.Add(element.Frequency); dg.Add(element.Id); dg.Add(element.DataRef); dg.FillTo(413); client.Send(dg.Get(), dg.Len); OnLog?.Invoke($"Requested {element.DataRef}@{element.Frequency}Hz with Id:{element.Id}"); } }
private void RequestDataRef(DataRefElement element) { if (client == null) { return; } var dg = new XPDatagram(413); dg.Add("RREF"); dg.Add(element.Frequency); dg.Add(element.Id); dg.Add(element.DataRef); client.Send(dg.Bytes, dg.Bytes.Length); OnLog?.Invoke($"Requested {element.DataRef}@{element.Frequency}Hz with Id:{element.Id}"); }
public void Unsubscribe(string dataref) { var dr = DataRefs.SingleOrDefault(d => d.DataRef == dataref); if (dr != null) { var dg = new XPDatagram(); dg.Add("RREF"); dg.Add(dr.Id); dg.Add(0); dg.Add(dataref); dg.FillTo(413); client.Send(dg.Get(), dg.Len); OnLog?.Invoke($"Unsubscribed from {dataref}"); } }
/// <summary> /// Informs X-Plane to stop sending this DataRef /// </summary> /// <param name="dataref">DataRef to unsubscribe from</param> public void Unsubscribe(DataRefElement dataref) { if (!DataRefs.ContainsKey(dataref.Id)) { return; } var dr = DataRefs[dataref.Id]; var dg = new XPDatagram(413); dg.Add("RREF"); dg.Add(dr.Id); dg.Add(0); dg.Add(dataref.DataRef); client.Send(dg.Bytes, dg.Bytes.Length); DataRefs.Remove(dr.Id); OnLog?.Invoke($"Unsubscribed from {dataref.DataRef}"); }
/// <summary> /// Informs X-Plane to stop sending this DataRef /// </summary> /// <param name="dataref">DataRef to unsubscribe to</param> public void Unsubscribe(string dataref) { var dr_list = DataRefs.Where(d => d.DataRef == dataref).ToArray(); foreach (var dr in dr_list) { var dg = new XPDatagram(); dg.Add("RREF"); dg.Add(dr.Id); dg.Add(0); dg.Add(dataref); dg.FillTo(413); client.Send(dg.Get(), dg.Len); DataRefs.Remove(dr); OnLog?.Invoke($"Unsubscribed from {dataref}"); } }
/// <summary> /// Inform X-Plane that a system is back to normal functioning /// </summary> /// <param name="system">Integer value representing the system to recover</param> public void Recover(int system) { var dg = new XPDatagram("RECO", system.ToString(EnCulture)); client.Send(dg.Bytes, dg.Bytes.Length); }
/// <summary> /// Inform X-Plane that a system is failed /// </summary> /// <param name="system">Integer value representing the system to fail</param> public void Fail(int system) { var dg = new XPDatagram("FAIL", system.ToString(EnCulture)); client.Send(dg.Bytes, dg.Bytes.Length); }
/// <summary> /// Request X-Plane to close, a notification message will appear /// </summary> public void QuitXPlane() { var dg = new XPDatagram("QUIT"); client.Send(dg.Bytes, dg.Bytes.Length); }