Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
U
usp-js
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WebSDK
usp-js
Commits
a7431f6e
Commit
a7431f6e
authored
4 years ago
by
Marin Karamihalev
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of dev.iopsys.eu:iopsys/usp-js
parents
5b944982
29da8879
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#12401
failed
4 years ago
Stage: install
Stage: build
Stage: unit-testing
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+63
-7
63 additions, 7 deletions
README.md
with
63 additions
and
7 deletions
README.md
+
63
−
7
View file @
a7431f6e
...
...
@@ -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
```
-
o
perate
with arguments (for required args check USP Reference)
-
O
perate
```
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
}))
```
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment