CloudOfThingsClient

Description

The CloudOfThingsClient object is used to connect to the Cloud of Things. A tenant is required to use the cloud and each device has to be registered.

› Inherits:Object

Properties

clientId

This property holds the clientId of this device. Normally this is the MAC address of eth0.

› Type:String
› Signal:clientIdChanged()
› Attributes:Readonly

error

This property holds the most recently occurred error or CloudOfThingsClient.NoError if no error occurred. If the same error occurs multiple times this property does not change. Use the errorOccurred() signal to detect multiple occurrences of the same error.

› Type:Error
› Signal:errorChanged()
› Attributes:Readonly

errorString

This property holds the current human readable error string corresponding to the current value in the error property. It may include additional information such as failure reasons or locations.

› Type:String
› Signal:errorStringChanged()
› Attributes:Readonly

iccid

This property holds the ICCID of the currently used SIM card. Every change of this property is transmitted to Cloud of Things. See MobileNetworkInterface for more information.

› Type:String
› Signal:iccidChanged()
› Attributes:Writable

imei

This property holds the IMEI of the modem device. Every change of this property is transmitted to Cloud of Things. See MobileNetworkInterface for more information.

› Type:String
› Signal:imeiChanged()
› Attributes:Writable

imsi

This property holds the IMSI of the currently used SIM card. Every change of this property is transmitted to Cloud of Things. See MobileNetworkInterface for more information.

› Type:String
› Signal:imsiChanged()
› Attributes:Writable

objects

This property holds a list of objects. This can be used for objects that require a CloudOfThingsClient as parent.

› Type:List<Object>
› Signal:objectsChanged()
› Attributes:Readonly

registrator

This property holds the device registrator used to either do the bootstrap or connect with given credentials.

› Type:CloudOfThingsDeviceRegistrator
› Signal:registratorChanged()
› Attributes:Readonly

remoteConnectionManager

This property holds a remote connection manager. If its property CloudOfThingsRemoteConnectionManager.enabled is true you can configure remote connections in the cloud. Restrict the trusted end points to CloudOfThingsRemoteConnectionManager.allowedEndpoints.

This property was introduced in InCore 1.1.

› Type:CloudOfThingsRemoteConnectionManager
› Signal:remoteConnectionManagerChanged()
› Attributes:Readonly

tenant

This property holds the name of the tenant at the Cloud of Things. Currently it is only used to communicate with the cloud for remote access. It is identical to your cloud access via <tenant>.ram.m2m.telekom.com.

› Type:String
› Attributes:Writable

transport

This property holds the communication layer which decides which protocol is used to cummunicate with the Cloud of Things.

This property was introduced in InCore 2.0.

› Type:CloudOfThingsTransport
› Signal:transportChanged()
› Attributes:Readonly

Signals

errorOccurred()

This signal is emitted whenever an error has occurred, regardless of whether the error property has changed or not. In contrast to the change notification signal of the error property this signal is also emitted several times if a certain error occurs several times in succession.

objectsDataChanged(SignedInteger index)

This signal is emitted whenever the List.dataChanged() signal is emitted, i.e. the item at index in the objects list itself emitted the dataChanged() signal.

Enumerations

Error

This enumeration describes all errors which can occur in CloudOfThingsClient objects. The most recently occurred error is stored in the error property.

Name Value Description
CloudOfThingsClient.NoError 0 No error occurred or was detected.
CloudOfThingsClient.MissingTenant 1 tenant is not set.

Example

import InCore.Foundation 2.5
import InCore.CloudOfThings 2.5

Application {

    //timer for manually reconnects
    Timer {
        id: timer
        repeat: false
        interval: 5000
        onTriggered: transport.connectToHost()
    }

    CloudOfThingsClient {
        id: client
        tenant: "mustercloud"

        transport {
            id: transport

            protocol: CloudOfThingsTransport.MQTT
            tenantForMQTT: "nb-iot"
            cleanSessionMQTT: false

            //set high interval values to reduce traffic
            requestOperationsIntervalMQTT: 10 * 60 * 1000

            autoConnect: false
            keepAlive: 2000

            //log important state changes
            onConnected: console.log( "Cloud of Things client connected" )
            onErrorChanged: console.log( "oh... error occurred", errorString )

            onDisconnected: timer.restart()
        }

        remoteConnectionManager {
            enabled: true

            //default [ "*" ]
            allowedEndpoints: [ "localhost", "vnc.yourTestServ.er" ]
        }

        registrator {
            isRegistered: true
            password: "y0urAwes@meP4ssword"
        }

        //do your stuff here
        /*
        CloudOfThingsMeasurementWriter
        {
            ...
        }

        CloudOfThingsEventWriter
        {
            ...
        }
        */
    }
}