C

DeviceLink Class

class Qul::Platform::DeviceLink

This class provides functionality for communication between host and device. More...

Header: #include <platform/devicelink.h>
Since: Qt Quick Ultralite (Platform) 2.3

Public Functions

void charsReceived(const uint8_t *data, int size)
void init()
void printMessage(char *message, int length)

Detailed Description

Methods of this class provide the ability for communition between the host machine and the device by sending messages over the serial port of a device. It uses ProtoBuf and HDLC for sending and framing the messages.

The protocol and framing will be disabled until the first byte from the host is received. This allows to see any log output in the terminal without having to use special tools. Once the first byte from the host is received, the protocol and framing is turned on so that in order to read debugging messages, there are tools required to decode them.

See also Qul::Platform::DeviceLinkInterface.

Member Function Documentation

void DeviceLink::charsReceived(const uint8_t *data, int size)

Decodes and processes data received on the serial port.

This function will be called from Qul::PlatformInterface::deviceLinkBytesReceived and handles the data specified by data and size.

See also Porting DeviceLink Communication.

void DeviceLink::init()

Initializes the device link capability.

This function has to be called after the serial communication hardware has been initialized and is ready to be used.

void DeviceLink::printMessage(char *message, int length)

Sends a logging message to the host

The logging facilities of Qt Quick Ultralite are using this function to send a log message to the host. If the transfer protocol has been enabled it will be wrapped in the protocol and framing. If the transfer protocol has not been enabled yet, it will be sent over the serial port as is. message and length specify the string to be sent.

Available under certain Qt licenses.
Find out more.