示例#1
0
 public PrinterOnAndroid(string deviceIdentifier)
 {
     _deviceIdentifier = deviceIdentifier;
     _mobile           = SESLib.Create(_deviceIdentifier);
     _mobile.Connect();
     _mobile.SetTimeout(DEFAULT_TIMEOUT);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="AndroidAppManagerBase"/> class.
        /// </summary>
        /// <param name="pluginExecutionData"></param>
        /// <param name="activityData"></param>
        public AndroidAppManagerBase(PluginExecutionData pluginExecutionData, HpRoamActivityData activityData)
        {
            try
            {
                _executionData = pluginExecutionData;
                _activityData  = activityData;
                _controller    = SESLib.Create(_activityData.MobileEquipmentId);
                _controller.Connect(false, true);

                _androidHelper = new AndroidHelper(_controller);

                _controller.PressKey(KeyCode.KEYCODE_WAKEUP); //Power Button
                _controller.PressKey(KeyCode.KEYCODE_HOME);

                if (_androidHelper.ExistResourceId("com.android.systemui:id/keyguard_indication_area"))
                {
                    _controller.Swipe(SESLib.To.Up);
                }
            }
            catch (NullReferenceException ex)
            {
                throw new DeviceWorkflowException($"Unable to connect to the android phone using the connection ID {_activityData.MobileEquipmentId}.", ex);
            }
        }