Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TSMatch
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
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IIoT_external
TSMatch
Commits
70b0fdbb
Commit
70b0fdbb
authored
3 years ago
by
Erkan Karabulut
Browse files
Options
Downloads
Patches
Plain Diff
create the first version of the readme file
parent
8ad6abe5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tsmatch-connector/README.md
+88
-0
88 additions, 0 deletions
tsmatch-connector/README.md
tsmatch-connector/package.json
+1
-1
1 addition, 1 deletion
tsmatch-connector/package.json
with
89 additions
and
1 deletion
tsmatch-connector/README.md
0 → 100644
+
88
−
0
View file @
70b0fdbb

==
# TSMatch Connector
TSMatch Connector allows you to easily connect to a given TSMatch instance and use all the functionalities that TSMatch provides.
## Table of Contents
*
[
Installation
](
#installation
)
*
[
Import
](
#import
)
*
[
Examples
](
#examples
)
*
[
APIs
](
#apis
)
<a
name=
"installation"
></a>
## Installation
`npm install tsmatch-connector --save`
<a
name=
"import"
></a>
## Import
```
import TSMatchConnector from "tsmatch-connector";
```
<a
name=
"examples"
></a>
## Examples
1.
Connecting to a TSMatch instance:
```
import TSMatchConnector from "tsmatch-connector";
let connectionInfo = {
url: "mqtt://localhost:1883",
options: {
username: "admin",
password: "password"
}
}
let connector = new TSMatchConnector(connectionInfo, ((isConnected: boolean) => {
if (isConnected) {
// successfuly connected to the given TSMatch instance
}
}));
```
2.
Subscribing to sensor discovery events:
```
...
connector.subscribeThingDiscovery(((payload: any) => {
console.log("A new IoT Thing is discovered: ", payload.toString())
}));
```
3.
Creating a service request:
```
...
let serviceRequest = {
featureOfInterest: "temperature",
unitOfMeasurement: "degree",
creatorId: "test",
location: "Per-device",
uuid: "test uuid",
domain: "Health",
domainDetail: "Hospital",
monitoringAspect: "Places",
monitoringAspectDetail: "Infrastructure",
};
let responseReceived = (response: any) => {
console.log(response.toString());
}
let observationReceived = (observation: any) => {
console.log(observation.toString());
}
connector.serviceRequest(serviceRequest, responseReceived, observationReceived);
```
<a
name=
"apis"
></a>
## APIs
*
<a
href=
"#connect"
><code>
TSMatchConnector.
<b>
connect()
</b></code></a>
*
<a
href=
"#discovery"
><code>
TSMatchConnector.
<b>
subscribeThingDiscovery()
</b></code></a>
*
<a
href=
"#removal"
><code>
TSMatchConnector.
<b>
subscribeThingRemoval()
</b></code></a>
*
<a
href=
"#unsubDiscovery"
><code>
TSMatchConnector.
<b>
unSubscribeThingDiscovery()
</b></code></a>
*
<a
href=
"#unsubRemoval"
><code>
TSMatchConnector.
<b>
unSubscribeThingRemoval()
</b></code></a>
*
<a
href=
"#requestAll"
><code>
TSMatchConnector.
<b>
requestAllThings()
</b></code></a>
*
<a
href=
"#serviceRequest"
><code>
TSMatchConnector.
<b>
serviceRequest()
</b></code></a>
*
<a
href=
"#deleteRequest"
><code>
TSMatchConnector.
<b>
deleteRequest()
</b></code></a>
This diff is collapsed.
Click to expand it.
tsmatch-connector/package.json
+
1
−
1
View file @
70b0fdbb
...
...
@@ -15,7 +15,7 @@
"iiot"
,
"efpf"
],
"author"
:
"Erkan Karabulut"
,
"author"
:
"Erkan Karabulut
<karabulut@fortiss.org> (https://fortiss.org)
"
,
"license"
:
"ISC"
,
"devDependencies"
:
{
"tslint"
:
"^6.1.3"
,
...
...
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