nmc
The sos.native.nmc API groups together methods for controlling WebOs devices using NMC commands.
warning
This API is currently available on WebOs devices only.
NMC Management Capabilities
| Capability | Description |
|---|---|
NATIVE_COMMANDS_NMC | If device supports performing NMC commands |
If you want to check if the device supports this capability, use sos.management.supports().
Methods
sendOne()
The sendOne() method sends an NMC command to another WebOS device on the same network or to the localhost.
sendOne(ipAddress: IpAddressType, command: typeof NmcCommands, data: string[] | [
]): Promise<INMCResponse>;
Params
| Name | Type | Required | Description |
|---|---|---|---|
ipAddress | string | Yes | The IP address of the device to send the command to. |
command | typeof NmcCommands | Yes | The NMC command to send. See NmcCommands for available commands. |
data | string[] | [] | Yes | The optional data to send with the command. |
Return value
NMC response object containing the result of the command execution.
Possible errors
- If the
ipAddressis not a valid string or if thecommandis not a valid number. - If the
datais not an array of strings. - If any error occurs during the command execution.
Example
// Send a command to a WebOS device at IP address for menu open
await sos.native.nmc.sendOne('192.168.0.10', ['m','c'], ['43']);
// Send a command to a WebOS device at IP address for device power on
await sos.native.nmc.sendOne('192.168.0.10', ['k', 'a'], ['1']);