Data Channels

[key concept][key-concept]

It's strongly recommended to read Key Concept before you started. Each device has at least 1 data channel, and data channels can vary from each other. Different data channel contains different type of data point. Because data channel format is complex, we provide McsDataChannel for your ease to use.

McsDataChannel

Property Type Description
deviceId String DeviceId of this data channel. Use getDeviceId() to get it.
deviceKey String DeviceKey of this data channel. Use getDeviceKey() to get it.
dataChannelEntity DataChannelEntity The DataChannelEntity of this data channel. Use getDataChannelEntity() to get it.
socketListener McsSocketListener The SocketListener of this data channel. Default listener would show the message of socket update in log.

Note that McsDataChannel contains DataChannelEntity. DataChannelEntity is only an entity / data model that describes the format of response. McsDataChannel is a wrapper of DataChannelEntity with extra funcitons:

Instantiate

To create an McsDataChannel, use:

new McsDataChannel(deviceInfo, channelEntity, socketListener);
Parameter Usage Description
deviceInfo Required, DeviceInfoEntity The DeviceInfoEntity of this data channel.
channelEntity Required, DataChannelEntity The DataChannelEntity of this data channel.
socketListener Optional, McsSocketListener The SocketListener of this data channel. Default listener would show the message of socket update in log.

With McsDataChannel, you don't have to worry about the format of data channel when you want to parse or upload the data point.

Still, if you want to submit data point, you should know the Values that keep inside the data point.

mDataChannel.submitDataPoint(new DataPointEntity.Values(data));

Check Data Points - MCS SDK Android Guide to know how to put correct Values into the data point.