react-native-beidou 1.0.7 → 1.1.1
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/BeiDouAIDLTestPage.tsx +505 -19
- package/LogManager.ts +284 -0
- package/README.md +108 -78
- package/android/.gradle/8.9/checksums/checksums.lock +0 -0
- package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -2
- package/android/.idea/caches/deviceStreaming.xml +993 -0
- package/android/build.gradle +15 -6
- package/android/src/main/AndroidManifest.xml +3 -1
- package/android/src/main/java/com/{cmcc_rn_module → fxzs.rnbeidou}/BeiDouBluetoothModule.java +338 -244
- package/android/src/main/java/com/{cmcc_rn_module → fxzs.rnbeidou}/BeiDouBluetoothPackage.java +2 -2
- package/android/src/main/java/com/fxzs.rnbeidou/BeidouAidlHelper.java +643 -0
- package/android/src/main/java/com/{cmcc_rn_module → fxzs.rnbeidou}/ByteUtil.java +2 -2
- package/android/src/main/java/com/{cmcc_rn_module → fxzs.rnbeidou}/ChatDBManager.java +46 -46
- package/android/src/main/java/com/{cmcc_rn_module → fxzs.rnbeidou}/JsonUtil.java +4 -4
- package/android/src/main/java/com/fxzs.rnbeidou/LogManager.java +488 -0
- package/android/src/main/java/com/{cmcc_rn_module → fxzs.rnbeidou}/StringUtils.java +1 -1
- package/android/src/main/java/com/{cmcc_rn_module → fxzs.rnbeidou}/view/CompassManager.java +1 -1
- package/android/src/main/java/com/{cmcc_rn_module → fxzs.rnbeidou}/view/CompassView.java +2 -2
- package/index.ts +233 -79
- package/ios/BeiDouBluetoothModule.m +26 -1
- package/ios/BeidouBluetooth.framework/BeidouBluetooth +0 -0
- package/ios/BeidouBluetooth.framework/FMDB.bundle/Info.plist +0 -0
- package/ios/BeidouBluetooth.framework/FMDB.bundle/PrivacyInfo.xcprivacy +14 -0
- package/ios/BeidouBluetooth.framework/Headers/BDTLocationService.h +24 -0
- package/ios/BeidouBluetooth.framework/Headers/BeidouBluetooth.h +3 -1
- package/ios/BeidouBluetooth.framework/Info.plist +0 -0
- package/ios/BeidouBluetooth.framework/_CodeSignature/CodeDirectory +0 -0
- package/ios/BeidouBluetooth.framework/_CodeSignature/CodeRequirements-1 +0 -0
- package/ios/BeidouBluetooth.framework/_CodeSignature/CodeResources +49 -4
- package/ios/BeidouBluetooth.framework/_CodeSignature/CodeSignature +0 -0
- package/package.json +4 -2
- package/react-native-beidou.podspec +26 -0
- package/react-native.config.js +2 -2
package/index.ts
CHANGED
|
@@ -31,9 +31,17 @@ export type BluetoothStatus = 'NotSupported' | 'NO' | 'OK';
|
|
|
31
31
|
|
|
32
32
|
// ================== 北斗AIDL服务相关类型定义 ==================
|
|
33
33
|
export interface BDStatusResponse {
|
|
34
|
+
slotId?: number;
|
|
34
35
|
code: number;
|
|
35
36
|
statusMsg: string;
|
|
36
37
|
msgQuotaRemain: number;
|
|
38
|
+
userOpenStatus: number;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface BDAuthResult {
|
|
42
|
+
slotId: number;
|
|
43
|
+
code: number;
|
|
44
|
+
statusMsg: string | null;
|
|
37
45
|
}
|
|
38
46
|
|
|
39
47
|
export interface BDMsgEncryptResponse {
|
|
@@ -41,6 +49,7 @@ export interface BDMsgEncryptResponse {
|
|
|
41
49
|
statusMsg: string;
|
|
42
50
|
data: number[]; // byte array as number array
|
|
43
51
|
sendMobile: string;
|
|
52
|
+
len: number;
|
|
44
53
|
}
|
|
45
54
|
|
|
46
55
|
export interface BDMsgDecryptResponse {
|
|
@@ -51,9 +60,11 @@ export interface BDMsgDecryptResponse {
|
|
|
51
60
|
}
|
|
52
61
|
|
|
53
62
|
export interface BDMsgEphemerisFileDLResponse {
|
|
63
|
+
slotId: number;
|
|
54
64
|
code: number;
|
|
55
65
|
statusMsg: string;
|
|
56
66
|
ephemerisZipFile: number[]; // byte array as number array
|
|
67
|
+
ephemerisZipFileName: string | null;
|
|
57
68
|
version: string;
|
|
58
69
|
}
|
|
59
70
|
|
|
@@ -76,54 +87,17 @@ export interface MessageInfo {
|
|
|
76
87
|
timestamp: number;
|
|
77
88
|
}
|
|
78
89
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
initializeBluetooth(callback: (status: BluetoothStatus) => void): void;
|
|
91
|
-
generateRandom16BytesString(): string;
|
|
92
|
-
writeData(randomString: string, deviceNo: string, command: number, attrType: number, callback: (result: number) => void): void;
|
|
93
|
-
|
|
94
|
-
// 新增的iOS兼容方法
|
|
95
|
-
writeInfo(base64Payload: string | null, deviceNO: string, command: number, opCode: number, attrType: number, encrypted: boolean): Promise<WriteInfoResponse>;
|
|
96
|
-
insertMsg(phone: string, content: string, timestamp: number, isSend: boolean): void;
|
|
97
|
-
getMessagesForPhone(phone: string, page: number, pageSize: number, callback: (result: string) => void): void;
|
|
98
|
-
setBLEKey(bleKey: string): Promise<number>;
|
|
99
|
-
|
|
100
|
-
// 原有方法保持兼容
|
|
101
|
-
writeValueInfo(randomString: string, deviceNo: string, command: number, attrType: number, value: number, callback: (result: any) => void): void;
|
|
102
|
-
disConnectWithDeviceUUID(deviceNo: string): Promise<number>;
|
|
103
|
-
fetchCurrentWifiName(callback: (wifiName: string) => void): void;
|
|
104
|
-
|
|
105
|
-
// 北斗AIDL服务绑定方法
|
|
106
|
-
bindBeidouServiceMethod(packageName: string, actionName: string): Promise<boolean>;
|
|
107
|
-
unbindBeidouServiceMethod(): Promise<boolean>;
|
|
108
|
-
|
|
109
|
-
// 北斗AIDL服务方法 (需要在Java端实现)
|
|
110
|
-
BDAuthenticate(): Promise<boolean>;
|
|
111
|
-
getBDMsgStatus(): Promise<BDStatusResponse>;
|
|
112
|
-
checkValidatedKey(): Promise<number>;
|
|
113
|
-
commonBDMsgEncrypt(receiveList: string[], inputMsg: string): Promise<BDMsgEncryptResponse>;
|
|
114
|
-
positionBDMsgEncrypt(receiveList: string[], inputMsg: string, longitude: number, latitude: number): Promise<BDMsgEncryptResponse>;
|
|
115
|
-
BDMailboxQueryEncrypt(): Promise<BDMsgEncryptResponse>;
|
|
116
|
-
BDMsgDecrypt(msg: number[], len: number): Promise<BDMsgDecryptResponse>;
|
|
117
|
-
DLEphemerisFile(type: string, version: string): Promise<BDMsgEphemerisFileDLResponse>;
|
|
118
|
-
|
|
119
|
-
// 位置
|
|
120
|
-
getGpsLocation(): Promise<{
|
|
121
|
-
latitude: number;
|
|
122
|
-
longitude: number;
|
|
123
|
-
provider: string;
|
|
124
|
-
accuracy: number;
|
|
125
|
-
timestamp: number;
|
|
126
|
-
} | null>;
|
|
90
|
+
export interface SimCardInfo {
|
|
91
|
+
subscriptionId: number;
|
|
92
|
+
simSlotIndex: number;
|
|
93
|
+
carrierName: string | null;
|
|
94
|
+
displayName: string | null;
|
|
95
|
+
countryIso: string | null;
|
|
96
|
+
mcc: number;
|
|
97
|
+
mnc: number;
|
|
98
|
+
isEmbedded: boolean;
|
|
99
|
+
isOpportunistic: boolean;
|
|
100
|
+
number: string | null;
|
|
127
101
|
}
|
|
128
102
|
|
|
129
103
|
// ================== 导出的便利方法 ==================
|
|
@@ -189,6 +163,14 @@ export const getDiscoveredDevicesArray = async (): Promise<BlueDeviceInfo[]> =>
|
|
|
189
163
|
}
|
|
190
164
|
};
|
|
191
165
|
|
|
166
|
+
/**
|
|
167
|
+
* 获取当前设备的SIM卡列表
|
|
168
|
+
*/
|
|
169
|
+
export const getSimCardList = async (): Promise<SimCardInfo[]> => {
|
|
170
|
+
const list = await BeiDouBluetoothModule.getSimCardList();
|
|
171
|
+
return list ?? [];
|
|
172
|
+
};
|
|
173
|
+
|
|
192
174
|
/**
|
|
193
175
|
* 绑定北斗AIDL服务
|
|
194
176
|
* @param packageName 北斗服务的包名
|
|
@@ -208,72 +190,159 @@ export const unbindBeiDouService = async (): Promise<boolean> => {
|
|
|
208
190
|
/**
|
|
209
191
|
* 北斗服务鉴权
|
|
210
192
|
*/
|
|
211
|
-
export const authenticateBeiDou = async (): Promise<
|
|
212
|
-
return await BeiDouBluetoothModule.BDAuthenticate();
|
|
193
|
+
export const authenticateBeiDou = async (slotId: number = 0): Promise<BDAuthResult> => {
|
|
194
|
+
return await BeiDouBluetoothModule.BDAuthenticate(slotId);
|
|
213
195
|
};
|
|
214
196
|
|
|
215
197
|
/**
|
|
216
198
|
* 查询北斗用户开通状态及额度
|
|
217
199
|
*/
|
|
218
|
-
export const getBeiDouStatus = async (): Promise<BDStatusResponse> => {
|
|
219
|
-
return await BeiDouBluetoothModule.getBDMsgStatus();
|
|
200
|
+
export const getBeiDouStatus = async (slotId: number = 0): Promise<BDStatusResponse> => {
|
|
201
|
+
return await BeiDouBluetoothModule.getBDMsgStatus(slotId);
|
|
220
202
|
};
|
|
221
203
|
|
|
222
204
|
/**
|
|
223
205
|
* 检查北斗密钥状态
|
|
224
206
|
*/
|
|
225
|
-
export const checkBeiDouKey = async (): Promise<number> => {
|
|
226
|
-
return await BeiDouBluetoothModule.checkValidatedKey();
|
|
207
|
+
export const checkBeiDouKey = async (slotId: number = 0): Promise<number> => {
|
|
208
|
+
return await BeiDouBluetoothModule.checkValidatedKey(slotId);
|
|
227
209
|
};
|
|
228
210
|
|
|
229
211
|
/**
|
|
230
212
|
* 通用北斗报文编码加密
|
|
231
213
|
*/
|
|
232
214
|
export const encryptCommonBeiDouMessage = async (
|
|
215
|
+
slotId: number = 0,
|
|
216
|
+
speedType: string = '0',
|
|
233
217
|
receiveList: string[],
|
|
234
218
|
inputMsg: string
|
|
235
|
-
): Promise<BDMsgEncryptResponse> =>
|
|
236
|
-
return await BeiDouBluetoothModule.commonBDMsgEncrypt(receiveList, inputMsg);
|
|
237
|
-
};
|
|
219
|
+
): Promise<BDMsgEncryptResponse[]> => BeiDouBluetoothModule.commonBDMsgEncrypt(slotId, speedType, receiveList, inputMsg);
|
|
238
220
|
|
|
239
221
|
/**
|
|
240
222
|
* 位置信息北斗报文编码加密
|
|
241
223
|
*/
|
|
242
224
|
export const encryptPositionBeiDouMessage = async (
|
|
225
|
+
slotId: number = 0,
|
|
226
|
+
speedType: string = '0',
|
|
243
227
|
receiveList: string[],
|
|
244
228
|
inputMsg: string,
|
|
245
229
|
longitude: number,
|
|
246
230
|
latitude: number
|
|
247
|
-
): Promise<BDMsgEncryptResponse> =>
|
|
248
|
-
|
|
249
|
-
|
|
231
|
+
): Promise<BDMsgEncryptResponse[]> =>
|
|
232
|
+
BeiDouBluetoothModule.positionBDMsgEncrypt(slotId, speedType, receiveList, inputMsg, longitude, latitude);
|
|
233
|
+
|
|
234
|
+
export const encryptCommonEmergencyBeiDouMessage = async (
|
|
235
|
+
slotId: number = 0,
|
|
236
|
+
speedType: string = '0',
|
|
237
|
+
receiveList: string[],
|
|
238
|
+
inputMsg: string
|
|
239
|
+
): Promise<BDMsgEncryptResponse[]> =>
|
|
240
|
+
BeiDouBluetoothModule.commonEmergencyBDMsgEncrypt(slotId, speedType, receiveList, inputMsg);
|
|
241
|
+
|
|
242
|
+
export const encryptPositionEmergencyBeiDouMessage = async (
|
|
243
|
+
slotId: number = 0,
|
|
244
|
+
speedType: string = '0',
|
|
245
|
+
receiveList: string[],
|
|
246
|
+
inputMsg: string,
|
|
247
|
+
longitude: number,
|
|
248
|
+
latitude: number
|
|
249
|
+
): Promise<BDMsgEncryptResponse[]> =>
|
|
250
|
+
BeiDouBluetoothModule.positionEmergencyBDMsgEncrypt(slotId, speedType, receiveList, inputMsg, longitude, latitude);
|
|
251
|
+
|
|
252
|
+
export const encryptCommonRichMediaBeiDouMessage = async (
|
|
253
|
+
slotId: number = 0,
|
|
254
|
+
speedType: string = '0',
|
|
255
|
+
receiveList: string[],
|
|
256
|
+
msgType: string,
|
|
257
|
+
inputRichMediaData: number[]
|
|
258
|
+
): Promise<BDMsgEncryptResponse[]> =>
|
|
259
|
+
BeiDouBluetoothModule.commonRichMediaBDMsgEncrypt(slotId, speedType, receiveList, msgType, inputRichMediaData);
|
|
260
|
+
|
|
261
|
+
export const encryptPositionRichMediaBeiDouMessage = async (
|
|
262
|
+
slotId: number = 0,
|
|
263
|
+
speedType: string = '0',
|
|
264
|
+
receiveList: string[],
|
|
265
|
+
msgType: string,
|
|
266
|
+
inputRichMediaData: number[],
|
|
267
|
+
longitude: number,
|
|
268
|
+
latitude: number
|
|
269
|
+
): Promise<BDMsgEncryptResponse[]> =>
|
|
270
|
+
BeiDouBluetoothModule.positionRichMediaBDMsgEncrypt(
|
|
271
|
+
slotId,
|
|
272
|
+
speedType,
|
|
273
|
+
receiveList,
|
|
274
|
+
msgType,
|
|
275
|
+
inputRichMediaData,
|
|
276
|
+
longitude,
|
|
277
|
+
latitude
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
export const encryptCommonRichMediaAndTextBeiDouMessage = async (
|
|
281
|
+
slotId: number = 0,
|
|
282
|
+
speedType: string = '0',
|
|
283
|
+
receiveList: string[],
|
|
284
|
+
text: string,
|
|
285
|
+
msgType: string,
|
|
286
|
+
inputRichMediaData: number[]
|
|
287
|
+
): Promise<BDMsgEncryptResponse[]> =>
|
|
288
|
+
BeiDouBluetoothModule.commonRichMediaAndTextBDMsgEncrypt(
|
|
289
|
+
slotId,
|
|
290
|
+
speedType,
|
|
291
|
+
receiveList,
|
|
292
|
+
text,
|
|
293
|
+
msgType,
|
|
294
|
+
inputRichMediaData
|
|
295
|
+
);
|
|
296
|
+
|
|
297
|
+
export const encryptPositionRichMediaAndTextBeiDouMessage = async (
|
|
298
|
+
slotId: number = 0,
|
|
299
|
+
speedType: string = '0',
|
|
300
|
+
receiveList: string[],
|
|
301
|
+
text: string,
|
|
302
|
+
msgType: string,
|
|
303
|
+
inputRichMediaData: number[],
|
|
304
|
+
longitude: number,
|
|
305
|
+
latitude: number
|
|
306
|
+
): Promise<BDMsgEncryptResponse[]> =>
|
|
307
|
+
BeiDouBluetoothModule.positionRichMediaAndTextBDMsgEncrypt(
|
|
308
|
+
slotId,
|
|
309
|
+
speedType,
|
|
310
|
+
receiveList,
|
|
311
|
+
text,
|
|
312
|
+
msgType,
|
|
313
|
+
inputRichMediaData,
|
|
314
|
+
longitude,
|
|
315
|
+
latitude
|
|
316
|
+
);
|
|
250
317
|
|
|
251
318
|
/**
|
|
252
319
|
* 北斗信箱查询请求加密
|
|
253
320
|
*/
|
|
254
|
-
export const encryptBeiDouMailboxQuery = async (): Promise<BDMsgEncryptResponse> =>
|
|
255
|
-
|
|
256
|
-
|
|
321
|
+
export const encryptBeiDouMailboxQuery = async (slotId: number = 0): Promise<BDMsgEncryptResponse> =>
|
|
322
|
+
BeiDouBluetoothModule.BDMailboxQueryEncrypt(slotId);
|
|
323
|
+
|
|
324
|
+
export const encryptEmergencyBeiDouMailboxQuery = async (
|
|
325
|
+
slotId: number = 0,
|
|
326
|
+
replyMobile: string
|
|
327
|
+
): Promise<BDMsgEncryptResponse> => BeiDouBluetoothModule.EmergencyBDMailboxQueryEncrypt(slotId, replyMobile);
|
|
257
328
|
|
|
258
329
|
/**
|
|
259
330
|
* 北斗报文解密
|
|
260
331
|
*/
|
|
261
332
|
export const decryptBeiDouMessage = async (
|
|
333
|
+
slotId: number = 0,
|
|
262
334
|
msg: number[],
|
|
263
335
|
len: number
|
|
264
|
-
): Promise<BDMsgDecryptResponse> =>
|
|
265
|
-
return await BeiDouBluetoothModule.BDMsgDecrypt(msg, len);
|
|
266
|
-
};
|
|
336
|
+
): Promise<BDMsgDecryptResponse> => BeiDouBluetoothModule.BDMsgDecrypt(slotId, msg, len);
|
|
267
337
|
|
|
268
338
|
/**
|
|
269
339
|
* 下载北斗星历文件
|
|
270
340
|
*/
|
|
271
341
|
export const downloadEphemerisFile = async (
|
|
342
|
+
slotId: number = 0,
|
|
272
343
|
type: string,
|
|
273
344
|
version: string
|
|
274
|
-
): Promise<BDMsgEphemerisFileDLResponse> =>
|
|
275
|
-
return await BeiDouBluetoothModule.DLEphemerisFile(type, version);
|
|
276
|
-
};
|
|
345
|
+
): Promise<BDMsgEphemerisFileDLResponse> => BeiDouBluetoothModule.DLEphemerisFile(slotId, type, version);
|
|
277
346
|
|
|
278
347
|
// ================== 新增iOS兼容方法的便利函数 ==================
|
|
279
348
|
|
|
@@ -350,8 +419,6 @@ export const setBeiDouBLEKey = async (bleKey: string): Promise<boolean> => {
|
|
|
350
419
|
}
|
|
351
420
|
};
|
|
352
421
|
|
|
353
|
-
// export default BeiDouBluetoothModule as BeiDouBluetoothModuleType;
|
|
354
|
-
|
|
355
422
|
export const BeiDouModule = {
|
|
356
423
|
// 蓝牙相关
|
|
357
424
|
bluetooth: {
|
|
@@ -381,6 +448,7 @@ export const BeiDouModule = {
|
|
|
381
448
|
checkBluetoothPermission,
|
|
382
449
|
initializeBluetooth,
|
|
383
450
|
fetchCurrentWifiName,
|
|
451
|
+
getSimCardList,
|
|
384
452
|
getGpsLocation: (): Promise<{
|
|
385
453
|
latitude: number;
|
|
386
454
|
longitude: number;
|
|
@@ -397,14 +465,78 @@ export const BeiDouModule = {
|
|
|
397
465
|
unbindService: unbindBeiDouService,
|
|
398
466
|
|
|
399
467
|
// 核心功能
|
|
400
|
-
authenticate: authenticateBeiDou,
|
|
401
|
-
getStatus: getBeiDouStatus,
|
|
402
|
-
checkKey: checkBeiDouKey,
|
|
403
|
-
encryptCommonMessage:
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
468
|
+
authenticate: (slotId: number = 0) => authenticateBeiDou(slotId),
|
|
469
|
+
getStatus: (slotId: number = 0) => getBeiDouStatus(slotId),
|
|
470
|
+
checkKey: (slotId: number = 0) => checkBeiDouKey(slotId),
|
|
471
|
+
encryptCommonMessage: (
|
|
472
|
+
slotId: number,
|
|
473
|
+
speedType: string,
|
|
474
|
+
receiveList: string[],
|
|
475
|
+
inputMsg: string
|
|
476
|
+
) => encryptCommonBeiDouMessage(slotId, speedType, receiveList, inputMsg),
|
|
477
|
+
encryptPositionMessage: (
|
|
478
|
+
slotId: number,
|
|
479
|
+
speedType: string,
|
|
480
|
+
receiveList: string[],
|
|
481
|
+
inputMsg: string,
|
|
482
|
+
longitude: number,
|
|
483
|
+
latitude: number
|
|
484
|
+
) => encryptPositionBeiDouMessage(slotId, speedType, receiveList, inputMsg, longitude, latitude),
|
|
485
|
+
encryptCommonEmergencyMessage: (
|
|
486
|
+
slotId: number,
|
|
487
|
+
speedType: string,
|
|
488
|
+
receiveList: string[],
|
|
489
|
+
inputMsg: string
|
|
490
|
+
) => encryptCommonEmergencyBeiDouMessage(slotId, speedType, receiveList, inputMsg),
|
|
491
|
+
encryptPositionEmergencyMessage: (
|
|
492
|
+
slotId: number,
|
|
493
|
+
speedType: string,
|
|
494
|
+
receiveList: string[],
|
|
495
|
+
inputMsg: string,
|
|
496
|
+
longitude: number,
|
|
497
|
+
latitude: number
|
|
498
|
+
) => encryptPositionEmergencyBeiDouMessage(slotId, speedType, receiveList, inputMsg, longitude, latitude),
|
|
499
|
+
encryptCommonRichMediaMessage: (
|
|
500
|
+
slotId: number,
|
|
501
|
+
speedType: string,
|
|
502
|
+
receiveList: string[],
|
|
503
|
+
msgType: string,
|
|
504
|
+
data: number[]
|
|
505
|
+
) => encryptCommonRichMediaBeiDouMessage(slotId, speedType, receiveList, msgType, data),
|
|
506
|
+
encryptPositionRichMediaMessage: (
|
|
507
|
+
slotId: number,
|
|
508
|
+
speedType: string,
|
|
509
|
+
receiveList: string[],
|
|
510
|
+
msgType: string,
|
|
511
|
+
data: number[],
|
|
512
|
+
longitude: number,
|
|
513
|
+
latitude: number
|
|
514
|
+
) => encryptPositionRichMediaBeiDouMessage(slotId, speedType, receiveList, msgType, data, longitude, latitude),
|
|
515
|
+
encryptCommonRichMediaAndTextMessage: (
|
|
516
|
+
slotId: number,
|
|
517
|
+
speedType: string,
|
|
518
|
+
receiveList: string[],
|
|
519
|
+
text: string,
|
|
520
|
+
msgType: string,
|
|
521
|
+
data: number[]
|
|
522
|
+
) => encryptCommonRichMediaAndTextBeiDouMessage(slotId, speedType, receiveList, text, msgType, data),
|
|
523
|
+
encryptPositionRichMediaAndTextMessage: (
|
|
524
|
+
slotId: number,
|
|
525
|
+
speedType: string,
|
|
526
|
+
receiveList: string[],
|
|
527
|
+
text: string,
|
|
528
|
+
msgType: string,
|
|
529
|
+
data: number[],
|
|
530
|
+
longitude: number,
|
|
531
|
+
latitude: number
|
|
532
|
+
) =>
|
|
533
|
+
encryptPositionRichMediaAndTextBeiDouMessage(slotId, speedType, receiveList, text, msgType, data, longitude, latitude),
|
|
534
|
+
encryptMailboxQuery: (slotId: number = 0) => encryptBeiDouMailboxQuery(slotId),
|
|
535
|
+
encryptEmergencyMailboxQuery: (replyMobile: string, slotId: number = 0) =>
|
|
536
|
+
encryptEmergencyBeiDouMailboxQuery(slotId, replyMobile),
|
|
537
|
+
decryptMessage: (msg: number[], len: number, slotId: number = 0) => decryptBeiDouMessage(slotId, msg, len),
|
|
538
|
+
downloadEphemeris: (type: string, version: string, slotId: number = 0) =>
|
|
539
|
+
downloadEphemerisFile(slotId, type, version),
|
|
408
540
|
},
|
|
409
541
|
|
|
410
542
|
// 所有原生方法的原名导出
|
|
@@ -430,6 +562,7 @@ export const BeiDouModule = {
|
|
|
430
562
|
insertMsg: insertBeiDouMessage,
|
|
431
563
|
getMessagesForPhone: getMessagesForPhoneNumber,
|
|
432
564
|
setBLEKey: BeiDouBluetoothModule.setBLEKey,
|
|
565
|
+
getSimCardList: BeiDouBluetoothModule.getSimCardList,
|
|
433
566
|
|
|
434
567
|
// 北斗AIDL服务绑定方法
|
|
435
568
|
bindBeidouServiceMethod: BeiDouBluetoothModule.bindBeidouServiceMethod,
|
|
@@ -441,7 +574,14 @@ export const BeiDouModule = {
|
|
|
441
574
|
checkValidatedKey: BeiDouBluetoothModule.checkValidatedKey,
|
|
442
575
|
commonBDMsgEncrypt: BeiDouBluetoothModule.commonBDMsgEncrypt,
|
|
443
576
|
positionBDMsgEncrypt: BeiDouBluetoothModule.positionBDMsgEncrypt,
|
|
577
|
+
commonEmergencyBDMsgEncrypt: BeiDouBluetoothModule.commonEmergencyBDMsgEncrypt,
|
|
578
|
+
positionEmergencyBDMsgEncrypt: BeiDouBluetoothModule.positionEmergencyBDMsgEncrypt,
|
|
579
|
+
commonRichMediaBDMsgEncrypt: BeiDouBluetoothModule.commonRichMediaBDMsgEncrypt,
|
|
580
|
+
positionRichMediaBDMsgEncrypt: BeiDouBluetoothModule.positionRichMediaBDMsgEncrypt,
|
|
581
|
+
commonRichMediaAndTextBDMsgEncrypt: BeiDouBluetoothModule.commonRichMediaAndTextBDMsgEncrypt,
|
|
582
|
+
positionRichMediaAndTextBDMsgEncrypt: BeiDouBluetoothModule.positionRichMediaAndTextBDMsgEncrypt,
|
|
444
583
|
BDMailboxQueryEncrypt: BeiDouBluetoothModule.BDMailboxQueryEncrypt,
|
|
584
|
+
EmergencyBDMailboxQueryEncrypt: BeiDouBluetoothModule.EmergencyBDMailboxQueryEncrypt,
|
|
445
585
|
BDMsgDecrypt: BeiDouBluetoothModule.BDMsgDecrypt,
|
|
446
586
|
DLEphemerisFile: BeiDouBluetoothModule.DLEphemerisFile,
|
|
447
587
|
getGpsLocation: (): Promise<{
|
|
@@ -457,4 +597,18 @@ export const BeiDouModule = {
|
|
|
457
597
|
export default BeiDouModule;
|
|
458
598
|
export { default as Compass } from './Compass';
|
|
459
599
|
|
|
600
|
+
// 导出日志管理功能
|
|
601
|
+
export {
|
|
602
|
+
BeiDouLogManager,
|
|
603
|
+
BeiDouLogger,
|
|
604
|
+
LogLevel,
|
|
605
|
+
logVerbose,
|
|
606
|
+
logDebug,
|
|
607
|
+
logInfo,
|
|
608
|
+
logWarn,
|
|
609
|
+
logError,
|
|
610
|
+
setupGlobalLogInterception
|
|
611
|
+
} from './LogManager';
|
|
612
|
+
export type { LogConfig } from './LogManager';
|
|
613
|
+
|
|
460
614
|
|
|
@@ -93,7 +93,7 @@ RCT_EXPORT_METHOD(getDiscoveredDevices:(RCTPromiseResolveBlock)resolve rejecter:
|
|
|
93
93
|
|
|
94
94
|
/// 连接蓝牙设备
|
|
95
95
|
/// - Parameter resolve: 连接成功回调
|
|
96
|
-
/// - Parameter reject: 连接失败回调 0
|
|
96
|
+
/// - Parameter reject: 连接失败回调 0:连 接失败 3:用户拒绝授权 4:系统蓝牙开关关闭
|
|
97
97
|
RCT_EXPORT_METHOD(connectToDeviceFromCloudDeviceNO:(NSString *)deviceNO
|
|
98
98
|
timeout:(nonnull NSNumber *)second
|
|
99
99
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
@@ -420,5 +420,30 @@ RCT_EXPORT_METHOD(initializeBluetooth:(RCTResponseSenderBlock)callBack){
|
|
|
420
420
|
}];
|
|
421
421
|
}
|
|
422
422
|
|
|
423
|
+
RCT_REMAP_METHOD(getGpsLocation,
|
|
424
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
425
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
426
|
+
{
|
|
427
|
+
// 确保在主线程执行
|
|
428
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
429
|
+
[[BDTLocationService shared] getCurrentLocationWithCompletion:^(double latitude, double longitude, NSError *error) {
|
|
430
|
+
if (error) {
|
|
431
|
+
// 获取位置失败,返回 null
|
|
432
|
+
resolve([NSNull null]);
|
|
433
|
+
} else {
|
|
434
|
+
// 获取位置成功,构建返回对象
|
|
435
|
+
NSDictionary *locationData = @{
|
|
436
|
+
@"latitude": @(latitude),
|
|
437
|
+
@"longitude": @(longitude),
|
|
438
|
+
@"provider": @"gps", // iOS 中定位来源
|
|
439
|
+
@"accuracy": @(0.0), // 如果需要精度信息,需要在 LocationService 中获取
|
|
440
|
+
@"timestamp": @([[NSDate date] timeIntervalSince1970] * 1000) // 毫秒时间戳
|
|
441
|
+
};
|
|
442
|
+
resolve(locationData);
|
|
443
|
+
}
|
|
444
|
+
}];
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
|
|
423
448
|
|
|
424
449
|
@end
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>NSPrivacyTracking</key>
|
|
6
|
+
<false/>
|
|
7
|
+
<key>NSPrivacyTrackingDomains</key>
|
|
8
|
+
<array/>
|
|
9
|
+
<key>NSPrivacyCollectedDataTypes</key>
|
|
10
|
+
<array/>
|
|
11
|
+
<key>NSPrivacyAccessedAPITypes</key>
|
|
12
|
+
<array/>
|
|
13
|
+
</dict>
|
|
14
|
+
</plist>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//
|
|
2
|
+
// BDTLocationService.h
|
|
3
|
+
// BeidouBluetooth
|
|
4
|
+
//
|
|
5
|
+
// Created by 董建伟 on 2025/11/5.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
#import <CoreLocation/CoreLocation.h>
|
|
10
|
+
|
|
11
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
12
|
+
|
|
13
|
+
typedef void (^LocationCompletionBlock)(double latitude, double longitude, NSError * _Nullable error);
|
|
14
|
+
|
|
15
|
+
@interface BDTLocationService : NSObject
|
|
16
|
+
|
|
17
|
+
+ (instancetype)shared;
|
|
18
|
+
|
|
19
|
+
// 获取一次经纬度
|
|
20
|
+
- (void)getCurrentLocationWithCompletion:(LocationCompletionBlock)completion;
|
|
21
|
+
|
|
22
|
+
@end
|
|
23
|
+
|
|
24
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// BeidouBluetooth.h
|
|
3
3
|
// BeidouBluetooth
|
|
4
4
|
//
|
|
5
|
-
// Created by 董建伟 on 2025/
|
|
5
|
+
// Created by 董建伟 on 2025/11/4.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
8
|
#import <Foundation/Foundation.h>
|
|
@@ -15,7 +15,9 @@ FOUNDATION_EXPORT const unsigned char BeidouBluetoothVersionString[];
|
|
|
15
15
|
|
|
16
16
|
// In this header, you should import all the public headers of your framework using statements like #import <BeidouBluetooth/PublicHeader.h>
|
|
17
17
|
|
|
18
|
+
|
|
18
19
|
#import <BeidouBluetooth/BDTBluetoothManager.h>
|
|
19
20
|
#import <BeidouBluetooth/BDTDataPacketBuilder.h>
|
|
20
21
|
#import <BeidouBluetooth/BDTChatDBManager.h>
|
|
22
|
+
#import <BeidouBluetooth/BDTLocationService.h>
|
|
21
23
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -4,6 +4,14 @@
|
|
|
4
4
|
<dict>
|
|
5
5
|
<key>files</key>
|
|
6
6
|
<dict>
|
|
7
|
+
<key>FMDB.bundle/Info.plist</key>
|
|
8
|
+
<data>
|
|
9
|
+
fQm/OgDmwDzxKX8rvFINy7CJkJ4=
|
|
10
|
+
</data>
|
|
11
|
+
<key>FMDB.bundle/PrivacyInfo.xcprivacy</key>
|
|
12
|
+
<data>
|
|
13
|
+
ucg9pita0v8d353x3NuGfxweQYU=
|
|
14
|
+
</data>
|
|
7
15
|
<key>Headers/BDTBluetoothManager.h</key>
|
|
8
16
|
<data>
|
|
9
17
|
Mke3zeUQy40YfFrfW2gJ82VfWV4=
|
|
@@ -16,13 +24,17 @@
|
|
|
16
24
|
<data>
|
|
17
25
|
M2mub8VwH6cd3mT+Cmj6jU/wxfs=
|
|
18
26
|
</data>
|
|
27
|
+
<key>Headers/BDTLocationService.h</key>
|
|
28
|
+
<data>
|
|
29
|
+
RzN/dKza3l/TAtgAS9ZuWVtxszs=
|
|
30
|
+
</data>
|
|
19
31
|
<key>Headers/BeidouBluetooth.h</key>
|
|
20
32
|
<data>
|
|
21
|
-
|
|
33
|
+
pjIaMEI7NmkpW/V7pIaOIcpW/8E=
|
|
22
34
|
</data>
|
|
23
35
|
<key>Info.plist</key>
|
|
24
36
|
<data>
|
|
25
|
-
|
|
37
|
+
XA4b0GI82DRY0I4G277GU6YcIDc=
|
|
26
38
|
</data>
|
|
27
39
|
<key>Modules/module.modulemap</key>
|
|
28
40
|
<data>
|
|
@@ -31,6 +43,28 @@
|
|
|
31
43
|
</dict>
|
|
32
44
|
<key>files2</key>
|
|
33
45
|
<dict>
|
|
46
|
+
<key>FMDB.bundle/Info.plist</key>
|
|
47
|
+
<dict>
|
|
48
|
+
<key>hash</key>
|
|
49
|
+
<data>
|
|
50
|
+
fQm/OgDmwDzxKX8rvFINy7CJkJ4=
|
|
51
|
+
</data>
|
|
52
|
+
<key>hash2</key>
|
|
53
|
+
<data>
|
|
54
|
+
BeV82aZzyEQ+5IJExHzOKtyngMdCpF/kTedm1V+R9cA=
|
|
55
|
+
</data>
|
|
56
|
+
</dict>
|
|
57
|
+
<key>FMDB.bundle/PrivacyInfo.xcprivacy</key>
|
|
58
|
+
<dict>
|
|
59
|
+
<key>hash</key>
|
|
60
|
+
<data>
|
|
61
|
+
ucg9pita0v8d353x3NuGfxweQYU=
|
|
62
|
+
</data>
|
|
63
|
+
<key>hash2</key>
|
|
64
|
+
<data>
|
|
65
|
+
Uh6274Qwdz5cAQ4YOP6d2PpdYre3bRzqjX2NqtyxROI=
|
|
66
|
+
</data>
|
|
67
|
+
</dict>
|
|
34
68
|
<key>Headers/BDTBluetoothManager.h</key>
|
|
35
69
|
<dict>
|
|
36
70
|
<key>hash</key>
|
|
@@ -64,15 +98,26 @@
|
|
|
64
98
|
HDzbJwP03m263UzurGCq5CnM2RmRkmJAvzRPsKAmZ9U=
|
|
65
99
|
</data>
|
|
66
100
|
</dict>
|
|
101
|
+
<key>Headers/BDTLocationService.h</key>
|
|
102
|
+
<dict>
|
|
103
|
+
<key>hash</key>
|
|
104
|
+
<data>
|
|
105
|
+
RzN/dKza3l/TAtgAS9ZuWVtxszs=
|
|
106
|
+
</data>
|
|
107
|
+
<key>hash2</key>
|
|
108
|
+
<data>
|
|
109
|
+
H3MgmiqqbNExoGreVNN3gPO81RCdL/r1NmAFF12PG4c=
|
|
110
|
+
</data>
|
|
111
|
+
</dict>
|
|
67
112
|
<key>Headers/BeidouBluetooth.h</key>
|
|
68
113
|
<dict>
|
|
69
114
|
<key>hash</key>
|
|
70
115
|
<data>
|
|
71
|
-
|
|
116
|
+
pjIaMEI7NmkpW/V7pIaOIcpW/8E=
|
|
72
117
|
</data>
|
|
73
118
|
<key>hash2</key>
|
|
74
119
|
<data>
|
|
75
|
-
|
|
120
|
+
7B/Mf1b1ApHkKh4ojqs364EJalW6lo6L8V3Bmv1gnvs=
|
|
76
121
|
</data>
|
|
77
122
|
</dict>
|
|
78
123
|
<key>Modules/module.modulemap</key>
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-beidou",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "A React Native module for BeiDou Bluetooth communication.",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"types": "index.ts",
|
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
"Compass.tsx",
|
|
15
15
|
"react-native.config.js",
|
|
16
16
|
"BeiDouAIDLTestPage.tsx",
|
|
17
|
-
"TestPage.ts"
|
|
17
|
+
"TestPage.ts",
|
|
18
|
+
"react-native-beidou.podspec",
|
|
19
|
+
"LogManager.ts"
|
|
18
20
|
],
|
|
19
21
|
"keywords": [
|
|
20
22
|
"react-native",
|