Skip to main content
Version: 8.1.3

mdc

The sos.native.mdc API groups together methods for controlling Tizen devices using MDC commands.

warning

This API is currently available on Tizen devices only.

info

You can ensure that the device supports MDC commands via sos.management.supports("NATIVE_COMMANDS_MDC").

Methods

sendOne()

The sendOne() method sends an MDC command to another Tizen device on the same network or to the localhost.

sendOne(ipAddress: IpAddressType, command: CodesMDC, data?: number[]): Promise<IMDCResponse>;

Params

NameTypeDescription
ipAddressstringThe IP address of the device to send the command to.
commandCodesMDCThe MDC command to send
data (optional)number[]The optional data to send with the command.

Return value

MDC response object containing the result of the command execution.

Possible errors

  • If the ipAddress is not a valid string or if the command is not a valid number.
  • If the data is not an array of numbers.
  • If any error occurs during the command execution.

Example

await sos.native.mdc.sendOne('localhost', CodesMDC.BRIGHTNESS_CONTROL);
await sos.native.mdc.sendOne('192.168.0.10', CodesMDC.VOLUME_CONTROL, [50]);
await sos.native.mdc.sendOne('192.168.0.10', CodesMDC.PICTURE_CONTROL, [0x54, 0x03]);

// You can also send custom number if we don't have predefined command in our enum
await sos.native.mdc.sendOne('192.168.0.10', 0x01, []);

sendOneRaw()

The sendOneRaw() method sends an MDC command to another Tizen device on the same network or to the localhost, but without explicitly specifying the command.

sendOneRaw(ipAddress: IpAddressType, data: number[] | [
]): Promise<IMDCResponse>;

Params

NameTypeDescription
ipAddressstringThe IP address of the device to send the command to.
datanumber[] | []The data as array of numbers to send with the command. It can be also empty array.

Return value

MDC response object containing the result of the command execution.

Possible errors

  • If the ipAddress is not a valid string or if the command is not a valid number.
  • If the data is not an array of numbers.
  • If any error occurs during the command execution.

Example

await sos.native.mdc.sendOneRaw('localhost', [0x1B, 0x00, 0x01, 0x74]); // Promise<IMDCResponse>

// Example of returned object
{
"type": "ACK", // or NACK
"commandType": 4,
"result": 0, // Value what command returned
}