コード例 #1
0
ファイル: P3bble.cs プロジェクト: txbrown/P3bble
        /// <summary>
        /// Launches an application.
        /// </summary>
        /// <param name="appUuid">The application UUID.</param>
        /// <returns>
        /// An async task to wait
        /// </returns>
        public async Task <bool> LaunchAppAsync(Guid appUuid)
        {
            var msg = new AppMessage(Endpoint.Launcher)
            {
                AppUuid = appUuid,
                Command = AppCommand.Push
            };

            msg.AddTuple((uint)LauncherKeys.RunState, AppMessageTupleDataType.UInt, (byte)LauncherParams.Running);

            var result = await this.SendMessageAndAwaitResponseAsync <AppMessage>(msg);

            if (result != null)
            {
                return(result.Command == AppCommand.Ack);
            }
            else
            {
                throw new TimeoutException();
            }
        }