Connecting to the Cloud Service

Applications need to prompt the user for valid UA Office Link subscription account details (user name and password) before connecting to the cloud service. After successful sign-on other API functions may be called.

UaolCloud.signInAsync(username, password)

Sign in to the UA Office Link cloud service. If already signed in then any existing connection is dropped before signing in with the given credentials.

Arguments:
  • username (string) – User name for the UA Office Link subscription account.
  • password (string) – Password for the UA Office Link subscription account.
Returns:

Promise – Returns a null result.

UaolCloud.signOut()

Sign out from the UA Office Link cloud service. If already signed out then the function has no effect. Signing out will also stop any session that was started.

UaolCloud.startSessionAsync(requestedUpdateRateMs, onUpdateLiveValues, onUpdateLiveValuesError)

Start a session after signing in. There can only be one active session. Any previously started session will be stopped before a new session is started.

Arguments:
  • requestedUpdateRateMs (number) – The requested update rate in milliseconds. Note: This parameter is currently ignored and the actual update rate is always 1000 ms.
  • onUpdateLiveValues (function) – (onUpdateLiveValues(Value[])) Callback function that is called each time after live values have been updated. Each value array element is an object with properties ‘tagId’ and ‘value’. The tagId is the number that is returned by the Tag class’s getId function.
  • onUpdateLiveValuesError (function) – (onError(error)) Callback function that is called if there is an error.
Returns:

Promise – Returns a null result.

UaolCloud.stopSession()

Stop a previously started session.

Examples:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
function signIn() {
    UaolCloud.signInAsync('john@example.com', 'secret').then(() => {
        // success
        startSession();
    })
    .catch((error) => {
        console.error(error);
    });
}

function startSession() {
    UaolCloud.startSessionAsync(1000, onUpdateLiveValues, onUpdateLiveValuesError).then(() => {
        // success
    })
    .catch((error) => {
        console.error(error);
    });
}