react-native-beidou 1.0.8 → 1.1.2
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 +4 -0
- package/README.md +108 -63
- 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 +9 -9
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/fxzs.rnbeidou/BeiDouBluetoothModule.java +195 -217
- package/android/src/main/java/com/fxzs.rnbeidou/BeidouAidlHelper.java +643 -0
- package/index.ts +223 -89
- 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 +2 -1
- package/react-native-beidou.podspec +26 -0
package/BeiDouAIDLTestPage.tsx
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
import { BeiDouModule } from './index';
|
|
14
14
|
import type {
|
|
15
15
|
BDStatusResponse,
|
|
16
|
+
BDAuthResult,
|
|
16
17
|
BDMsgEncryptResponse,
|
|
17
18
|
BDMsgDecryptResponse,
|
|
18
19
|
BDMsgEphemerisFileDLResponse,
|
|
@@ -39,11 +40,34 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
39
40
|
const [ephemerisType, setEphemerisType] = useState('GPS');
|
|
40
41
|
const [ephemerisVersion, setEphemerisVersion] = useState('1.0.0');
|
|
41
42
|
const [decryptMsg, setDecryptMsg] = useState('1,2,3,4,5');
|
|
43
|
+
const [slotId, setSlotId] = useState('0');
|
|
44
|
+
const [speedType, setSpeedType] = useState('0');
|
|
45
|
+
const [msgType, setMsgType] = useState('00');
|
|
46
|
+
const [richMediaData, setRichMediaData] = useState('1,2,3,4');
|
|
47
|
+
const [richMediaText, setRichMediaText] = useState('富媒体文本示例');
|
|
48
|
+
const [replyMobile, setReplyMobile] = useState('13800138000');
|
|
42
49
|
|
|
43
50
|
// 服务配置参数
|
|
44
51
|
const [packageName, setPackageName] = useState('com.test.aidlsetvicetest');
|
|
45
52
|
const [actionName, setActionName] = useState('com.samsung.beidoupackage.BeidouMsgAidlService');
|
|
46
53
|
|
|
54
|
+
const parseSlotId = () => {
|
|
55
|
+
const parsed = parseInt(slotId, 10);
|
|
56
|
+
return 0;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const parseReceiveList = () =>
|
|
60
|
+
receiveList
|
|
61
|
+
.split(',')
|
|
62
|
+
.map(s => s.trim())
|
|
63
|
+
.filter(Boolean);
|
|
64
|
+
|
|
65
|
+
const parseRichMediaDataInput = () =>
|
|
66
|
+
richMediaData
|
|
67
|
+
.split(',')
|
|
68
|
+
.map(s => parseInt(s.trim(), 10))
|
|
69
|
+
.filter(n => Number.isInteger(n) && n >= 0);
|
|
70
|
+
|
|
47
71
|
const addTestResult = (method: string, success: boolean, result?: any, error?: string) => {
|
|
48
72
|
const newResult: TestResult = {
|
|
49
73
|
method,
|
|
@@ -106,9 +130,12 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
106
130
|
const testAuthenticate = async () => {
|
|
107
131
|
setLoading(true);
|
|
108
132
|
try {
|
|
109
|
-
const result = await BeiDouModule.beidou.authenticate();
|
|
110
|
-
addTestResult('authenticate',
|
|
111
|
-
Alert.alert(
|
|
133
|
+
const result: BDAuthResult = await BeiDouModule.beidou.authenticate(parseSlotId());
|
|
134
|
+
addTestResult('authenticate', true, result);
|
|
135
|
+
Alert.alert(
|
|
136
|
+
'鉴权结果',
|
|
137
|
+
`Slot: ${result.slotId}\nCode: ${result.code}\n状态: ${result.statusMsg ?? ''}`
|
|
138
|
+
);
|
|
112
139
|
} catch (error) {
|
|
113
140
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
114
141
|
addTestResult('authenticate', false, undefined, errorMsg);
|
|
@@ -122,9 +149,12 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
122
149
|
const testGetStatus = async () => {
|
|
123
150
|
setLoading(true);
|
|
124
151
|
try {
|
|
125
|
-
const result: BDStatusResponse = await BeiDouModule.beidou.getStatus();
|
|
152
|
+
const result: BDStatusResponse = await BeiDouModule.beidou.getStatus(parseSlotId());
|
|
126
153
|
addTestResult('getStatus', true, result);
|
|
127
|
-
Alert.alert(
|
|
154
|
+
Alert.alert(
|
|
155
|
+
'用户状态',
|
|
156
|
+
`Slot: ${result.slotId ?? parseSlotId()}\n代码: ${result.code}\n状态: ${result.statusMsg}\n剩余额度: ${result.msgQuotaRemain}\n用户开通状态: ${result.userOpenStatus}`
|
|
157
|
+
);
|
|
128
158
|
} catch (error) {
|
|
129
159
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
130
160
|
addTestResult('getStatus', false, undefined, errorMsg);
|
|
@@ -138,7 +168,7 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
138
168
|
const testCheckKey = async () => {
|
|
139
169
|
setLoading(true);
|
|
140
170
|
try {
|
|
141
|
-
const result: number = await BeiDouModule.beidou.checkKey();
|
|
171
|
+
const result: number = await BeiDouModule.beidou.checkKey(parseSlotId());
|
|
142
172
|
addTestResult('checkKey', true, result);
|
|
143
173
|
Alert.alert('密钥状态', `密钥状态代码: ${result}`);
|
|
144
174
|
} catch (error) {
|
|
@@ -154,10 +184,21 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
154
184
|
const testCommonEncrypt = async () => {
|
|
155
185
|
setLoading(true);
|
|
156
186
|
try {
|
|
157
|
-
const receivers =
|
|
158
|
-
const result: BDMsgEncryptResponse = await BeiDouModule.beidou.encryptCommonMessage(receivers, inputMsg
|
|
159
|
-
|
|
160
|
-
|
|
187
|
+
const receivers = parseReceiveList();
|
|
188
|
+
const result: BDMsgEncryptResponse[] = await BeiDouModule.beidou.encryptCommonMessage(receivers, inputMsg, {
|
|
189
|
+
slotId: parseSlotId(),
|
|
190
|
+
speedType,
|
|
191
|
+
});
|
|
192
|
+
const first = result[0];
|
|
193
|
+
addTestResult('commonEncrypt', result.length > 0, result, result.length > 0 ? undefined : '无返回数据');
|
|
194
|
+
if (first) {
|
|
195
|
+
Alert.alert(
|
|
196
|
+
'加密成功',
|
|
197
|
+
`返回条数: ${result.length}\n代码: ${first.code}\n状态: ${first.statusMsg}\n发送方: ${first.sendMobile}\n数据长度: ${first.data.length}\nPayload Len: ${first.len}`
|
|
198
|
+
);
|
|
199
|
+
} else {
|
|
200
|
+
Alert.alert('提示', '调用成功但未返回任何加密结果');
|
|
201
|
+
}
|
|
161
202
|
} catch (error) {
|
|
162
203
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
163
204
|
addTestResult('commonEncrypt', false, undefined, errorMsg);
|
|
@@ -171,7 +212,7 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
171
212
|
const testPositionEncrypt = async () => {
|
|
172
213
|
setLoading(true);
|
|
173
214
|
try {
|
|
174
|
-
const receivers =
|
|
215
|
+
const receivers = parseReceiveList();
|
|
175
216
|
const lng = parseFloat(longitude);
|
|
176
217
|
const lat = parseFloat(latitude);
|
|
177
218
|
|
|
@@ -180,9 +221,26 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
180
221
|
return;
|
|
181
222
|
}
|
|
182
223
|
|
|
183
|
-
const result: BDMsgEncryptResponse = await BeiDouModule.beidou.encryptPositionMessage(
|
|
184
|
-
|
|
185
|
-
|
|
224
|
+
const result: BDMsgEncryptResponse[] = await BeiDouModule.beidou.encryptPositionMessage(
|
|
225
|
+
receivers,
|
|
226
|
+
inputMsg,
|
|
227
|
+
lng,
|
|
228
|
+
lat,
|
|
229
|
+
{
|
|
230
|
+
slotId: parseSlotId(),
|
|
231
|
+
speedType,
|
|
232
|
+
}
|
|
233
|
+
);
|
|
234
|
+
const first = result[0];
|
|
235
|
+
addTestResult('positionEncrypt', result.length > 0, result, result.length > 0 ? undefined : '无返回数据');
|
|
236
|
+
if (first) {
|
|
237
|
+
Alert.alert(
|
|
238
|
+
'位置加密成功',
|
|
239
|
+
`返回条数: ${result.length}\n代码: ${first.code}\n状态: ${first.statusMsg}\n发送方: ${first.sendMobile}\n数据长度: ${first.data.length}\nPayload Len: ${first.len}`
|
|
240
|
+
);
|
|
241
|
+
} else {
|
|
242
|
+
Alert.alert('提示', '调用成功但未返回任何加密结果');
|
|
243
|
+
}
|
|
186
244
|
} catch (error) {
|
|
187
245
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
188
246
|
addTestResult('positionEncrypt', false, undefined, errorMsg);
|
|
@@ -192,13 +250,93 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
192
250
|
}
|
|
193
251
|
};
|
|
194
252
|
|
|
253
|
+
const testCommonEmergencyEncrypt = async () => {
|
|
254
|
+
setLoading(true);
|
|
255
|
+
try {
|
|
256
|
+
const receivers = parseReceiveList();
|
|
257
|
+
const result: BDMsgEncryptResponse[] = await BeiDouModule.beidou.encryptCommonEmergencyMessage(
|
|
258
|
+
receivers,
|
|
259
|
+
inputMsg,
|
|
260
|
+
{
|
|
261
|
+
slotId: parseSlotId(),
|
|
262
|
+
speedType,
|
|
263
|
+
}
|
|
264
|
+
);
|
|
265
|
+
const first = result[0];
|
|
266
|
+
addTestResult('commonEmergencyEncrypt', result.length > 0, result, result.length > 0 ? undefined : '无返回数据');
|
|
267
|
+
if (first) {
|
|
268
|
+
Alert.alert(
|
|
269
|
+
'应急通用加密成功',
|
|
270
|
+
`返回条数: ${result.length}\n代码: ${first.code}\n状态: ${first.statusMsg}\n发送方: ${first.sendMobile}\n数据长度: ${first.data.length}`
|
|
271
|
+
);
|
|
272
|
+
} else {
|
|
273
|
+
Alert.alert('提示', '调用成功但未返回任何加密结果');
|
|
274
|
+
}
|
|
275
|
+
} catch (error) {
|
|
276
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
277
|
+
addTestResult('commonEmergencyEncrypt', false, undefined, errorMsg);
|
|
278
|
+
Alert.alert('错误', `应急通用加密失败: ${errorMsg}`);
|
|
279
|
+
} finally {
|
|
280
|
+
setLoading(false);
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
const testPositionEmergencyEncrypt = async () => {
|
|
285
|
+
setLoading(true);
|
|
286
|
+
try {
|
|
287
|
+
const receivers = parseReceiveList();
|
|
288
|
+
const lng = parseFloat(longitude);
|
|
289
|
+
const lat = parseFloat(latitude);
|
|
290
|
+
|
|
291
|
+
if (isNaN(lng) || isNaN(lat)) {
|
|
292
|
+
Alert.alert('错误', '请输入有效的经纬度');
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
const result: BDMsgEncryptResponse[] = await BeiDouModule.beidou.encryptPositionEmergencyMessage(
|
|
297
|
+
receivers,
|
|
298
|
+
inputMsg,
|
|
299
|
+
lng,
|
|
300
|
+
lat,
|
|
301
|
+
{
|
|
302
|
+
slotId: parseSlotId(),
|
|
303
|
+
speedType,
|
|
304
|
+
}
|
|
305
|
+
);
|
|
306
|
+
const first = result[0];
|
|
307
|
+
addTestResult(
|
|
308
|
+
'positionEmergencyEncrypt',
|
|
309
|
+
result.length > 0,
|
|
310
|
+
result,
|
|
311
|
+
result.length > 0 ? undefined : '无返回数据'
|
|
312
|
+
);
|
|
313
|
+
if (first) {
|
|
314
|
+
Alert.alert(
|
|
315
|
+
'应急位置加密成功',
|
|
316
|
+
`返回条数: ${result.length}\n代码: ${first.code}\n状态: ${first.statusMsg}\n发送方: ${first.sendMobile}\n数据长度: ${first.data.length}`
|
|
317
|
+
);
|
|
318
|
+
} else {
|
|
319
|
+
Alert.alert('提示', '调用成功但未返回任何加密结果');
|
|
320
|
+
}
|
|
321
|
+
} catch (error) {
|
|
322
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
323
|
+
addTestResult('positionEmergencyEncrypt', false, undefined, errorMsg);
|
|
324
|
+
Alert.alert('错误', `应急位置加密失败: ${errorMsg}`);
|
|
325
|
+
} finally {
|
|
326
|
+
setLoading(false);
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
|
|
195
330
|
// 信箱查询加密测试
|
|
196
331
|
const testMailboxQuery = async () => {
|
|
197
332
|
setLoading(true);
|
|
198
333
|
try {
|
|
199
|
-
const result: BDMsgEncryptResponse = await BeiDouModule.beidou.encryptMailboxQuery();
|
|
334
|
+
const result: BDMsgEncryptResponse = await BeiDouModule.beidou.encryptMailboxQuery(parseSlotId());
|
|
200
335
|
addTestResult('mailboxQuery', true, result);
|
|
201
|
-
Alert.alert(
|
|
336
|
+
Alert.alert(
|
|
337
|
+
'信箱查询成功',
|
|
338
|
+
`代码: ${result.code}\n状态: ${result.statusMsg}\n发送方: ${result.sendMobile}\n数据长度: ${result.data.length}\nPayload Len: ${result.len}`
|
|
339
|
+
);
|
|
202
340
|
} catch (error) {
|
|
203
341
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
204
342
|
addTestResult('mailboxQuery', false, undefined, errorMsg);
|
|
@@ -208,6 +346,216 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
208
346
|
}
|
|
209
347
|
};
|
|
210
348
|
|
|
349
|
+
const testEmergencyMailboxQuery = async () => {
|
|
350
|
+
setLoading(true);
|
|
351
|
+
try {
|
|
352
|
+
const result: BDMsgEncryptResponse = await BeiDouModule.beidou.encryptEmergencyMailboxQuery(
|
|
353
|
+
replyMobile,
|
|
354
|
+
parseSlotId()
|
|
355
|
+
);
|
|
356
|
+
addTestResult('emergencyMailboxQuery', true, result);
|
|
357
|
+
Alert.alert(
|
|
358
|
+
'应急信箱查询成功',
|
|
359
|
+
`代码: ${result.code}\n状态: ${result.statusMsg}\n发送方: ${result.sendMobile}\n数据长度: ${result.data.length}\nPayload Len: ${result.len}`
|
|
360
|
+
);
|
|
361
|
+
} catch (error) {
|
|
362
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
363
|
+
addTestResult('emergencyMailboxQuery', false, undefined, errorMsg);
|
|
364
|
+
Alert.alert('错误', `应急信箱查询失败: ${errorMsg}`);
|
|
365
|
+
} finally {
|
|
366
|
+
setLoading(false);
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
const testCommonRichMediaEncrypt = async () => {
|
|
371
|
+
setLoading(true);
|
|
372
|
+
try {
|
|
373
|
+
const receivers = parseReceiveList();
|
|
374
|
+
const dataBytes = parseRichMediaDataInput();
|
|
375
|
+
if (dataBytes.length === 0) {
|
|
376
|
+
Alert.alert('错误', '请填写有效的富媒体数据(逗号分隔的数字)');
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
const result: BDMsgEncryptResponse[] = await BeiDouModule.beidou.encryptCommonRichMediaMessage(
|
|
381
|
+
receivers,
|
|
382
|
+
msgType,
|
|
383
|
+
dataBytes,
|
|
384
|
+
{
|
|
385
|
+
slotId: parseSlotId(),
|
|
386
|
+
speedType,
|
|
387
|
+
}
|
|
388
|
+
);
|
|
389
|
+
const first = result[0];
|
|
390
|
+
addTestResult('commonRichMediaEncrypt', result.length > 0, result, result.length > 0 ? undefined : '无返回数据');
|
|
391
|
+
if (first) {
|
|
392
|
+
Alert.alert(
|
|
393
|
+
'富媒体通用加密成功',
|
|
394
|
+
`返回条数: ${result.length}\n代码: ${first.code}\n状态: ${first.statusMsg}\n发送方: ${first.sendMobile}`
|
|
395
|
+
);
|
|
396
|
+
} else {
|
|
397
|
+
Alert.alert('提示', '调用成功但未返回任何加密结果');
|
|
398
|
+
}
|
|
399
|
+
} catch (error) {
|
|
400
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
401
|
+
addTestResult('commonRichMediaEncrypt', false, undefined, errorMsg);
|
|
402
|
+
Alert.alert('错误', `富媒体通用加密失败: ${errorMsg}`);
|
|
403
|
+
} finally {
|
|
404
|
+
setLoading(false);
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
const testPositionRichMediaEncrypt = async () => {
|
|
409
|
+
setLoading(true);
|
|
410
|
+
try {
|
|
411
|
+
const receivers = parseReceiveList();
|
|
412
|
+
const dataBytes = parseRichMediaDataInput();
|
|
413
|
+
if (dataBytes.length === 0) {
|
|
414
|
+
Alert.alert('错误', '请填写有效的富媒体数据(逗号分隔的数字)');
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
const lng = parseFloat(longitude);
|
|
419
|
+
const lat = parseFloat(latitude);
|
|
420
|
+
|
|
421
|
+
if (isNaN(lng) || isNaN(lat)) {
|
|
422
|
+
Alert.alert('错误', '请输入有效的经纬度');
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
const result: BDMsgEncryptResponse[] = await BeiDouModule.beidou.encryptPositionRichMediaMessage(
|
|
427
|
+
receivers,
|
|
428
|
+
msgType,
|
|
429
|
+
dataBytes,
|
|
430
|
+
lng,
|
|
431
|
+
lat,
|
|
432
|
+
{
|
|
433
|
+
slotId: parseSlotId(),
|
|
434
|
+
speedType,
|
|
435
|
+
}
|
|
436
|
+
);
|
|
437
|
+
const first = result[0];
|
|
438
|
+
addTestResult(
|
|
439
|
+
'positionRichMediaEncrypt',
|
|
440
|
+
result.length > 0,
|
|
441
|
+
result,
|
|
442
|
+
result.length > 0 ? undefined : '无返回数据'
|
|
443
|
+
);
|
|
444
|
+
if (first) {
|
|
445
|
+
Alert.alert(
|
|
446
|
+
'富媒体位置加密成功',
|
|
447
|
+
`返回条数: ${result.length}\n代码: ${first.code}\n状态: ${first.statusMsg}\n发送方: ${first.sendMobile}`
|
|
448
|
+
);
|
|
449
|
+
} else {
|
|
450
|
+
Alert.alert('提示', '调用成功但未返回任何加密结果');
|
|
451
|
+
}
|
|
452
|
+
} catch (error) {
|
|
453
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
454
|
+
addTestResult('positionRichMediaEncrypt', false, undefined, errorMsg);
|
|
455
|
+
Alert.alert('错误', `富媒体位置加密失败: ${errorMsg}`);
|
|
456
|
+
} finally {
|
|
457
|
+
setLoading(false);
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
const testCommonRichMediaTextEncrypt = async () => {
|
|
462
|
+
setLoading(true);
|
|
463
|
+
try {
|
|
464
|
+
const receivers = parseReceiveList();
|
|
465
|
+
const dataBytes = parseRichMediaDataInput();
|
|
466
|
+
if (dataBytes.length === 0) {
|
|
467
|
+
Alert.alert('错误', '请填写有效的富媒体数据(逗号分隔的数字)');
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
const result: BDMsgEncryptResponse[] = await BeiDouModule.beidou.encryptCommonRichMediaAndTextMessage(
|
|
472
|
+
receivers,
|
|
473
|
+
richMediaText,
|
|
474
|
+
msgType,
|
|
475
|
+
dataBytes,
|
|
476
|
+
{
|
|
477
|
+
slotId: parseSlotId(),
|
|
478
|
+
speedType,
|
|
479
|
+
}
|
|
480
|
+
);
|
|
481
|
+
const first = result[0];
|
|
482
|
+
addTestResult(
|
|
483
|
+
'commonRichMediaTextEncrypt',
|
|
484
|
+
result.length > 0,
|
|
485
|
+
result,
|
|
486
|
+
result.length > 0 ? undefined : '无返回数据'
|
|
487
|
+
);
|
|
488
|
+
if (first) {
|
|
489
|
+
Alert.alert(
|
|
490
|
+
'图文通用加密成功',
|
|
491
|
+
`返回条数: ${result.length}\n代码: ${first.code}\n状态: ${first.statusMsg}\n发送方: ${first.sendMobile}`
|
|
492
|
+
);
|
|
493
|
+
} else {
|
|
494
|
+
Alert.alert('提示', '调用成功但未返回任何加密结果');
|
|
495
|
+
}
|
|
496
|
+
} catch (error) {
|
|
497
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
498
|
+
addTestResult('commonRichMediaTextEncrypt', false, undefined, errorMsg);
|
|
499
|
+
Alert.alert('错误', `图文通用加密失败: ${errorMsg}`);
|
|
500
|
+
} finally {
|
|
501
|
+
setLoading(false);
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
|
|
505
|
+
const testPositionRichMediaTextEncrypt = async () => {
|
|
506
|
+
setLoading(true);
|
|
507
|
+
try {
|
|
508
|
+
const receivers = parseReceiveList();
|
|
509
|
+
const dataBytes = parseRichMediaDataInput();
|
|
510
|
+
if (dataBytes.length === 0) {
|
|
511
|
+
Alert.alert('错误', '请填写有效的富媒体数据(逗号分隔的数字)');
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
const lng = parseFloat(longitude);
|
|
516
|
+
const lat = parseFloat(latitude);
|
|
517
|
+
|
|
518
|
+
if (isNaN(lng) || isNaN(lat)) {
|
|
519
|
+
Alert.alert('错误', '请输入有效的经纬度');
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
const result: BDMsgEncryptResponse[] = await BeiDouModule.beidou.encryptPositionRichMediaAndTextMessage(
|
|
524
|
+
receivers,
|
|
525
|
+
richMediaText,
|
|
526
|
+
msgType,
|
|
527
|
+
dataBytes,
|
|
528
|
+
lng,
|
|
529
|
+
lat,
|
|
530
|
+
{
|
|
531
|
+
slotId: parseSlotId(),
|
|
532
|
+
speedType,
|
|
533
|
+
}
|
|
534
|
+
);
|
|
535
|
+
const first = result[0];
|
|
536
|
+
addTestResult(
|
|
537
|
+
'positionRichMediaTextEncrypt',
|
|
538
|
+
result.length > 0,
|
|
539
|
+
result,
|
|
540
|
+
result.length > 0 ? undefined : '无返回数据'
|
|
541
|
+
);
|
|
542
|
+
if (first) {
|
|
543
|
+
Alert.alert(
|
|
544
|
+
'图文位置加密成功',
|
|
545
|
+
`返回条数: ${result.length}\n代码: ${first.code}\n状态: ${first.statusMsg}\n发送方: ${first.sendMobile}`
|
|
546
|
+
);
|
|
547
|
+
} else {
|
|
548
|
+
Alert.alert('提示', '调用成功但未返回任何加密结果');
|
|
549
|
+
}
|
|
550
|
+
} catch (error) {
|
|
551
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
552
|
+
addTestResult('positionRichMediaTextEncrypt', false, undefined, errorMsg);
|
|
553
|
+
Alert.alert('错误', `图文位置加密失败: ${errorMsg}`);
|
|
554
|
+
} finally {
|
|
555
|
+
setLoading(false);
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
|
|
211
559
|
// 报文解密测试
|
|
212
560
|
const testDecryptMessage = async () => {
|
|
213
561
|
setLoading(true);
|
|
@@ -218,7 +566,11 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
218
566
|
return;
|
|
219
567
|
}
|
|
220
568
|
|
|
221
|
-
const result: BDMsgDecryptResponse = await BeiDouModule.beidou.decryptMessage(
|
|
569
|
+
const result: BDMsgDecryptResponse = await BeiDouModule.beidou.decryptMessage(
|
|
570
|
+
msgBytes,
|
|
571
|
+
msgBytes.length,
|
|
572
|
+
parseSlotId()
|
|
573
|
+
);
|
|
222
574
|
addTestResult('decryptMessage', true, result);
|
|
223
575
|
Alert.alert('解密成功', `状态: ${result.statusMsg}\n是否还有消息: ${result.isRemainMsg}\n发送方: ${result.rcvMobile}\n内容: ${result.data}`);
|
|
224
576
|
} catch (error) {
|
|
@@ -234,9 +586,18 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
234
586
|
const testDownloadEphemeris = async () => {
|
|
235
587
|
setLoading(true);
|
|
236
588
|
try {
|
|
237
|
-
const result: BDMsgEphemerisFileDLResponse = await BeiDouModule.beidou.downloadEphemeris(
|
|
589
|
+
const result: BDMsgEphemerisFileDLResponse = await BeiDouModule.beidou.downloadEphemeris(
|
|
590
|
+
ephemerisType,
|
|
591
|
+
ephemerisVersion,
|
|
592
|
+
parseSlotId()
|
|
593
|
+
);
|
|
238
594
|
addTestResult('downloadEphemeris', true, result);
|
|
239
|
-
Alert.alert(
|
|
595
|
+
Alert.alert(
|
|
596
|
+
'下载成功',
|
|
597
|
+
`Slot: ${result.slotId}\n代码: ${result.code}\n状态: ${result.statusMsg}\n版本: ${result.version}\n文件名: ${result.ephemerisZipFileName ?? '未知'}\n文件大小: ${
|
|
598
|
+
result.ephemerisZipFile.length
|
|
599
|
+
} 字节`
|
|
600
|
+
);
|
|
240
601
|
} catch (error) {
|
|
241
602
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
242
603
|
addTestResult('downloadEphemeris', false, undefined, errorMsg);
|
|
@@ -259,7 +620,14 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
259
620
|
testCheckKey,
|
|
260
621
|
testCommonEncrypt,
|
|
261
622
|
testPositionEncrypt,
|
|
623
|
+
testCommonEmergencyEncrypt,
|
|
624
|
+
testPositionEmergencyEncrypt,
|
|
262
625
|
testMailboxQuery,
|
|
626
|
+
testEmergencyMailboxQuery,
|
|
627
|
+
testCommonRichMediaEncrypt,
|
|
628
|
+
testPositionRichMediaEncrypt,
|
|
629
|
+
testCommonRichMediaTextEncrypt,
|
|
630
|
+
testPositionRichMediaTextEncrypt,
|
|
263
631
|
testDecryptMessage,
|
|
264
632
|
testDownloadEphemeris,
|
|
265
633
|
];
|
|
@@ -332,6 +700,28 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
332
700
|
<View style={styles.inputSection}>
|
|
333
701
|
<Text style={styles.sectionTitle}>测试参数</Text>
|
|
334
702
|
|
|
703
|
+
<View style={styles.row}>
|
|
704
|
+
<View style={styles.halfInput}>
|
|
705
|
+
<Text style={styles.inputLabel}>SIM Slot ID:</Text>
|
|
706
|
+
<TextInput
|
|
707
|
+
style={styles.textInput}
|
|
708
|
+
value={slotId}
|
|
709
|
+
onChangeText={setSlotId}
|
|
710
|
+
placeholder="0"
|
|
711
|
+
keyboardType="numeric"
|
|
712
|
+
/>
|
|
713
|
+
</View>
|
|
714
|
+
<View style={styles.halfInput}>
|
|
715
|
+
<Text style={styles.inputLabel}>Speed Type:</Text>
|
|
716
|
+
<TextInput
|
|
717
|
+
style={styles.textInput}
|
|
718
|
+
value={speedType}
|
|
719
|
+
onChangeText={setSpeedType}
|
|
720
|
+
placeholder="0"
|
|
721
|
+
/>
|
|
722
|
+
</View>
|
|
723
|
+
</View>
|
|
724
|
+
|
|
335
725
|
<View style={styles.inputGroup}>
|
|
336
726
|
<Text style={styles.inputLabel}>消息内容:</Text>
|
|
337
727
|
<TextInput
|
|
@@ -405,6 +795,46 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
405
795
|
placeholder="1,2,3,4,5"
|
|
406
796
|
/>
|
|
407
797
|
</View>
|
|
798
|
+
|
|
799
|
+
<View style={styles.inputGroup}>
|
|
800
|
+
<Text style={styles.inputLabel}>消息类型 (msgType):</Text>
|
|
801
|
+
<TextInput
|
|
802
|
+
style={styles.textInput}
|
|
803
|
+
value={msgType}
|
|
804
|
+
onChangeText={setMsgType}
|
|
805
|
+
placeholder="00"
|
|
806
|
+
/>
|
|
807
|
+
</View>
|
|
808
|
+
|
|
809
|
+
<View style={styles.inputGroup}>
|
|
810
|
+
<Text style={styles.inputLabel}>富媒体数据 (逗号分隔的数字):</Text>
|
|
811
|
+
<TextInput
|
|
812
|
+
style={styles.textInput}
|
|
813
|
+
value={richMediaData}
|
|
814
|
+
onChangeText={setRichMediaData}
|
|
815
|
+
placeholder="1,2,3,4"
|
|
816
|
+
/>
|
|
817
|
+
</View>
|
|
818
|
+
|
|
819
|
+
<View style={styles.inputGroup}>
|
|
820
|
+
<Text style={styles.inputLabel}>图文混排文本:</Text>
|
|
821
|
+
<TextInput
|
|
822
|
+
style={styles.textInput}
|
|
823
|
+
value={richMediaText}
|
|
824
|
+
onChangeText={setRichMediaText}
|
|
825
|
+
placeholder="图文混排文本内容"
|
|
826
|
+
/>
|
|
827
|
+
</View>
|
|
828
|
+
|
|
829
|
+
<View style={styles.inputGroup}>
|
|
830
|
+
<Text style={styles.inputLabel}>应急回执手机号:</Text>
|
|
831
|
+
<TextInput
|
|
832
|
+
style={styles.textInput}
|
|
833
|
+
value={replyMobile}
|
|
834
|
+
onChangeText={setReplyMobile}
|
|
835
|
+
placeholder="13800138000"
|
|
836
|
+
/>
|
|
837
|
+
</View>
|
|
408
838
|
</View>
|
|
409
839
|
|
|
410
840
|
{/* 测试按钮区域 */}
|
|
@@ -460,6 +890,22 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
460
890
|
<Text style={styles.testButtonText}>位置加密</Text>
|
|
461
891
|
</TouchableOpacity>
|
|
462
892
|
|
|
893
|
+
<TouchableOpacity
|
|
894
|
+
style={[styles.testButton, styles.primaryButton]}
|
|
895
|
+
onPress={testCommonEmergencyEncrypt}
|
|
896
|
+
disabled={loading || !isServiceBound}
|
|
897
|
+
>
|
|
898
|
+
<Text style={styles.testButtonText}>应急通用加密</Text>
|
|
899
|
+
</TouchableOpacity>
|
|
900
|
+
|
|
901
|
+
<TouchableOpacity
|
|
902
|
+
style={[styles.testButton, styles.primaryButton]}
|
|
903
|
+
onPress={testPositionEmergencyEncrypt}
|
|
904
|
+
disabled={loading || !isServiceBound}
|
|
905
|
+
>
|
|
906
|
+
<Text style={styles.testButtonText}>应急位置加密</Text>
|
|
907
|
+
</TouchableOpacity>
|
|
908
|
+
|
|
463
909
|
<TouchableOpacity
|
|
464
910
|
style={[styles.testButton, styles.primaryButton]}
|
|
465
911
|
onPress={testMailboxQuery}
|
|
@@ -468,6 +914,46 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
468
914
|
<Text style={styles.testButtonText}>信箱查询</Text>
|
|
469
915
|
</TouchableOpacity>
|
|
470
916
|
|
|
917
|
+
<TouchableOpacity
|
|
918
|
+
style={[styles.testButton, styles.primaryButton]}
|
|
919
|
+
onPress={testEmergencyMailboxQuery}
|
|
920
|
+
disabled={loading || !isServiceBound}
|
|
921
|
+
>
|
|
922
|
+
<Text style={styles.testButtonText}>应急信箱查询</Text>
|
|
923
|
+
</TouchableOpacity>
|
|
924
|
+
|
|
925
|
+
<TouchableOpacity
|
|
926
|
+
style={[styles.testButton, styles.primaryButton]}
|
|
927
|
+
onPress={testCommonRichMediaEncrypt}
|
|
928
|
+
disabled={loading || !isServiceBound}
|
|
929
|
+
>
|
|
930
|
+
<Text style={styles.testButtonText}>富媒体通用加密</Text>
|
|
931
|
+
</TouchableOpacity>
|
|
932
|
+
|
|
933
|
+
<TouchableOpacity
|
|
934
|
+
style={[styles.testButton, styles.primaryButton]}
|
|
935
|
+
onPress={testPositionRichMediaEncrypt}
|
|
936
|
+
disabled={loading || !isServiceBound}
|
|
937
|
+
>
|
|
938
|
+
<Text style={styles.testButtonText}>富媒体位置加密</Text>
|
|
939
|
+
</TouchableOpacity>
|
|
940
|
+
|
|
941
|
+
<TouchableOpacity
|
|
942
|
+
style={[styles.testButton, styles.primaryButton]}
|
|
943
|
+
onPress={testCommonRichMediaTextEncrypt}
|
|
944
|
+
disabled={loading || !isServiceBound}
|
|
945
|
+
>
|
|
946
|
+
<Text style={styles.testButtonText}>图文通用加密</Text>
|
|
947
|
+
</TouchableOpacity>
|
|
948
|
+
|
|
949
|
+
<TouchableOpacity
|
|
950
|
+
style={[styles.testButton, styles.primaryButton]}
|
|
951
|
+
onPress={testPositionRichMediaTextEncrypt}
|
|
952
|
+
disabled={loading || !isServiceBound}
|
|
953
|
+
>
|
|
954
|
+
<Text style={styles.testButtonText}>图文位置加密</Text>
|
|
955
|
+
</TouchableOpacity>
|
|
956
|
+
|
|
471
957
|
<TouchableOpacity
|
|
472
958
|
style={[styles.testButton, styles.primaryButton]}
|
|
473
959
|
onPress={testDecryptMessage}
|