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

Asynchronous Operations

To start an asynchronous operation, simply call the asynchronous function (as illustrated below). The function in question will return a operation handle that can be used to cancel the operation. The first argument to an asynchronous function is a callback object that provides callback functions for handling the result of the operation.

An example of an asynchronous operation in TOI3:


function WifiScanner(device)
{
  var pending = false;

  var callbacks = {
    onResult : function(operation, operationresult) {
      // display found access points
    },
    onError : function(operation) {
      // display error
      pending = false;
    },
    onCompleted: function(operation) {
      pending = false;
    },
    onProgress : function(operation) {}
  };

  this.scan = function() {
    try {
      var scanOperation = device.scan(callbacks, "");
      pending = true;
    }
    catch (x) {
      printEvent("Can not start wifi scan: " + x);
    }
  };
}

5.0.1

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