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

Merge branch 'master' of dev.iopsys.eu:iopsys/usp-js

parents 5b944982 29da8879
No related branches found
No related tags found
No related merge requests found
Pipeline #12401 failed
......@@ -101,21 +101,19 @@ const usp = await connect(options);
await usp.set("Device.WiFi.Radio.1.", { Name: "radio-1" }); // => void
```
- set property
- set object with allowPartial and required attributes
```javascript
await usp.set("Device.WiFi.Radio.1.Name", "radio-1"); // => void
await usp.set("Device.WiFi.Radio.1.", { Name: { required: true, value: "radio-1" }, allowPartial: true }); // => void
```
- Operate - WIP (response message not working yet)
- operate without no arguments
- set property
```javascript
await usp.operate("Device.SelfTestDiagnostics()");
await usp.set("Device.WiFi.Radio.1.Name", "radio-1"); // => void
```
- operate with arguments (for required args check USP Reference)
- Operate
```javascript
const [ping, cleanPing] = await usp.operate("Device.IP.Diagnostics.IPPing()");
......@@ -145,8 +143,66 @@ const usp = await connect(options);
}); // => "Device.NAT.PortMapping.4."
```
- add with with allowPartial and required attributes
```javascript
await usp.add("Device.NAT.PortMapping.", {
allowPartial: true,
Description: {
required: true,
value: "webserver1-set",
}
ExternalPort: "80",
Protocol: "TCP",
Interface: "Device.IP.Interface.1",
Enable: "true",
InternalClient: "192.168.1.125",
InternalPort: "5000",
}); // => "Device.NAT.PortMapping.4."
```
- Delete
```javascript
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