Пример #1
0
 /// <summary>
 /// Post an ISpMessage to those listening. This will raise the
 /// MsgReceived event
 /// </summary>
 /// <param name="msg">The message to post</param>
 public void PostMessage(ISpEventMessage msg)
 {
     WrapErr.ChkDisposed(this.disposed, 50032);
     this.RaiseEvent(this.MsgReceived, msg, "Message");
 }
Пример #2
0
 /// <summary>
 /// Post an ISpMessage response to an ISpMessage. This will raise the
 /// ResponseReceived event
 /// </summary>
 /// <param name="msg">The reponse to post</param>
 public void PostResponse(ISpEventMessage msg)
 {
     WrapErr.ChkDisposed(this.disposed, 50033);
     this.RaiseEvent(this.ResponseReceived, msg, "Response");
 }
Пример #3
0
 /// <summary>
 /// Convert an enum to its int value
 /// </summary>
 /// <param name="value"></param>
 /// <returns></returns>
 public static int ToInt(this Enum value)
 {
     return(WrapErr.ToErrorReportException(9999, "Unexpected Error Converting Enum to Int", () => {
         return Convert.ToInt32(value);
     }));
 }
Пример #4
0
 public int RetDoNestedErrReportException()
 {
     WrapErr.ToErrorReportException(9292, "Unexpected error", () => new InnerClass().DoException("Ziffle"));
     return(1);
 }
Пример #5
0
        public void BLE_GetDbgInfoStringDump(object obj, Action <string, string> onComplete)
        {
            ErrReport report;

            WrapErr.ToErrReport(out report, 9999, "", () => {
                BluetoothLEDeviceInfo info = obj as BluetoothLEDeviceInfo;
                if (info == null)
                {
                    onComplete("** NOT  A BLE DEVICE **", "** NOT  A BLE DEVICE **");
                    return;
                }

                StringBuilder sb = new StringBuilder();
                sb.Append(string.Format("        Id: {0}", info.Id)).AppendLine();
                sb.Append(string.Format(" IsDefault: {0}", info.IsDefault)).AppendLine();
                sb.Append(string.Format(" IsEnabled: {0}", info.IsEnabled)).AppendLine();
                //sb.Append("     Kind: {0}", device.Kind);
                // Properties
                sb.Append(string.Format("Properties: ({0})", info.ServiceProperties.Count)).AppendLine();
                foreach (var p in info.ServiceProperties)
                {
                    sb.Append("    ").Append(p.Key).Append(" : ").Append(p.Value.Value.ToString()).AppendLine();
                }
                #region OS Specific to implement in the abstract
                //// Enclosure location
                //if (device.EnclosureLocation != null) {
                //    System.Diagnostics.Debug.WriteLine("EnclosureLocation:");
                //    System.Diagnostics.Debug.WriteLine("     InDock: {0}", device.EnclosureLocation.InDock);
                //    System.Diagnostics.Debug.WriteLine("      InLid: {0}", device.EnclosureLocation.InLid);
                //    System.Diagnostics.Debug.WriteLine("      Panel: {0}", device.EnclosureLocation.Panel);
                //    System.Diagnostics.Debug.WriteLine("      Angle: {0}", device.EnclosureLocation.RotationAngleInDegreesClockwise);
                //}
                //else {
                //    System.Diagnostics.Debug.WriteLine("EnclosureLocation: null");
                //}
                //// Pairing
                //if (device.Pairing != null) {
                //    System.Diagnostics.Debug.WriteLine("Pairing:");
                //    System.Diagnostics.Debug.WriteLine("    CanPair: {0}", device.Pairing.CanPair);
                //    System.Diagnostics.Debug.WriteLine("   IsPaired: {0}", device.Pairing.IsPaired);
                //    System.Diagnostics.Debug.WriteLine(" Protection: {0}", device.Pairing.ProtectionLevel);
                //    if (device.Pairing.Custom != null) {
                //        System.Diagnostics.Debug.WriteLine("     Custom: not null");
                //    }
                //    else {
                //        System.Diagnostics.Debug.WriteLine("Custom: null");
                //    }
                //}
                //else {
                //    System.Diagnostics.Debug.WriteLine("Custom: null");
                //}

                //MessageBox.Show(sb.ToString(), info.Name);

                //return "";
                #endregion
                onComplete.Invoke(info.Name, sb.ToString());
            });
            if (report.Code != 0)
            {
                WrapErr.SafeAction(() => onComplete("** FAILED **", "** FAILED **"));
            }
        }
 private void RaiseScriptChange(ScriptDataModel dm)
 {
     WrapErr.ToErrReport(9999, () => this.CurrentScriptChanged?.Invoke(this, dm));
 }
Пример #7
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="provider">The message provider</param>
 public SpMsgFactory(ISpMsgProvider provider)
 {
     WrapErr.ChkParam(provider, "provider", 9999);
     this.provider = provider;
 }