Пример #1
0
        /// <summary>
        /// Creates a new Job to update twin tags and desired properties on one or multiple devices
        /// </summary>
        /// <param name="jobId">Unique Job Id for this job</param>
        /// <param name="queryCondition">Query condition to evaluate which devices to run the job on</param>
        /// <param name="twin">Twin object to use for the update</param>
        /// <param name="startTimeUtc">Date time in Utc to start the job</param>
        /// <param name="maxExecutionTimeInSeconds">Max execution time in seconds, i.e., ttl duration the job can run</param>
        /// <param name="cancellationToken">Task cancellation token</param>
        /// <returns>A JobResponse object</returns>
        public virtual Task <JobResponse> ScheduleTwinUpdateAsync(string jobId, string queryCondition, Twin twin, DateTime startTimeUtc, long maxExecutionTimeInSeconds, CancellationToken cancellationToken)
        {
            EnsureInstanceNotClosed();

            var jobRequest = new JobRequest
            {
                JobId                     = jobId,
                JobType                   = JobType.ScheduleUpdateTwin,
                UpdateTwin                = twin,
                QueryCondition            = queryCondition,
                StartTime                 = startTimeUtc,
                MaxExecutionTimeInSeconds = maxExecutionTimeInSeconds
            };

            return(CreateJobAsync(jobRequest, cancellationToken));
        }
Пример #2
0
        /// <summary>
        /// Creates a new Job to run a device method on one or multiple devices
        /// </summary>
        /// <param name="jobId">Unique Job Id for this job</param>
        /// <param name="queryCondition">Query condition to evaluate which devices to run the job on</param>
        /// <param name="cloudToDeviceMethod">Method call parameters</param>
        /// <param name="startTimeUtc">Date time in Utc to start the job</param>
        /// <param name="maxExecutionTimeInSeconds">Max execution time in seconds, i.e., ttl duration the job can run</param>
        /// <param name="cancellationToken">Task cancellation token</param>
        /// <returns>A JobResponse object</returns>
        public virtual Task <JobResponse> ScheduleDeviceMethodAsync(string jobId, string queryCondition, CloudToDeviceMethod cloudToDeviceMethod, DateTime startTimeUtc, long maxExecutionTimeInSeconds, CancellationToken cancellationToken)
        {
            EnsureInstanceNotClosed();

            var jobRequest = new JobRequest
            {
                JobId                     = jobId,
                JobType                   = JobType.ScheduleDeviceMethod,
                CloudToDeviceMethod       = cloudToDeviceMethod,
                QueryCondition            = queryCondition,
                StartTime                 = startTimeUtc,
                MaxExecutionTimeInSeconds = maxExecutionTimeInSeconds
            };

            return(CreateJobAsync(jobRequest, cancellationToken));
        }
Пример #3
0
        public override Task <JobResponse> ScheduleTwinUpdateAsync(string jobId, IEnumerable <string> deviceIds, Twin twin, DateTime startTimeUtc,
                                                                   long maxExecutionTimeInSeconds, CancellationToken cancellationToken)
        {
            this.EnsureInstanceNotClosed();

            var jobRequest = new JobRequest()
            {
                JobId      = jobId,
                JobType    = JobType.ScheduleUpdateTwin,
                UpdateTwin = twin,
                DeviceIds  = deviceIds,
                StartTime  = startTimeUtc,
                MaxExecutionTimeInSeconds = maxExecutionTimeInSeconds
            };

            return(this.CreateJobAsync(jobRequest, cancellationToken));
        }