@blueid/access-cli 0.19.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/createProvisioningData/action.js +7 -3
- package/lib/createProvisioningData/index.js +11 -11
- package/lib/proto/BlueCore_pb.js +976 -0
- package/lib/proto/BlueLock_pb.js +46 -0
- package/lib/proto/BlueSDK_pb.js +73 -0
- package/lib/proto/BlueSystem_pb.js +260 -0
- package/lib/shared/binaryToIntelHex.js +246 -0
- package/lib/shared/crc16.js +26 -0
- package/lib/shared/outputBuffer.js +58 -2
- package/package.json +2 -2
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// @generated by protoc-gen-es v1.4.0 with parameter "target=js+dts"
|
|
2
|
+
// @generated from file BlueLock.proto (syntax proto2)
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
// @ts-nocheck
|
|
5
|
+
|
|
6
|
+
import { proto2 } from "@bufbuild/protobuf";
|
|
7
|
+
import { BlueLocalTimeSchedule } from "./BlueCore_pb.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @generated from enum BlueLockState
|
|
11
|
+
*/
|
|
12
|
+
export const BlueLockState = proto2.makeEnum(
|
|
13
|
+
"BlueLockState",
|
|
14
|
+
[
|
|
15
|
+
{no: 1, name: "UnknownLockState"},
|
|
16
|
+
{no: 2, name: "Locked"},
|
|
17
|
+
{no: 3, name: "Unlocked"},
|
|
18
|
+
{no: 4, name: "Jammed"},
|
|
19
|
+
],
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @generated from message BlueLockConfig
|
|
24
|
+
*/
|
|
25
|
+
export const BlueLockConfig = proto2.makeMessageType(
|
|
26
|
+
"BlueLockConfig",
|
|
27
|
+
() => [
|
|
28
|
+
{ no: 1, name: "openSchedules", kind: "message", T: BlueLocalTimeSchedule, repeated: true },
|
|
29
|
+
{ no: 2, name: "openScheduleByUser", kind: "scalar", T: 8 /* ScalarType.BOOL */, default: false },
|
|
30
|
+
{ no: 20, name: "closedDays", kind: "scalar", T: 13 /* ScalarType.UINT32 */, repeated: true },
|
|
31
|
+
{ no: 21, name: "defaultOpenTimeSec", kind: "scalar", T: 13 /* ScalarType.UINT32 */, default: 5 },
|
|
32
|
+
{ no: 22, name: "extendedOpenTimeSec", kind: "scalar", T: 13 /* ScalarType.UINT32 */, default: 3600 },
|
|
33
|
+
],
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @generated from message BlueLockStatus
|
|
38
|
+
*/
|
|
39
|
+
export const BlueLockStatus = proto2.makeMessageType(
|
|
40
|
+
"BlueLockStatus",
|
|
41
|
+
() => [
|
|
42
|
+
{ no: 1, name: "state", kind: "enum", T: proto2.getEnumType(BlueLockState) },
|
|
43
|
+
{ no: 2, name: "openings", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
|
|
44
|
+
],
|
|
45
|
+
);
|
|
46
|
+
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// @generated by protoc-gen-es v1.4.0 with parameter "target=js+dts"
|
|
2
|
+
// @generated from file BlueSDK.proto (syntax proto2)
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
// @ts-nocheck
|
|
5
|
+
|
|
6
|
+
import { proto2 } from "@bufbuild/protobuf";
|
|
7
|
+
import { BlueBleManufacturerInfo } from "./BlueCore_pb.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @generated from enum BlueDeviceType
|
|
11
|
+
*/
|
|
12
|
+
export const BlueDeviceType = proto2.makeEnum(
|
|
13
|
+
"BlueDeviceType",
|
|
14
|
+
[
|
|
15
|
+
{no: 1, name: "BluetoothDevice"},
|
|
16
|
+
{no: 2, name: "UWBDevice"},
|
|
17
|
+
],
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @generated from message BlueI18n
|
|
22
|
+
*/
|
|
23
|
+
export const BlueI18n = proto2.makeMessageType(
|
|
24
|
+
"BlueI18n",
|
|
25
|
+
() => [
|
|
26
|
+
{ no: 1, name: "nfcWaitMessage", kind: "scalar", T: 9 /* ScalarType.STRING */, default: "Waiting for transponder" },
|
|
27
|
+
{ no: 2, name: "nfcOssSuccessReadConfigurationMessage", kind: "scalar", T: 9 /* ScalarType.STRING */, default: "Configuration read successfully" },
|
|
28
|
+
{ no: 3, name: "nfcOssSuccessUpdateConfigurationMessage", kind: "scalar", T: 9 /* ScalarType.STRING */, default: "Configuration successfully updated" },
|
|
29
|
+
{ no: 4, name: "nfcOssSuccessClearEventsMessage", kind: "scalar", T: 9 /* ScalarType.STRING */, default: "Events successfully cleared" },
|
|
30
|
+
{ no: 5, name: "nfcOssSuccessIsProvisionedMessage", kind: "scalar", T: 9 /* ScalarType.STRING */, default: "Is already provisioned" },
|
|
31
|
+
{ no: 6, name: "nfcOssSuccessProvisionMessage", kind: "scalar", T: 9 /* ScalarType.STRING */, default: "Successfully provisioned" },
|
|
32
|
+
{ no: 7, name: "nfcOssSuccessUnprovisionMessage", kind: "scalar", T: 9 /* ScalarType.STRING */, default: "Successfully unprovisioned" },
|
|
33
|
+
{ no: 8, name: "nfcOssSuccessFormatMessage", kind: "scalar", T: 9 /* ScalarType.STRING */, default: "Transponder was successfully formatted" },
|
|
34
|
+
],
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @generated from message BlueDeviceDetailsBluetooth
|
|
39
|
+
*/
|
|
40
|
+
export const BlueDeviceDetailsBluetooth = proto2.makeMessageType(
|
|
41
|
+
"BlueDeviceDetailsBluetooth",
|
|
42
|
+
() => [
|
|
43
|
+
{ no: 1, name: "rssi", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
|
|
44
|
+
{ no: 2, name: "txPower", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
|
|
45
|
+
{ no: 3, name: "isIBeacon", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
|
|
46
|
+
],
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @generated from message BlueDeviceDetailsUWB
|
|
51
|
+
*/
|
|
52
|
+
export const BlueDeviceDetailsUWB = proto2.makeMessageType(
|
|
53
|
+
"BlueDeviceDetailsUWB",
|
|
54
|
+
() => [
|
|
55
|
+
{ no: 1, name: "notUsed", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
|
|
56
|
+
],
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @generated from message BlueDeviceInfo
|
|
61
|
+
*/
|
|
62
|
+
export const BlueDeviceInfo = proto2.makeMessageType(
|
|
63
|
+
"BlueDeviceInfo",
|
|
64
|
+
() => [
|
|
65
|
+
{ no: 1, name: "deviceType", kind: "enum", T: proto2.getEnumType(BlueDeviceType) },
|
|
66
|
+
{ no: 2, name: "deviceId", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
67
|
+
{ no: 3, name: "distanceMeters", kind: "scalar", T: 2 /* ScalarType.FLOAT */ },
|
|
68
|
+
{ no: 4, name: "manufacturerInfo", kind: "message", T: BlueBleManufacturerInfo, opt: true },
|
|
69
|
+
{ no: 5, name: "bluetooth", kind: "message", T: BlueDeviceDetailsBluetooth, oneof: "details" },
|
|
70
|
+
{ no: 6, name: "uwb", kind: "message", T: BlueDeviceDetailsUWB, oneof: "details" },
|
|
71
|
+
],
|
|
72
|
+
);
|
|
73
|
+
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
// @generated by protoc-gen-es v1.4.0 with parameter "target=js+dts"
|
|
2
|
+
// @generated from file BlueSystem.proto (syntax proto2)
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
// @ts-nocheck
|
|
5
|
+
|
|
6
|
+
import { proto2 } from "@bufbuild/protobuf";
|
|
7
|
+
import { BlueBatteryLevel, BlueBlacklistEntry, BlueEvent, BlueHardwareType, BlueLocalTimeSchedule, BlueLocalTimestamp } from "./BlueCore_pb.js";
|
|
8
|
+
import { BlueLockConfig, BlueLockStatus } from "./BlueLock_pb.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @generated from message BlueBaseConfig
|
|
12
|
+
*/
|
|
13
|
+
export const BlueBaseConfig = proto2.makeMessageType(
|
|
14
|
+
"BlueBaseConfig",
|
|
15
|
+
() => [
|
|
16
|
+
{ no: 1, name: "isoCountry", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
17
|
+
{ no: 2, name: "isoState", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
18
|
+
{ no: 3, name: "utcOffsetMinutes", kind: "scalar", T: 5 /* ScalarType.INT32 */, default: 0 },
|
|
19
|
+
{ no: 4, name: "autoCheckSystemStatus", kind: "scalar", T: 8 /* ScalarType.BOOL */, default: false },
|
|
20
|
+
],
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @generated from message BlueBleConfig
|
|
25
|
+
*/
|
|
26
|
+
export const BlueBleConfig = proto2.makeMessageType(
|
|
27
|
+
"BlueBleConfig",
|
|
28
|
+
() => [
|
|
29
|
+
{ no: 1, name: "isAdvertising", kind: "scalar", T: 8 /* ScalarType.BOOL */, default: true },
|
|
30
|
+
{ no: 2, name: "advertisingSchedules", kind: "message", T: BlueLocalTimeSchedule, repeated: true },
|
|
31
|
+
{ no: 3, name: "maxPowerAdvertisingSchedulesIndices", kind: "scalar", T: 13 /* ScalarType.UINT32 */, repeated: true },
|
|
32
|
+
{ no: 4, name: "advertisingIntervalMs", kind: "scalar", T: 13 /* ScalarType.UINT32 */, default: 500 },
|
|
33
|
+
{ no: 5, name: "maxConnectionTimeoutMs", kind: "scalar", T: 13 /* ScalarType.UINT32 */, default: 3000 },
|
|
34
|
+
{ no: 6, name: "txPowerLevel", kind: "scalar", T: 13 /* ScalarType.UINT32 */, default: 3 },
|
|
35
|
+
{ no: 7, name: "advertisedTxPower1Meter", kind: "scalar", T: 5 /* ScalarType.INT32 */, default: -77 },
|
|
36
|
+
{ no: 8, name: "isIBeaconAdvertisement", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
|
|
37
|
+
],
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @generated from message BlueOnlineConfig
|
|
42
|
+
*/
|
|
43
|
+
export const BlueOnlineConfig = proto2.makeMessageType(
|
|
44
|
+
"BlueOnlineConfig",
|
|
45
|
+
() => [
|
|
46
|
+
{ no: 1, name: "connectSchedules", kind: "message", T: BlueLocalTimeSchedule, repeated: true },
|
|
47
|
+
{ no: 2, name: "wifiSSID", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
48
|
+
{ no: 3, name: "wifiPassword", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
49
|
+
{ no: 4, name: "timeoutSec", kind: "scalar", T: 13 /* ScalarType.UINT32 */, default: 30 },
|
|
50
|
+
],
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @generated from message BlueAccessConfigGroup
|
|
55
|
+
*/
|
|
56
|
+
export const BlueAccessConfigGroup = proto2.makeMessageType(
|
|
57
|
+
"BlueAccessConfigGroup",
|
|
58
|
+
() => [
|
|
59
|
+
{ no: 1, name: "groupId", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
|
|
60
|
+
{ no: 2, name: "schedules", kind: "message", T: BlueLocalTimeSchedule, repeated: true },
|
|
61
|
+
],
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @generated from message BlueAccessConfig
|
|
66
|
+
*/
|
|
67
|
+
export const BlueAccessConfig = proto2.makeMessageType(
|
|
68
|
+
"BlueAccessConfig",
|
|
69
|
+
() => [
|
|
70
|
+
{ no: 1, name: "id", kind: "scalar", T: 13 /* ScalarType.UINT32 */, default: 1 },
|
|
71
|
+
{ no: 2, name: "siteId", kind: "scalar", T: 13 /* ScalarType.UINT32 */, default: 1 },
|
|
72
|
+
{ no: 3, name: "groups", kind: "message", T: BlueAccessConfigGroup, repeated: true },
|
|
73
|
+
],
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
*
|
|
78
|
+
* -- Oss SecureId --
|
|
79
|
+
*
|
|
80
|
+
*
|
|
81
|
+
* @generated from message BlueOssConfig
|
|
82
|
+
*/
|
|
83
|
+
export const BlueOssConfig = proto2.makeMessageType(
|
|
84
|
+
"BlueOssConfig",
|
|
85
|
+
() => [
|
|
86
|
+
{ no: 1, name: "sidMifareAesKey", kind: "scalar", T: 12 /* ScalarType.BYTES */, default: new Uint8Array([0xFF, 0xEE, 0xDD, 0xCC, 0xBB, 0xAA, 0x99, 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x11, 0x00]) },
|
|
87
|
+
{ no: 2, name: "sidMifareAid", kind: "scalar", T: 13 /* ScalarType.UINT32 */, default: 16076801 },
|
|
88
|
+
{ no: 3, name: "soUpdater", kind: "scalar", T: 8 /* ScalarType.BOOL */, default: false },
|
|
89
|
+
{ no: 4, name: "soPushEvents", kind: "scalar", T: 8 /* ScalarType.BOOL */, default: false },
|
|
90
|
+
{ no: 5, name: "soWritePendingEvents", kind: "scalar", T: 8 /* ScalarType.BOOL */, default: true },
|
|
91
|
+
{ no: 6, name: "soUpdateFromBlacklist", kind: "scalar", T: 8 /* ScalarType.BOOL */, default: true },
|
|
92
|
+
{ no: 7, name: "soMifareAesKey", kind: "scalar", T: 12 /* ScalarType.BYTES */, default: new Uint8Array([0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F]) },
|
|
93
|
+
{ no: 8, name: "soMifareAid", kind: "scalar", T: 13 /* ScalarType.UINT32 */, default: 16076800 },
|
|
94
|
+
],
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @generated from message BlueSystemConfig
|
|
99
|
+
*/
|
|
100
|
+
export const BlueSystemConfig = proto2.makeMessageType(
|
|
101
|
+
"BlueSystemConfig",
|
|
102
|
+
() => [
|
|
103
|
+
{ no: 1, name: "configId", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
104
|
+
{ no: 2, name: "base", kind: "message", T: BlueBaseConfig },
|
|
105
|
+
{ no: 3, name: "ble", kind: "message", T: BlueBleConfig },
|
|
106
|
+
{ no: 4, name: "online", kind: "message", T: BlueOnlineConfig },
|
|
107
|
+
{ no: 5, name: "access", kind: "message", T: BlueAccessConfig },
|
|
108
|
+
{ no: 6, name: "oss", kind: "message", T: BlueOssConfig },
|
|
109
|
+
{ no: 7, name: "lock", kind: "message", T: BlueLockConfig, opt: true },
|
|
110
|
+
],
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @generated from message BlueSystemTimeUnix
|
|
115
|
+
*/
|
|
116
|
+
export const BlueSystemTimeUnix = proto2.makeMessageType(
|
|
117
|
+
"BlueSystemTimeUnix",
|
|
118
|
+
() => [
|
|
119
|
+
{ no: 1, name: "epoch", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
|
|
120
|
+
],
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* @generated from message BlueSystemUpdate
|
|
125
|
+
*/
|
|
126
|
+
export const BlueSystemUpdate = proto2.makeMessageType(
|
|
127
|
+
"BlueSystemUpdate",
|
|
128
|
+
() => [
|
|
129
|
+
{ no: 1, name: "config", kind: "message", T: BlueSystemConfig, opt: true },
|
|
130
|
+
{ no: 2, name: "timeUnix", kind: "message", T: BlueSystemTimeUnix, opt: true },
|
|
131
|
+
],
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* @generated from message BlueSystemSettings
|
|
136
|
+
*/
|
|
137
|
+
export const BlueSystemSettings = proto2.makeMessageType(
|
|
138
|
+
"BlueSystemSettings",
|
|
139
|
+
() => [
|
|
140
|
+
{ no: 1, name: "blacklistMaxEntriesCount", kind: "scalar", T: 13 /* ScalarType.UINT32 */, default: 0 },
|
|
141
|
+
{ no: 2, name: "blacklistEntriesCount", kind: "scalar", T: 13 /* ScalarType.UINT32 */, default: 0 },
|
|
142
|
+
{ no: 3, name: "eventLogMaxEntriesCount", kind: "scalar", T: 13 /* ScalarType.UINT32 */, default: 0 },
|
|
143
|
+
{ no: 4, name: "eventLogEntriesCount", kind: "scalar", T: 13 /* ScalarType.UINT32 */, default: 0 },
|
|
144
|
+
{ no: 5, name: "eventLogSequenceId", kind: "scalar", T: 13 /* ScalarType.UINT32 */, default: 0 },
|
|
145
|
+
{ no: 6, name: "eventLogIndex", kind: "scalar", T: 13 /* ScalarType.UINT32 */, default: 0 },
|
|
146
|
+
{ no: 7, name: "systemLogMaxEntriesCount", kind: "scalar", T: 13 /* ScalarType.UINT32 */, default: 0 },
|
|
147
|
+
{ no: 8, name: "systemLogEntriesCount", kind: "scalar", T: 13 /* ScalarType.UINT32 */, default: 0 },
|
|
148
|
+
{ no: 9, name: "systemLogSequenceId", kind: "scalar", T: 13 /* ScalarType.UINT32 */, default: 0 },
|
|
149
|
+
{ no: 10, name: "systemLogIndex", kind: "scalar", T: 13 /* ScalarType.UINT32 */, default: 0 },
|
|
150
|
+
{ no: 11, name: "timeWasSet", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
|
|
151
|
+
{ no: 12, name: "isBatteryLow", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
|
|
152
|
+
],
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* @generated from message BlueSystemProvisioning
|
|
157
|
+
*/
|
|
158
|
+
export const BlueSystemProvisioning = proto2.makeMessageType(
|
|
159
|
+
"BlueSystemProvisioning",
|
|
160
|
+
() => [
|
|
161
|
+
{ no: 1, name: "hardwareType", kind: "enum", T: proto2.getEnumType(BlueHardwareType), default: BlueHardwareType.TestHardware },
|
|
162
|
+
{ no: 2, name: "deviceId", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
163
|
+
{ no: 3, name: "serialNumber", kind: "scalar", T: 9 /* ScalarType.STRING */, default: "00000000000000000000" },
|
|
164
|
+
{ no: 4, name: "terminalPrivateKey", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
|
|
165
|
+
{ no: 5, name: "signaturePublicKey", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
|
|
166
|
+
],
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* @generated from message BlueSystemStatus
|
|
171
|
+
*/
|
|
172
|
+
export const BlueSystemStatus = proto2.makeMessageType(
|
|
173
|
+
"BlueSystemStatus",
|
|
174
|
+
() => [
|
|
175
|
+
{ no: 1, name: "configId", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
176
|
+
{ no: 2, name: "deviceId", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
177
|
+
{ no: 3, name: "serialNumber", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
178
|
+
{ no: 4, name: "hardwareType", kind: "enum", T: proto2.getEnumType(BlueHardwareType) },
|
|
179
|
+
{ no: 5, name: "batteryLevel", kind: "enum", T: proto2.getEnumType(BlueBatteryLevel) },
|
|
180
|
+
{ no: 6, name: "applicationVersion", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
|
|
181
|
+
{ no: 7, name: "localTime", kind: "message", T: BlueLocalTimestamp },
|
|
182
|
+
{ no: 8, name: "settings", kind: "message", T: BlueSystemSettings },
|
|
183
|
+
{ no: 9, name: "blacklistEntriesCount", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
|
|
184
|
+
{ no: 10, name: "eventLogEntriesCount", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
|
|
185
|
+
{ no: 11, name: "eventLogSequenceId", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
|
|
186
|
+
{ no: 12, name: "systemLogEntriesCount", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
|
|
187
|
+
{ no: 13, name: "systemLogSequenceId", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
|
|
188
|
+
{ no: 14, name: "lock", kind: "message", T: BlueLockStatus, opt: true },
|
|
189
|
+
],
|
|
190
|
+
);
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* @generated from message BlueSystemLogQuery
|
|
194
|
+
*/
|
|
195
|
+
export const BlueSystemLogQuery = proto2.makeMessageType(
|
|
196
|
+
"BlueSystemLogQuery",
|
|
197
|
+
() => [
|
|
198
|
+
{ no: 1, name: "maxCount", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
|
|
199
|
+
{ no: 2, name: "sequenceId", kind: "scalar", T: 13 /* ScalarType.UINT32 */, oneof: "start" },
|
|
200
|
+
{ no: 3, name: "fromHead", kind: "scalar", T: 8 /* ScalarType.BOOL */, oneof: "start" },
|
|
201
|
+
],
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* @generated from message BlueSystemLogEntry
|
|
206
|
+
*/
|
|
207
|
+
export const BlueSystemLogEntry = proto2.makeMessageType(
|
|
208
|
+
"BlueSystemLogEntry",
|
|
209
|
+
() => [
|
|
210
|
+
{ no: 1, name: "sequenceId", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
|
|
211
|
+
{ no: 2, name: "time", kind: "message", T: BlueLocalTimestamp },
|
|
212
|
+
{ no: 3, name: "severity", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
|
|
213
|
+
{ no: 4, name: "line", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
|
|
214
|
+
{ no: 5, name: "file", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
215
|
+
{ no: 6, name: "message", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
216
|
+
],
|
|
217
|
+
);
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* @generated from message BlueSystemLogResult
|
|
221
|
+
*/
|
|
222
|
+
export const BlueSystemLogResult = proto2.makeMessageType(
|
|
223
|
+
"BlueSystemLogResult",
|
|
224
|
+
() => [
|
|
225
|
+
{ no: 1, name: "entries", kind: "message", T: BlueSystemLogEntry, repeated: true },
|
|
226
|
+
],
|
|
227
|
+
);
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* @generated from message BlueEventLogQuery
|
|
231
|
+
*/
|
|
232
|
+
export const BlueEventLogQuery = proto2.makeMessageType(
|
|
233
|
+
"BlueEventLogQuery",
|
|
234
|
+
() => [
|
|
235
|
+
{ no: 1, name: "maxCount", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
|
|
236
|
+
{ no: 2, name: "sequenceId", kind: "scalar", T: 13 /* ScalarType.UINT32 */, oneof: "start" },
|
|
237
|
+
{ no: 3, name: "fromHead", kind: "scalar", T: 8 /* ScalarType.BOOL */, oneof: "start" },
|
|
238
|
+
],
|
|
239
|
+
);
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* @generated from message BlueEventLogResult
|
|
243
|
+
*/
|
|
244
|
+
export const BlueEventLogResult = proto2.makeMessageType(
|
|
245
|
+
"BlueEventLogResult",
|
|
246
|
+
() => [
|
|
247
|
+
{ no: 1, name: "events", kind: "message", T: BlueEvent, repeated: true },
|
|
248
|
+
],
|
|
249
|
+
);
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* @generated from message BlueBlacklistEntries
|
|
253
|
+
*/
|
|
254
|
+
export const BlueBlacklistEntries = proto2.makeMessageType(
|
|
255
|
+
"BlueBlacklistEntries",
|
|
256
|
+
() => [
|
|
257
|
+
{ no: 1, name: "entries", kind: "message", T: BlueBlacklistEntry, repeated: true },
|
|
258
|
+
],
|
|
259
|
+
);
|
|
260
|
+
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
// From https://en.wikipedia.org/wiki/Intel_HEX
|
|
2
|
+
//
|
|
3
|
+
// Intel Hex Line Format (I32HEX, 32 bit addresses) is
|
|
4
|
+
// :llaaaatt[dd...]cc
|
|
5
|
+
// Where
|
|
6
|
+
// ll=data length
|
|
7
|
+
// aaaa=lower 16 bit address
|
|
8
|
+
// tt=record type
|
|
9
|
+
// 00 - data record
|
|
10
|
+
// 01 - end-of-file record
|
|
11
|
+
// 02 - extended segment address record (Not used in I32Hex)
|
|
12
|
+
// 04 - extended linear address record
|
|
13
|
+
// 05 - start linear address record (MDK-ARM only)
|
|
14
|
+
// cc=checksum = 2's comp of negative of sum of all record bytes
|
|
15
|
+
|
|
16
|
+
var DEFAULT_LINE_TERMINATOR = '\n'
|
|
17
|
+
var SEGMENT_LENGTH_BYTES = 0x10000
|
|
18
|
+
var MAX_BASE_ADDRESS = 0xffff
|
|
19
|
+
|
|
20
|
+
const utils = {
|
|
21
|
+
numberToHexString: function (d, padding) {
|
|
22
|
+
var hex = Number(d).toString(16).toUpperCase()
|
|
23
|
+
padding = typeof padding === 'undefined' || padding === null ? (padding = 8) : padding
|
|
24
|
+
|
|
25
|
+
while (hex.length < padding) {
|
|
26
|
+
hex = '0' + hex
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return hex
|
|
30
|
+
},
|
|
31
|
+
numberToHexStringLittleEndian: function (d, padding) {
|
|
32
|
+
if (padding % 2 != 0)
|
|
33
|
+
throw new Error('numberToHexStringLittleEndian requires an even padding [' + padding + ']')
|
|
34
|
+
|
|
35
|
+
var bigEndianHex = utils.numberToHexString(d, padding)
|
|
36
|
+
|
|
37
|
+
var littleEndianHex = ''
|
|
38
|
+
while (bigEndianHex.length) {
|
|
39
|
+
var nibble = bigEndianHex[0] + bigEndianHex[1]
|
|
40
|
+
bigEndianHex = bigEndianHex.slice(2)
|
|
41
|
+
littleEndianHex = nibble + littleEndianHex
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return littleEndianHex
|
|
45
|
+
},
|
|
46
|
+
hexStringByWords: function (hex, littleEndian) {
|
|
47
|
+
if (!hex || hex.length % 8 !== 0) throw new Error('hexStringByWords requires a word-aligned hex string')
|
|
48
|
+
littleEndian = !!littleEndian
|
|
49
|
+
|
|
50
|
+
hex = hex.toUpperCase()
|
|
51
|
+
const wordStrings = []
|
|
52
|
+
|
|
53
|
+
for (var i = 0; i < hex.length; i += 8) {
|
|
54
|
+
var ws = hex.substring(i, i + 8)
|
|
55
|
+
if (littleEndian) {
|
|
56
|
+
ws = ws.substring(6, 8) + ws.substring(4, 6) + ws.substring(2, 4) + ws.substring(0, 2)
|
|
57
|
+
}
|
|
58
|
+
wordStrings.push(ws)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return wordStrings.join(' ')
|
|
62
|
+
},
|
|
63
|
+
hexToDecimal: function (hexString) {
|
|
64
|
+
try {
|
|
65
|
+
return parseInt(hexString, 16)
|
|
66
|
+
} catch (e) {
|
|
67
|
+
console.error('Error parsing hexString: ', e)
|
|
68
|
+
return 0
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
toUInt32: function (val) {
|
|
72
|
+
return val >>> 0
|
|
73
|
+
},
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function IntelHexFileOut(startAddress) {
|
|
77
|
+
if (startAddress === void 0) startAddress = 0
|
|
78
|
+
|
|
79
|
+
this.contents = ''
|
|
80
|
+
this.extendedAddress = 0
|
|
81
|
+
this.relativeAddress = 0
|
|
82
|
+
this.lastAppendEndedAtBoundary = false
|
|
83
|
+
this.lineTerminator = DEFAULT_LINE_TERMINATOR
|
|
84
|
+
|
|
85
|
+
this.setAddress(startAddress)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
IntelHexFileOut.withIntelHex = function (initialHexString, startAddress) {
|
|
89
|
+
const intelhexProcessor = new IntelHexFileOut(startAddress)
|
|
90
|
+
intelhexProcessor.contents = initialHexString.toUpperCase()
|
|
91
|
+
intelhexProcessor.reopen()
|
|
92
|
+
return intelhexProcessor
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
IntelHexFileOut.prototype.reopen = function () {
|
|
96
|
+
const indexOfTerminator = this.contents.indexOf(this.eofMarker())
|
|
97
|
+
if (indexOfTerminator !== -1) {
|
|
98
|
+
this.contents = this.contents.substring(0, indexOfTerminator)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
IntelHexFileOut.prototype.eofMarker = function () {
|
|
103
|
+
return ':00000001FF' + this.lineTerminator
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
IntelHexFileOut.prototype.setAddress = function (address) {
|
|
107
|
+
var extendedAddress = this._extendedAddressFromAddress(address)
|
|
108
|
+
this.relativeAddress = this._addressRelativeToExtendedAddress(address, extendedAddress)
|
|
109
|
+
|
|
110
|
+
if (this.extendedAddress === extendedAddress) return
|
|
111
|
+
this.extendedAddress = extendedAddress
|
|
112
|
+
|
|
113
|
+
this._writeExtendedAddress()
|
|
114
|
+
|
|
115
|
+
this.lastAppendEndedAtBoundary = false
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
IntelHexFileOut.prototype.writeHexStringAtAddress = function (address, hexString) {
|
|
119
|
+
if (!hexString || hexString.length === 0 || hexString.length > SEGMENT_LENGTH_BYTES || hexString.length % 2 !== 0) {
|
|
120
|
+
throw new Error('invalid length of hexString [' + hexString.length + ']')
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
this.setAddress(address)
|
|
124
|
+
this.appendHexString(hexString)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
IntelHexFileOut.prototype.appendBuffer = function (buffer, littleEndian) {
|
|
128
|
+
if (!buffer) throw new Error('Buffer required')
|
|
129
|
+
if (buffer.length % 4 !== 0) throw new Error('Buffer length not 32 bit word aligned')
|
|
130
|
+
|
|
131
|
+
const words = []
|
|
132
|
+
for (var offset = 0; offset < buffer.length; offset += 4) {
|
|
133
|
+
const uint32 = littleEndian ? buffer.readUInt32LE(offset) : buffer.readUInt32BE(offset)
|
|
134
|
+
words.push(uint32)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
this.appendWords(words, littleEndian)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
IntelHexFileOut.prototype.appendWords = function (words, littleEndian) {
|
|
141
|
+
if (!words || words.length === 0) {
|
|
142
|
+
// || words.length * 4 > SEGMENT_LENGTH_BYTES ){
|
|
143
|
+
throw new Error('invalid number of words [' + words.length + ']')
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
var encodeAsString = littleEndian ? utils.numberToHexStringLittleEndian : utils.numberToHexString
|
|
147
|
+
|
|
148
|
+
var lineHexString = ''
|
|
149
|
+
while (words.length) {
|
|
150
|
+
lineHexString += encodeAsString(words.shift(), 8)
|
|
151
|
+
if (lineHexString.length === 32) {
|
|
152
|
+
this.appendHexString(lineHexString)
|
|
153
|
+
lineHexString = ''
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (lineHexString.length) {
|
|
158
|
+
this.appendHexString(lineHexString)
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
IntelHexFileOut.prototype.appendHexString = function (hexString) {
|
|
163
|
+
if (!hexString || hexString.length === 0 || hexString.length > SEGMENT_LENGTH_BYTES || hexString.length % 2 !== 0) {
|
|
164
|
+
throw new Error('invalid length of hexString [' + hexString.length + ']')
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
while (hexString.length) {
|
|
168
|
+
var lineHexCharLength = hexString.length < 32 ? hexString.length : 32
|
|
169
|
+
var lineHexString = hexString.slice(0, lineHexCharLength)
|
|
170
|
+
|
|
171
|
+
hexString = hexString.slice(lineHexCharLength)
|
|
172
|
+
|
|
173
|
+
this._handleBlockContinuation()
|
|
174
|
+
|
|
175
|
+
var byteCount = lineHexString.length / 2
|
|
176
|
+
|
|
177
|
+
if (this.relativeAddress + byteCount > 0x10000) {
|
|
178
|
+
throw new Error('appendHexString cannot write across 63336 byte boundary')
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
this._writeHexString(lineHexString)
|
|
182
|
+
|
|
183
|
+
this.relativeAddress += byteCount
|
|
184
|
+
if (this.relativeAddress == SEGMENT_LENGTH_BYTES) {
|
|
185
|
+
this.extendedAddress += 0x0001
|
|
186
|
+
this.relativeAddress = 0x0000
|
|
187
|
+
this.lastAppendEndedAtBoundary = true
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
IntelHexFileOut.prototype.close = function () {
|
|
193
|
+
this.contents += this.eofMarker()
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
IntelHexFileOut.prototype._writeExtendedAddress = function () {
|
|
197
|
+
var data = this.extendedAddress
|
|
198
|
+
var intelHex = '02' + '0000' + '04' + utils.numberToHexString(data, 4)
|
|
199
|
+
intelHex += this._crc(intelHex)
|
|
200
|
+
this.contents += ':' + intelHex + this.lineTerminator
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
IntelHexFileOut.prototype._writeHexString = function (hexString) {
|
|
204
|
+
var byteCount = hexString.length / 2
|
|
205
|
+
var intelHex =
|
|
206
|
+
utils.numberToHexString(byteCount, 2) + utils.numberToHexString(this.relativeAddress, 4) + '00' + hexString
|
|
207
|
+
intelHex += this._crc(intelHex)
|
|
208
|
+
this.contents += ':' + intelHex + this.lineTerminator
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
IntelHexFileOut.prototype._handleBlockContinuation = function () {
|
|
212
|
+
if (this.lastAppendEndedAtBoundary) {
|
|
213
|
+
this._writeExtendedAddress()
|
|
214
|
+
this.lastAppendEndedAtBoundary = false
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
IntelHexFileOut.prototype._crc = function (intelHexString) {
|
|
219
|
+
var sum = 0
|
|
220
|
+
for (var i = 0; i < intelHexString.length; i += 2) {
|
|
221
|
+
var byteHexString = intelHexString.charAt(i) + intelHexString.charAt(i + 1)
|
|
222
|
+
sum += utils.hexToDecimal(byteHexString) & 0xff
|
|
223
|
+
}
|
|
224
|
+
var crc = ((sum ^ 0xff) + 1) & 0xff
|
|
225
|
+
return utils.numberToHexString(crc, 2)
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
IntelHexFileOut.prototype._extendedAddressFromAddress = function (address) {
|
|
229
|
+
return address >>> 16
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
IntelHexFileOut.prototype._addressRelativeToExtendedAddress = function (address, extendedAddress) {
|
|
233
|
+
var baseAddress = utils.toUInt32(extendedAddress << 16)
|
|
234
|
+
if (address < baseAddress || address - baseAddress > MAX_BASE_ADDRESS) {
|
|
235
|
+
throw new Error('address must be 0 to 65535 bytes above baseAddress [' + baseAddress + ']')
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
return address - baseAddress
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export default (startAddress, littleEndian, buffer) => {
|
|
242
|
+
var processor = new IntelHexFileOut(startAddress)
|
|
243
|
+
processor.appendBuffer(buffer, littleEndian)
|
|
244
|
+
processor.close()
|
|
245
|
+
return processor.contents
|
|
246
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const STORAGE_CRC_16_MAGIC_NUMBER = 0x92db
|
|
2
|
+
|
|
3
|
+
export default (buffer, start, magicMarker = false) => {
|
|
4
|
+
// CRC-16-CCITT (XModem)
|
|
5
|
+
const crcTable = [
|
|
6
|
+
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad,
|
|
7
|
+
0xe1ce, 0xf1ef,
|
|
8
|
+
]
|
|
9
|
+
|
|
10
|
+
let crc = 0xffff
|
|
11
|
+
|
|
12
|
+
const data = new Uint8Array(buffer)
|
|
13
|
+
|
|
14
|
+
for (let i = start; i < data.length; i++) {
|
|
15
|
+
crc = (crc << 4) ^ crcTable[((crc >>> 12) ^ data[i]) & 0x0f]
|
|
16
|
+
crc = (crc << 4) ^ crcTable[((crc >>> 12) ^ (data[i] >>> 4)) & 0x0f]
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (magicMarker) {
|
|
20
|
+
crc ^= STORAGE_CRC_16_MAGIC_NUMBER
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
crc &= 0xffff
|
|
24
|
+
|
|
25
|
+
return crc
|
|
26
|
+
}
|