private Task <string> ReportAllDevicePropertiesMethodHandler(string jsonParam)
        {
            Logger.Log("Handling direct method " + CommonDataContract.ReportAllAsync + " ...", LoggingLevel.Verbose);

            ReportAllDeviceProperties().FireAndForget();

            StatusSection status = new StatusSection(StatusSection.StateType.Pending);

            return(Task.FromResult <string>(status.AsJsonObject().ToString()));
        }
        private Task <string> ManageAppLifeCycleAsyncHandler(string jsonParam)
        {
            Logger.Log("ManageAppLifeCycleAsyncHandler() invoked by direct method.", LoggingLevel.Verbose);

            InternalManageAppLifeCycleAsync(jsonParam).FireAndForget();  // Will do its own error reporting.

            StatusSection status = new StatusSection(StatusSection.StateType.Pending);

            return(Task.FromResult <string>(status.AsJsonObject().ToString()));
        }
Пример #3
0
        private Task <string> DoClearReportedProperties(string jsonParam)
        {
            Logger.Log("ClearReportedPropertiesHandler() invoked by direct method.", LoggingLevel.Verbose);

            _deviceManagementClient.ClearReportedProperties().FireAndForget();

            StatusSection status = new StatusSection(StatusSection.StateType.Pending);

            return(Task.FromResult <string>(status.AsJsonObject().ToString()));
        }
        private Task <string> StartFactoryResetAsync(string jsonParam)
        {
            Logger.Log("StartFactoryResetAsync() invoked by direct method.", LoggingLevel.Verbose);

            InternalStartFactoryResetAsync(jsonParam).FireAndForget();  // Will do its own error reporting.

            StatusSection status = new StatusSection(StatusSection.StateType.Pending);

            return(Task.FromResult <string>(status.AsJsonObject().ToString()));
        }
Пример #5
0
        public async Task <string> Invoke(string arg)
        {
            Debug.WriteLine($"Executing direct method: {this._methodName}");

            try
            {
                return(await _method(arg));
            }
            catch (Error ex)
            {
                StatusSection status = new StatusSection(StatusSection.StateType.Failed, ex);

                Logger.Log(status.ToString(), LoggingLevel.Error);
                return(status.AsJsonObject().ToString());
            }
            catch (Exception ex)
            {
                Error         e      = new Error(Message.ErrorSubSystem.Unknown, ex.HResult, ex.Message);
                StatusSection status = new StatusSection(StatusSection.StateType.Failed, e);

                Logger.Log(status.ToString(), LoggingLevel.Error);
                return(status.AsJsonObject().ToString());
            }
        }