Skip to content
Snippets Groups Projects
Commit 34a5bba1 authored by Marin Karamihalev's avatar Marin Karamihalev
Browse files

Update README.md

parent d3c493bc
No related branches found
No related tags found
No related merge requests found
Pipeline #12369 failed
...@@ -107,15 +107,7 @@ const usp = await connect(options); ...@@ -107,15 +107,7 @@ const usp = await connect(options);
await usp.set("Device.WiFi.Radio.1.Name", "radio-1"); // => void await usp.set("Device.WiFi.Radio.1.Name", "radio-1"); // => void
``` ```
- Operate - WIP (response message not working yet) - Operate
- operate without no arguments
```javascript
await usp.operate("Device.SelfTestDiagnostics()");
```
- operate with arguments (for required args check USP Reference)
```javascript ```javascript
const [ping, cleanPing] = await usp.operate("Device.IP.Diagnostics.IPPing()"); const [ping, cleanPing] = await usp.operate("Device.IP.Diagnostics.IPPing()");
...@@ -150,3 +142,43 @@ const usp = await connect(options); ...@@ -150,3 +142,43 @@ const usp = await connect(options);
```javascript ```javascript
await usp.del("Device.NAT.PortMapping.4."); // => void await usp.del("Device.NAT.PortMapping.4."); // => void
``` ```
- Get Supported DM
```javascript
await usp.supportedDM("Device.WiFi.")
```
- Get Supported Protocols
```javascript
await usp.supportedProto("Device.WiFi.")
```
- Get Instances
```javascript
await usp.instances("Device.WiFi.")
```
- Subscribe
```javascript
const clearSub = await usp.subscribe({ id: '1234', notif: 'ObjectCreation', reference: 'Device.NAT.PortMapping.' }, console.log)
```
- optional second argument to callback gives access to full message.
```javascript
await usp.subscribe({ id: '1234', notif: 'ObjectCreation', reference: 'Device.NAT.PortMapping.' }, (_, fullMsg) => console.log(fullMsg) )
```
- On (WIP)
Id can be a string or a regexp. Messages, generally, have their id in the form COMMAND@random_string (i.e. NOTIFY@12345).
(Note: does not add subscription to USP model, instead allows for internal monitoring of received messages)
Optional second argument to callback gives access to full message.
```javascript
const clear = usp.on(/NOTIFY.*/, (data, msg) => console.log({ data, msg }))
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment