private unsafe void DeviceNotifyCallback(ref AMDeviceNotificationCallbackInfo callback_info)
        {
            var threadSafeEventHandler = DeviceDiscovered;

            if (threadSafeEventHandler != null)
            {
                var iPhone = CreateiPhone(callback_info.dev);
                threadSafeEventHandler(this, new iPhoneEventArgs {
                    iPhone = iPhone
                });
            }
        }
示例#2
0
 private unsafe void NotifyCallback(ref AMDeviceNotificationCallbackInfo callback)
 {
     if (callback.msg == NotificationMessage.Connected)
     {
         this.iPhoneHandle = callback.dev;
         if (this.ConnectToPhone())
         {
             this.OnConnect(new ConnectEventArgs(callback));
         }
     }
     else if (callback.msg == NotificationMessage.Disconnected)
     {
         this.connected = false;
         this.OnDisconnect(new ConnectEventArgs(callback));
     }
 }
        /// <summary>
        /// 正常链接回调
        /// </summary>
        /// <param name="callback">The callback.</param>
        private void NotificationCallback(ref AMDeviceNotificationCallbackInfo callback)
        {
            try
            {
                switch (callback.Msg)
                {
                case ConnectNotificationMessage.Connected:
                    var device = FindConnectedDevice(callback.DevicePtr);
                    if (device == null)
                    {
                        device = new iOSDevice(callback.DevicePtr);
                        this.currentConnectedDevice.Add(device);
                    }
                    if (CommonConnectEvent != null)
                    {
                        CommonConnectEvent(this, new DeviceCommonConnectEventArgs(device, ConnectNotificationMessage.Connected));
                    }
                    break;

                case ConnectNotificationMessage.Disconnected:
                    var disConnectDevice = FindConnectedDevice(callback.DevicePtr);
                    if (disConnectDevice == null)
                    {
                        this.currentConnectedDevice.Remove(disConnectDevice);
                    }
                    if (CommonConnectEvent != null)
                    {
                        CommonConnectEvent(this, new DeviceCommonConnectEventArgs(disConnectDevice, ConnectNotificationMessage.Disconnected));
                    }
                    break;

                case ConnectNotificationMessage.Unknown:
                    break;
                }
            }
            catch (Exception ex)
            {
                ListenErrorEvent(this, new ListenErrorEventHandlerEventArgs(ex.Message, ListenErrorEventType.Connect));
            }
        }
示例#4
0
 private unsafe void NotifyCallback(ref AMDeviceNotificationCallbackInfo callback)
 {
     if (callback.msg == NotificationMessage.Connected)
     {
         this.iPhoneHandle = callback.dev;
         if (this.ConnectToPhone())
         {
             this.OnConnect(new ConnectEventArgs(callback));
         }
     }
     else if (callback.msg == NotificationMessage.Disconnected)
     {
         this.connected = false;
         this.OnDisconnect(new ConnectEventArgs(callback));
     }
 }
 internal unsafe ConnectEventArgs(AMDeviceNotificationCallbackInfo cbi)
 {
     this.message = cbi.msg;
     this.device = cbi.dev;
 }
示例#6
0
 private unsafe void DeviceNotifyCallback(ref AMDeviceNotificationCallbackInfo callback_info)
 {
     var threadSafeEventHandler = DeviceDiscovered;
     if (threadSafeEventHandler != null)
     {
         var iPhone = CreateiPhone(callback_info.dev);
         threadSafeEventHandler(this, new iPhoneEventArgs { iPhone = iPhone });
     }
 }
示例#7
0
 internal unsafe ConnectEventArgs(AMDeviceNotificationCallbackInfo cbi)
 {
     this.message = cbi.msg;
     this.device  = cbi.dev;
 }