@corelink/cls-aoa
v0.2.0
Published
> via NPM ```bash npm i -g @corelink/cls-aoa ```
Downloads
9
Readme
Installation
via NPM
npm i -g @corelink/cls-aoa
via downloaded zip archive
- unzip archive to wherever you want. eg. /opt/cls-aoa
- add path to system environment variable.
export PATH=$PATH:/opt/cls-aoa
Windows OS is deferent. Google it yourself.
Usage
Start service
cls-aoa path/to/cpaFile [flags]
Eg.
cls-aoa ~/Document/demo.cpa
HTTP APIs
List all beacons
GET http://localhost:44444/beacons
Parameters
| Name | In | Optional | Description | |---|---|---|---| | macs | query | YES | Beacon macs |
HTTP Status
| Code | Description | Body | |---|---|---| | 200 | OK | JSON Result
Result Structure
{
[beaconMac: string]: {
x: number; // Position x-axis
y: number; // Position y-axis
z: number; // Position z-axis
mapId: string; // Map ID
zoneId: string; // Zone ID
updatedAt: number; // Timestamp for last package
userData: {
161: {
channel: number; //
frequency: number; //
power: { //
type: 'TI' | 'Nordic'; //
value: number; //
};
sos: boolean; // Button pressed
battery: number; // Battery percentage
};
};
}
}
Example. GET http://localhost:44444/beacons?macs=806fb00c45d9,806fb00c45c9
{
"806fb00c45d9": {
"x":9.573189735412598,
"y":5.213486194610596,
"z":0.800000011920929,
"mapId":"lwlx6fFgu",
"zoneId":"z1",
"updatedAt":1571109529308,
"userData":{
"161":{
"channel":2481,
"frequency":50,
"power":{
"type":"TI",
"value":5
},
"sos":false,
"battery":83
}
}
},
"806fb00c45c9":{
"x":6.329273700714111,
"y":7.880806922912598,
"z":0.800000011920929,
"mapId":"lwlx6fFgu",
"zoneId":"z1",
"updatedAt":1571109529215,
"userData":{
"161":{
"channel":2481,
"frequency":110,
"power":{
"type":"TI",
"value":0
},
"sos":false,
"battery":95
}
}
}
}
List all locators
GET http://localhost:44444/locators
Parameters
| Name | In | Optional | Description | |---|---|---|---| | macs | query | YES | Locator macs |
HTTP Status
| Code | Description | Body | |---|---|---| | 200 | OK | JSON Result
Result Structure
{
[locatorIpAddressV4: string]: {
mac: string; // Locator mac
angles: number[6]; // Locator angles
updatedAt: number; // Timestamp for last package
}
}
Example. GET http://localhost:44444/locators?macs=18:04:ed:7a:c5:01,18:04:ed:7a:c4:78
{
"192.168.123.137": {
"mac": "18:04:ed:7a:c5:01",
"angles": [26, -137, 2150, 60, 550, 491],
"updatedAt": 1571109502971
},
"192.168.123.28": {
"mac": "18:04:ed:7a:c4:78",
"angles": [118, 191, 2091, -113, 248, 646],
"updatedAt": 1571109502988
}
}
Retrieve a beacon
GET http://localhost:44444/beacons/:mac
Parameters
| Name | In | Optional | Description | |---|---|---|---| | mac | path | NO | Beacon mac |
HTTP Status
| Code | Description | Body | |---|---|---| | 200 | OK | JSON Result | 404 | Not Fount | Error Message
Result Structure
{
mac: string; // Beacon mac
x: number; // Position x-axis
y: number; // Position y-axis
z: number; // Position z-axis
mapId: string; // Map ID
zoneId: string; // Zone ID
updatedAt: number; // Timestamp for last package
userData: {
161: {
channel: number; //
frequency: number; //
power: { //
type: 'TI' | 'Nordic'; //
value: number; //
};
sos: boolean; // Button pressed
battery: number; // Battery percentage
};
};
}
Example. GET http://localhost:44444/beacons/806fb00c45c9
{
"mac": "806fb00c45c9",
"x": 6.963463306427002,
"y": 6.864238739013672,
"z": 0.800000011920929,
"mapId": "lwlx6fFgu",
"zoneId": "z1",
"updatedAt": 1571120302882,
"userData": {
"161": {
"channel": 2481,
"frequency": 110,
"power":{
"type": "TI",
"value": 0
},
"sos": false,
"battery": 95
}
}
}
Example. GET http://localhost:44444/beacons/mac_not_existed
Beacon not found
Retrieve a locator
GET http://localhost:44444/locators/:mac
Parameters
| Name | In | Optional | Description | |---|---|---|---| | mac | path | NO | Locator mac |
HTTP Status
| Code | Description | Body | |---|---|---| | 200 | OK | JSON Result | 404 | Not Fount | Error Message
Result Structure
{
ip: string; // Locator ip address v4
mac: string; // Locator mac
angles: number[6]; // Locator angles
updatedAt: number; // Timestamp for last package
}
Example. GET http://localhost:44444/locators/18:04:ed:7a:c4:78
{
"ip": "192.168.123.28",
"mac": "18:04:ed:7a:c4:78",
"angles": [119, 190, 2093, -122, 232, 641],
"updatedAt": 1571118991384
}
Example. GET http://localhost:44444/locators/mac_not_existed
Locator not found