• Quick Start
  • Booting
  • Platform
  • Portals
  • References
    • API Reference TOI3
    • IIP Reference
  • Resources
ARRIS Enterprises, Inc. Confidential Information

ToiAsynchronousOperation

A ToiAsynchronousOperation object represents the state and result of an asynchronous operation. An object of this type is returned by TOI methods that initiate asynchronous operations.
Example:

   var network = toi.netService.getNetwork(toi.consts.ToiNetService.BOOT_NETWORK);
   var callbacks = {
     onError: function(operation) {
       console.log("onError WIFI");
     },
     onResult: function(operation, aps) {
       for (var i = 0; i < aps.length; ++i) {
         // Calculate the signal strength
         var signal = (((aps[i].rcpi + 110) / 110) * 100).toFixed(0);
         console.log("Found " + aps[i].ssid + ", strength = " + signal);
       }
     }
   };
   var operation = network.scanWifi(callbacks);
   

  • Methods
  • Members
  • Types

Method Summary

cancel ( )

Calling this function will cancel an ongoing asynchronous operation. The timing for the actual cancellation may differ between different use cases.

Type Definitions

ToiOperationError (Type: number)

Type for operation errors.

  • OP_ERROR_CANCELLED
  • OP_ERROR_FAILED
ToiOperationState (Type: enum)

State identifier used to identify the operation state.

  • OPERATION_COMPLETED
  • OPERATION_FAILED
  • OPERATION_PENDING
ToiPropertyId (Type: number)

Identifier for a metadata property.

ToiPropertyValue (Type: string)

Value for a metadata property.

Methods

cancel ( )

Calling this function will cancel an ongoing asynchronous operation. The timing for the actual cancellation may differ between different use cases.

Members

OP_ERROR_CANCELLED (Type: ToiAsynchronousOperation.ToiOperationError) (value = -2) (static, constant)

Operation was cancelled by the application.

This constant can be also be accessed from toi.consts.ToiAsynchronousOperation.OP_ERROR_CANCELLED.
OP_ERROR_FAILED (Type: ToiAsynchronousOperation.ToiOperationError) (value = -1) (static, constant)

Operation failed but the exact reason is unknown. This error value is only used if there are no specific errors defined for the specific use case.

This constant can be also be accessed from toi.consts.ToiAsynchronousOperation.OP_ERROR_FAILED.
OPERATION_COMPLETED (Type: ToiAsynchronousOperation.ToiOperationState) (value = 1) (static, constant)

Asynchronous operation has successfully been completed. If supported by the type of request, the final result is available in the result property.

This constant can be also be accessed from toi.consts.ToiAsynchronousOperation.OPERATION_COMPLETED.
OPERATION_FAILED (Type: ToiAsynchronousOperation.ToiOperationState) (value = 2) (static, constant)

Asynchronous operation has failed.

This constant can be also be accessed from toi.consts.ToiAsynchronousOperation.OPERATION_FAILED.
OPERATION_PENDING (Type: ToiAsynchronousOperation.ToiOperationState) (value = 0) (static, constant)

Asynchronous operation is currently in progress.

This constant can be also be accessed from toi.consts.ToiAsynchronousOperation.OPERATION_PENDING.
errorCode (Type: ToiAsynchronousOperation.ToiOperationError)

Error code of the operation. Only valid if the operation is in state OPERATION_FAILED.

id (Type: number)

ID of the operation.

progress (Type: number)

Current progress (in percent) of the operation.

properties (Type: Array.<ToiAsynchronousOperation.ToiProperty>)

Properties of the operation if supported by the use case.

result

Result of the operation. This property is only set for asynchronous operations that have produced a result. In case the executing operation supports incremental results, this property will be updated regularly until the operation is completed. The type of result depends on the use case and the platform service that supports asynchronous operations.

state (Type: ToiAsynchronousOperation.ToiOperationState)

The current state of the operation.

ToiProperty (Type: struct) (static)

A structure used to list property key-value pairs.

Struct fields

Name Description
id

The metadata property.

Type: ToiAsynchronousOperation.ToiPropertyId
value

The value to match in the query.

Type: ToiAsynchronousOperation.ToiPropertyValue

5.1.1.p8

Copyright (c) 2018 ARRIS Enterprises, LLC. All Rights Reserved. ARRIS Enterprises, LLC. Confidential Information.