Exemplo n.º 1
0
        public Task <IQOpenApplicationResult> OpenApplicationAsync(IQDevice device, IQApp app)
        {
            var completionSource = new TaskCompletionSource <IQOpenApplicationResult>();

            MainThreadHandler.Post(() => OpenApplication(device, app, new IQOpenApplicationListenerImpl(completionSource)));
            return(completionSource.Task);
        }
Exemplo n.º 2
0
 public void OnMessageStatus(IQDevice paramIQDevice, IQApp paramIQApp, IQMessageStatus paramIQMessageStatus)
 {
     Debug.Assert(_completionSource != null && _objectPool != null);
     _completionSource.SetResult(new IQSendMessageResult(paramIQDevice, paramIQApp, paramIQMessageStatus));
     _completionSource = null;
     _objectPool.Free(this);
 }
Exemplo n.º 3
0
        public Task <IQSendMessageResult> SendMessageAsync(IQDevice device, IQApp app, Java.Lang.Object message)
        {
            var completionSource = new TaskCompletionSource <IQSendMessageResult>();

            MainThreadHandler.Post(() =>
            {
                IQSendMessageListenerImpl listener = ObjectPool.Allocate();
                listener.CompletionSource          = completionSource;
                SendMessage(device, app, message, listener);
            });
            return(completionSource.Task);
        }
        async void InitGarmin()
        {
            var commStrategy = IQ.IQConnectType.Wireless;

            _iq = IQ.GetInstance(this, commStrategy);
            var initStatus = await _iq.InitializeAsync(this, autoUI : true);

            if (initStatus.HasError)
            {
                Log.Error("BindingTest", $"Received garmin SDK error {initStatus.ErrorStatus}");
                return;
            }

            var knownDevices = _iq.KnownDevices;

            _device = knownDevices.First(dev => dev.FriendlyName == "vivoactive HR");
            IQDevice.IQDeviceStatus status = _iq.GetDeviceStatus(_device);
            if (status != IQDevice.IQDeviceStatus.Connected)
            {
                return;
            }

            var appInfo = await _iq.GetApplicationInfoAsync("fc4cdb94-9339-44e4-ad86-2d235312f0e7", _device);

            if (!appInfo.Installed)
            {
                Log.Error("BindingTest", "Application not installed");
                return;
            }

            _app = appInfo.App;
            var javaMap = new Java.Util.HashMap();

            javaMap.Put(1, 6);
            var messageStatus = await _iq.SendMessageAsync(_device, _app, javaMap);

            Log.Info("BindingTest", $"Message status {messageStatus.MessageStatus}");
        }
Exemplo n.º 5
0
 public IQApplicationInfoResult(IQApp app)
 {
     Installed = true;
     AppId     = app.ApplicationId;
     App       = app;
 }
Exemplo n.º 6
0
 public void OnApplicationInfoReceived(IQApp paramIQApp)
 {
     _completionSource.SetResult(new IQApplicationInfoResult(paramIQApp));
 }
Exemplo n.º 7
0
 public IQOpenApplicationResult(IQDevice device, IQApp app, IQOpenApplicationStatus status)
 {
     Device = device;
     App    = app;
     Status = status;
 }
Exemplo n.º 8
0
 public void OnOpenApplicationResponse(IQDevice paramIQDevice,
                                       IQApp paramIQApp,
                                       IQOpenApplicationStatus paramIQOpenApplicationStatus)
 {
     _completionSource.SetResult(new IQOpenApplicationResult(paramIQDevice, paramIQApp, paramIQOpenApplicationStatus));
 }
Exemplo n.º 9
0
 public IQSendMessageResult(IQDevice device, IQApp app, IQMessageStatus messageStatus)
 {
     Device        = device;
     App           = app;
     MessageStatus = messageStatus;
 }