This repository has been archived by the owner on Feb 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(simulator): read cfg, update sensor data
- Loading branch information
1 parent
73edee9
commit 88bf2f5
Showing
4 changed files
with
79 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export const defaultConfig = { | ||
act: false, // Whether to enable the active mode | ||
actwt: 60, //In active mode: wait this amount of seconds until sending the next update. The actual interval will be this time plus the time it takes to get a GPS fix. | ||
mvres: 300, // (movement resolution) In passive mode: Time in seconds to wait after detecting movement before sending the next update | ||
mvt: 3600, // (movement timeout) In passive mode: Send update at least this often (in seconds) | ||
gpst: 60, // GPS timeout (in seconds): timeout for GPS fix | ||
celt: 600, // cellular timeout (in seconds): timeout for acquiring cellular connection | ||
acct: 1, // Accelerometer threshold: minimal absolute value for and accelerometer reading to be considered movement. | ||
} as const |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
export const deviceTopics = (deviceId: string) => ({ | ||
config: `/devices/${deviceId}/config`, | ||
state: `/devices/${deviceId}/state`, | ||
|
||
export const deviceTopics = ({ | ||
getTwinProperties: (rid: string) => `$iothub/twin/GET/?$rid=${rid}`, | ||
updateTwinReported: (rid: string) => `$iothub/twin/PATCH/properties/reported/?$rid=${rid}`, | ||
updateTwinReportedAccepted: (rid: string) => new RegExp(`^\\$iothub/twin/res/204/\\?\\$rid=${rid}&\\$version=[0-9]+$`), | ||
twinResponses: '$iothub/twin/res/#', | ||
twinResponse: ({ status, rid }: { status: number, rid: string }) => `$iothub/twin/res/${status}/?$rid=${rid}` | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { v4 } from 'uuid' | ||
|
||
export const dpsTopics = ({ | ||
registrationResponses: '$dps/registrations/res/#', | ||
register: () => `$dps/registrations/PUT/iotdps-register/?$rid=${v4()}`, | ||
registationStatus: (operationId: string) => `$dps/registrations/GET/iotdps-get-operationstatus/?$rid=${v4()}&operationId=${operationId}`, | ||
registrationResult: (status: number) => `$dps/registrations/res/${status}` | ||
}) |