public Task <IQApplicationInfoResult> GetApplicationInfoAsync(string appId, IQDevice device) { var completionSource = new TaskCompletionSource <IQApplicationInfoResult>(); MainThreadHandler.Post(() => GetApplicationInfo(appId, device, new IQApplicationInfoListenerImpl(completionSource))); return(completionSource.Task); }
public Task <IQOpenApplicationResult> OpenApplicationAsync(IQDevice device, IQApp app) { var completionSource = new TaskCompletionSource <IQOpenApplicationResult>(); MainThreadHandler.Post(() => OpenApplication(device, app, new IQOpenApplicationListenerImpl(completionSource))); return(completionSource.Task); }
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); }
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}"); }
public IQOpenApplicationResult(IQDevice device, IQApp app, IQOpenApplicationStatus status) { Device = device; App = app; Status = status; }
public void OnOpenApplicationResponse(IQDevice paramIQDevice, IQApp paramIQApp, IQOpenApplicationStatus paramIQOpenApplicationStatus) { _completionSource.SetResult(new IQOpenApplicationResult(paramIQDevice, paramIQApp, paramIQOpenApplicationStatus)); }
public IQSendMessageResult(IQDevice device, IQApp app, IQMessageStatus messageStatus) { Device = device; App = app; MessageStatus = messageStatus; }