From 8022cacf3b75519173652778cf05289cd4f2f8e8 Mon Sep 17 00:00:00 2001
From: Marin Karamihalev <marin.karamihalev@iopsys.eu>
Date: Mon, 18 Jan 2021 10:31:44 +0100
Subject: [PATCH] README: Re-added new connection requirements

---
 README.md    | 112 ++++++++++++++++++++++++++++++---------------------
 package.json |   2 +-
 2 files changed, 66 insertions(+), 48 deletions(-)

diff --git a/README.md b/README.md
index d91206c..3b7f807 100644
--- a/README.md
+++ b/README.md
@@ -2,23 +2,28 @@
 
 Helper library for easy usp communication using mqtt over tcp or ws.
 
-* [API documentation for usp-js](https://iopsys.se/usp-js/index.html)
-* [BBF's USP reference documentation](https://usp-data-models.broadband-forum.org/tr-181-2-13-0-usp.html)
+- [API documentation for usp-js](https://iopsys.se/usp-js/index.html)
+- [BBF's USP reference documentation](https://usp-data-models.broadband-forum.org/tr-181-2-13-0-usp.html)
 
 # Installation
+
 `npm install usp-js`
 
 # Usage
 
 ```javascript
-const connect = require("usp-js").default
+const connect = require("usp-js").default;
 
 const run = async () => {
   // Connect
   const usp = await connect({
-    host: "192.168.1.1",
-    username: "admin",
-    password: "admin"
+    host: "my.ip.here",
+    username: "username",
+    password: "password",
+    port: 90001,
+    protocol: "ws",
+    fromId: "from::id",
+    toId: "to::id",
   });
 
   // Get property
@@ -33,8 +38,8 @@ run();
 
 # API
 
-
 - Connect
+
 ```javascript
 // options are based on https://github.com/mqttjs/MQTT.js#mqttconnecturl-options
 // they additionaly require fromId and toId, more info: url.here
@@ -42,51 +47,60 @@ const usp = await connect(options);
 ```
 
 - Get
-    - get object - all object end with a dot
-    ```javascript
-    await usp.get("Device.Time.");
-    // => {
-    //   "CurrentLocalTime": "2020-12-15T12:33:19Z",
-    //   "Enable": true,
-    //   ...
-    // }
-    ```
-
-    - get property
-    ```javascript
-    await usp.get("Device.Time.CurrentLocalTime"); // => "2020-12-15T12:33:19Z"
-    ```
-
-    - get multiple paths
-    ```javascript
-      await usp.get(["Device.WiFi.Radio.1.", "Device.WiFi.Radio.2."]);
-      // => [
-      // { ... },
-      // { ... }
-      // ]
-    ```
-
-    - get using pattern
-    ```javascript
-    await usp.get('Device.Ethernet.Interface.[Alias=="WAN"].CurrentBitRate'); // => 0
-    ```
-
-    - resolve references in get
-    ```javascript
-    await usp.get("Device.WiFi.Radio.1.").then(usp.resolve); // => { ... }
-    // or if deeper resolution is needed (be careful when using level, going above 3 often causes an infinite reference loop)
-    await usp.get("Device.WiFi.Radio.1.").then(msg => usp.resolve(msg, 3 /* level - defaults to 1 */)); // => { ... } 
-    ```
 
+  - get object - all object end with a dot
+
+  ```javascript
+  await usp.get("Device.Time.");
+  // => {
+  //   "CurrentLocalTime": "2020-12-15T12:33:19Z",
+  //   "Enable": true,
+  //   ...
+  // }
+  ```
+
+  - get property
+
+  ```javascript
+  await usp.get("Device.Time.CurrentLocalTime"); // => "2020-12-15T12:33:19Z"
+  ```
+
+  - get multiple paths
+
+  ```javascript
+  await usp.get(["Device.WiFi.Radio.1.", "Device.WiFi.Radio.2."]);
+  // => [
+  // { ... },
+  // { ... }
+  // ]
+  ```
+
+  - get using pattern
+
+  ```javascript
+  await usp.get('Device.Ethernet.Interface.[Alias=="WAN"].CurrentBitRate'); // => 0
+  ```
+
+  - resolve references in get
+
+  ```javascript
+  await usp.get("Device.WiFi.Radio.1.").then(usp.resolve); // => { ... }
+  // or if deeper resolution is needed (be careful when using level, going above 3 often causes an infinite reference loop)
+  await usp
+    .get("Device.WiFi.Radio.1.")
+    .then((msg) => usp.resolve(msg, 3 /* level - defaults to 1 */)); // => { ... }
+  ```
 
 - Set
 
   - set object - does not need to have all attributes, but some may be required (check USP Reference)
+
   ```javascript
   await usp.set("Device.WiFi.Radio.1.", { Name: "radio-1" }); // => void
   ```
 
   - set property
+
   ```javascript
   await usp.set("Device.WiFi.Radio.1.Name", "radio-1"); // => void
   ```
@@ -94,26 +108,29 @@ const usp = await connect(options);
 - Operate - WIP (response message not working yet)
 
   - operate without no arguments
+
   ```javascript
   await usp.operate("Device.SelfTestDiagnostics()");
   ```
 
   - operate with arguments (for required args check USP Reference)
+
   ```javascript
   const [ping, cleanPing] = await usp.operate("Device.IP.Diagnostics.IPPing()");
-  const results = await ping({ Host: "iopsys.eu" })
-  await cleanPing() // clears ping subscription (optional)
+  const results = await ping({ Host: "iopsys.eu" });
+  await cleanPing(); // clears ping subscription (optional)
   ```
 
-
 - Add
 
   - add with no arguments - adds a new default object
+
   ```javascript
-  await usp.add("Device.NAT.PortMapping.");  // => "Device.NAT.PortMapping.3."
+  await usp.add("Device.NAT.PortMapping."); // => "Device.NAT.PortMapping.3."
   ```
 
   - add with arguments - adds a new object with provided values
+
   ```javascript
   await usp.add("Device.NAT.PortMapping.", {
     Description: "webserver1-set",
@@ -127,6 +144,7 @@ const usp = await connect(options);
   ```
 
 - Delete
+
 ```javascript
 await usp.del("Device.NAT.PortMapping.4."); // => void
-```
\ No newline at end of file
+```
diff --git a/package.json b/package.json
index fd4db85..09006bb 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "usp-js",
-  "version": "0.0.8",
+  "version": "0.0.9",
   "description": "Helper library for easy usp communication using mqtt over tcp or ws.",
   "main": "build/index.js",
   "scripts": {
-- 
GitLab