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/android/build.gradle
CHANGED
|
@@ -46,14 +46,14 @@ repositories {
|
|
|
46
46
|
google()
|
|
47
47
|
mavenCentral()
|
|
48
48
|
maven { url 'https://www.jitpack.io' }
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
// maven {
|
|
50
|
+
// url "http://10.18.1.5:8081/repository/maven-releases/"
|
|
51
|
+
// allowInsecureProtocol = true
|
|
52
|
+
// credentials {
|
|
53
|
+
// username = "admin"
|
|
54
|
+
// password = "ZTUz-Yjg0OGRm"
|
|
55
|
+
// }
|
|
56
|
+
// }
|
|
57
57
|
maven {
|
|
58
58
|
url 'http://117.149.10.66:38185/repository/cmcc-android-public/'
|
|
59
59
|
allowInsecureProtocol(true)
|
|
@@ -68,7 +68,7 @@ repositories {
|
|
|
68
68
|
dependencies {
|
|
69
69
|
//noinspection GradleDynamicVersion
|
|
70
70
|
implementation "com.facebook.react:react-native:${_reactNativeVersion}"
|
|
71
|
-
|
|
71
|
+
implementation 'com.fxzs:beidousdk:1.0.7@aar'
|
|
72
72
|
// Add local AAR files
|
|
73
73
|
implementation fileTree(dir: "src/main/libs", include: ["*.jar", "*.aar"])
|
|
74
74
|
}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
package="com.fxzs.rnbeidou">
|
|
3
3
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
|
4
4
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
|
5
|
+
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
|
6
|
+
<uses-permission android:name="android.permission.READ_PHONE_NUMBERS" />
|
|
5
7
|
<!-- Android 10+ 建議聲明後台定位,如不需要可去除 -->
|
|
6
8
|
<!-- <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /> -->
|
|
7
9
|
</manifest>
|
|
@@ -13,6 +13,9 @@ import android.os.Build;
|
|
|
13
13
|
import android.util.Log;
|
|
14
14
|
import android.location.Location;
|
|
15
15
|
import android.location.LocationManager;
|
|
16
|
+
import android.telephony.SubscriptionInfo;
|
|
17
|
+
import android.telephony.SubscriptionManager;
|
|
18
|
+
import android.telephony.TelephonyManager;
|
|
16
19
|
|
|
17
20
|
import androidx.annotation.NonNull;
|
|
18
21
|
import androidx.annotation.Nullable;
|
|
@@ -31,7 +34,10 @@ import com.facebook.react.bridge.ReactContext;
|
|
|
31
34
|
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
32
35
|
import com.facebook.react.bridge.ReactMethod;
|
|
33
36
|
import com.facebook.react.bridge.WritableMap;
|
|
37
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
38
|
+
import com.facebook.react.bridge.WritableArray;
|
|
34
39
|
import com.facebook.react.bridge.WritableNativeMap;
|
|
40
|
+
import com.facebook.react.bridge.WritableNativeArray;
|
|
35
41
|
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
36
42
|
|
|
37
43
|
import org.json.JSONException;
|
|
@@ -40,30 +46,15 @@ import java.util.Arrays;
|
|
|
40
46
|
import java.util.Base64;
|
|
41
47
|
import java.util.Map;
|
|
42
48
|
import java.util.Objects;
|
|
43
|
-
import java.util.List;
|
|
44
49
|
import java.util.ArrayList;
|
|
45
|
-
|
|
46
|
-
// 北斗AIDL服务相关导入
|
|
47
|
-
import com.satnav.beidouservice.IBeidouMsgAidlInterface;
|
|
48
|
-
import com.satnav.beidouservice.BDStatusResponse;
|
|
49
|
-
import com.satnav.beidouservice.BDMsgEncryptResponse;
|
|
50
|
-
import com.satnav.beidouservice.BDMsgDecryptResponse;
|
|
51
|
-
import com.satnav.beidouservice.BDMsgEphemerisFileDLResponse;
|
|
52
|
-
import android.content.ServiceConnection;
|
|
53
|
-
import android.content.ComponentName;
|
|
54
|
-
import android.content.Intent;
|
|
55
|
-
import android.os.IBinder;
|
|
56
|
-
import com.facebook.react.bridge.ReadableArray;
|
|
57
|
-
import com.facebook.react.bridge.WritableArray;
|
|
58
|
-
import com.facebook.react.bridge.WritableNativeArray;
|
|
50
|
+
import java.util.List;
|
|
59
51
|
|
|
60
52
|
public class BeiDouBluetoothModule extends ReactContextBaseJavaModule {
|
|
61
53
|
private ReactContext reactContext;
|
|
62
54
|
private LogManager logger;
|
|
63
55
|
|
|
64
|
-
// 北斗AIDL
|
|
65
|
-
private
|
|
66
|
-
private boolean isBeidouServiceBound = false;
|
|
56
|
+
// 北斗AIDL服务辅助类
|
|
57
|
+
private final BeidouAidlHelper beidouAidlHelper;
|
|
67
58
|
|
|
68
59
|
@NonNull
|
|
69
60
|
@Override
|
|
@@ -74,6 +65,7 @@ public class BeiDouBluetoothModule extends ReactContextBaseJavaModule {
|
|
|
74
65
|
public BeiDouBluetoothModule(@Nullable ReactApplicationContext reactContext) {
|
|
75
66
|
super(reactContext);
|
|
76
67
|
this.reactContext = reactContext;
|
|
68
|
+
this.beidouAidlHelper = new BeidouAidlHelper(reactContext);
|
|
77
69
|
|
|
78
70
|
// 初始化日志管理器
|
|
79
71
|
this.logger = LogManager.getInstance();
|
|
@@ -611,256 +603,242 @@ public class BeiDouBluetoothModule extends ReactContextBaseJavaModule {
|
|
|
611
603
|
callback.invoke(wifiName);
|
|
612
604
|
}
|
|
613
605
|
|
|
614
|
-
|
|
606
|
+
/**
|
|
607
|
+
* 获取当前设备的SIM卡信息列表
|
|
608
|
+
*/
|
|
609
|
+
@ReactMethod
|
|
610
|
+
public void getSimCardList(Promise promise) {
|
|
611
|
+
try {
|
|
612
|
+
if (reactContext == null) {
|
|
613
|
+
promise.reject("CONTEXT_NULL", "React上下文不可用");
|
|
614
|
+
return;
|
|
615
|
+
}
|
|
615
616
|
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
public void onServiceConnected(ComponentName name, IBinder service) {
|
|
619
|
-
beidouService = IBeidouMsgAidlInterface.Stub.asInterface(service);
|
|
620
|
-
isBeidouServiceBound = true;
|
|
621
|
-
Log.d("BeiDouService", "北斗服务连接成功");
|
|
622
|
-
}
|
|
617
|
+
boolean hasReadPhoneStatePermission = ContextCompat.checkSelfPermission(reactContext,
|
|
618
|
+
Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED;
|
|
623
619
|
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
Log.d("BeiDouService", "北斗服务连接断开");
|
|
629
|
-
}
|
|
630
|
-
};
|
|
620
|
+
if (!hasReadPhoneStatePermission) {
|
|
621
|
+
promise.reject("PERMISSION_DENIED", "缺少READ_PHONE_STATE权限");
|
|
622
|
+
return;
|
|
623
|
+
}
|
|
631
624
|
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
intent.setComponent(new android.content.ComponentName(packageName, actionName));
|
|
637
|
-
try {
|
|
638
|
-
boolean result = reactContext.bindService(intent, beidouServiceConnection, Context.BIND_AUTO_CREATE);
|
|
639
|
-
Log.d("BeiDouService", "绑定北斗服务结果: " + result + ", 包名: " + packageName + ", 类名: " + actionName);
|
|
640
|
-
} catch (Exception e) {
|
|
641
|
-
Log.e("BeiDouService", "绑定北斗服务失败: " + e.getMessage());
|
|
625
|
+
boolean hasReadPhoneNumbersPermission = true;
|
|
626
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
627
|
+
hasReadPhoneNumbersPermission = ContextCompat.checkSelfPermission(reactContext,
|
|
628
|
+
Manifest.permission.READ_PHONE_NUMBERS) == PackageManager.PERMISSION_GRANTED;
|
|
642
629
|
}
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
630
|
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
631
|
+
WritableArray result = new WritableNativeArray();
|
|
632
|
+
Context context = reactContext;
|
|
633
|
+
|
|
634
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
|
|
635
|
+
SubscriptionManager subscriptionManager = (SubscriptionManager) context
|
|
636
|
+
.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
|
|
637
|
+
|
|
638
|
+
if (subscriptionManager != null) {
|
|
639
|
+
List<SubscriptionInfo> subscriptionInfoList;
|
|
640
|
+
try {
|
|
641
|
+
subscriptionInfoList = subscriptionManager.getActiveSubscriptionInfoList();
|
|
642
|
+
} catch (SecurityException permissionException) {
|
|
643
|
+
promise.reject("PERMISSION_DENIED", "访问SubscriptionManager失败: " + permissionException.getMessage(),
|
|
644
|
+
permissionException);
|
|
645
|
+
return;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
if (subscriptionInfoList != null) {
|
|
649
|
+
for (SubscriptionInfo info : subscriptionInfoList) {
|
|
650
|
+
WritableMap map = new WritableNativeMap();
|
|
651
|
+
CharSequence carrierName = info.getCarrierName();
|
|
652
|
+
CharSequence displayName = info.getDisplayName();
|
|
653
|
+
|
|
654
|
+
map.putInt("subscriptionId", info.getSubscriptionId());
|
|
655
|
+
map.putInt("simSlotIndex", info.getSimSlotIndex());
|
|
656
|
+
map.putString("carrierName", carrierName != null ? carrierName.toString() : null);
|
|
657
|
+
map.putString("displayName", displayName != null ? displayName.toString() : null);
|
|
658
|
+
map.putString("countryIso", info.getCountryIso());
|
|
659
|
+
map.putInt("mcc", info.getMcc());
|
|
660
|
+
map.putInt("mnc", info.getMnc());
|
|
661
|
+
|
|
662
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
|
663
|
+
map.putBoolean("isEmbedded", info.isEmbedded());
|
|
664
|
+
map.putBoolean("isOpportunistic", info.isOpportunistic());
|
|
665
|
+
} else {
|
|
666
|
+
map.putBoolean("isEmbedded", false);
|
|
667
|
+
map.putBoolean("isOpportunistic", false);
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
if (hasReadPhoneNumbersPermission) {
|
|
671
|
+
String phoneNumber;
|
|
672
|
+
try {
|
|
673
|
+
phoneNumber = info.getNumber();
|
|
674
|
+
} catch (SecurityException numberException) {
|
|
675
|
+
phoneNumber = null;
|
|
676
|
+
}
|
|
677
|
+
map.putString("number", phoneNumber);
|
|
678
|
+
} else {
|
|
679
|
+
map.putNull("number");
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
result.pushMap(map);
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
}
|
|
654
686
|
}
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
687
|
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
688
|
+
// 如果未获取到任何SIM卡信息,尝试使用TelephonyManager做兼容
|
|
689
|
+
if (result.size() == 0) {
|
|
690
|
+
TelephonyManager telephonyManager = (TelephonyManager) context
|
|
691
|
+
.getSystemService(Context.TELEPHONY_SERVICE);
|
|
692
|
+
|
|
693
|
+
if (telephonyManager != null) {
|
|
694
|
+
WritableMap map = new WritableNativeMap();
|
|
695
|
+
map.putInt("subscriptionId", -1);
|
|
696
|
+
map.putInt("simSlotIndex", 0);
|
|
697
|
+
map.putString("carrierName", telephonyManager.getSimOperatorName());
|
|
698
|
+
map.putString("displayName", telephonyManager.getSimOperatorName());
|
|
699
|
+
map.putString("countryIso", telephonyManager.getSimCountryIso());
|
|
700
|
+
|
|
701
|
+
String operator = telephonyManager.getSimOperator();
|
|
702
|
+
if (operator != null && operator.length() >= 5) {
|
|
703
|
+
try {
|
|
704
|
+
int mcc = Integer.parseInt(operator.substring(0, 3));
|
|
705
|
+
int mnc = Integer.parseInt(operator.substring(3));
|
|
706
|
+
map.putInt("mcc", mcc);
|
|
707
|
+
map.putInt("mnc", mnc);
|
|
708
|
+
} catch (NumberFormatException ignored) {
|
|
709
|
+
map.putInt("mcc", -1);
|
|
710
|
+
map.putInt("mnc", -1);
|
|
711
|
+
}
|
|
712
|
+
} else {
|
|
713
|
+
map.putInt("mcc", -1);
|
|
714
|
+
map.putInt("mnc", -1);
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
map.putBoolean("isEmbedded", false);
|
|
718
|
+
map.putBoolean("isOpportunistic", false);
|
|
719
|
+
|
|
720
|
+
if (hasReadPhoneNumbersPermission) {
|
|
721
|
+
String phoneNumber;
|
|
722
|
+
try {
|
|
723
|
+
phoneNumber = telephonyManager.getLine1Number();
|
|
724
|
+
} catch (SecurityException numberException) {
|
|
725
|
+
phoneNumber = null;
|
|
726
|
+
}
|
|
727
|
+
map.putString("number", phoneNumber);
|
|
728
|
+
} else {
|
|
729
|
+
map.putNull("number");
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
result.pushMap(map);
|
|
733
|
+
}
|
|
664
734
|
}
|
|
665
|
-
}
|
|
666
|
-
return array;
|
|
667
|
-
}
|
|
668
735
|
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
736
|
+
promise.resolve(result);
|
|
737
|
+
} catch (SecurityException permissionException) {
|
|
738
|
+
promise.reject("PERMISSION_DENIED", "获取SIM卡信息权限被拒绝: " + permissionException.getMessage(),
|
|
739
|
+
permissionException);
|
|
740
|
+
} catch (Exception e) {
|
|
741
|
+
logger.e("BeiDouBluetoothModule", "获取SIM卡信息失败: " + e.getMessage(), e);
|
|
742
|
+
promise.reject("SIM_INFO_ERROR", "获取SIM卡信息失败: " + e.getMessage(), e);
|
|
674
743
|
}
|
|
675
|
-
return list;
|
|
676
744
|
}
|
|
677
745
|
|
|
678
|
-
//
|
|
679
|
-
private byte[] readableArrayToByteArray(ReadableArray readableArray) {
|
|
680
|
-
byte[] bytes = new byte[readableArray.size()];
|
|
681
|
-
for (int i = 0; i < readableArray.size(); i++) {
|
|
682
|
-
bytes[i] = (byte) readableArray.getInt(i);
|
|
683
|
-
}
|
|
684
|
-
return bytes;
|
|
685
|
-
}
|
|
746
|
+
// ================== 北斗AIDL服务相关方法 ==================
|
|
686
747
|
|
|
687
748
|
@ReactMethod
|
|
688
749
|
public void bindBeidouServiceMethod(String packageName, String actionName, Promise promise) {
|
|
689
|
-
|
|
690
|
-
bindBeidouService(packageName, actionName);
|
|
691
|
-
promise.resolve(true);
|
|
692
|
-
} catch (Exception e) {
|
|
693
|
-
promise.reject("BIND_ERROR", "绑定北斗服务失败: " + e.getMessage());
|
|
694
|
-
}
|
|
750
|
+
beidouAidlHelper.bindService(packageName, actionName, promise);
|
|
695
751
|
}
|
|
696
752
|
|
|
697
753
|
@ReactMethod
|
|
698
754
|
public void unbindBeidouServiceMethod(Promise promise) {
|
|
699
|
-
|
|
700
|
-
unbindBeidouService();
|
|
701
|
-
promise.resolve(true);
|
|
702
|
-
} catch (Exception e) {
|
|
703
|
-
promise.reject("UNBIND_ERROR", "解绑北斗服务失败: " + e.getMessage());
|
|
704
|
-
}
|
|
755
|
+
beidouAidlHelper.unbindService(promise);
|
|
705
756
|
}
|
|
706
757
|
|
|
707
758
|
@ReactMethod
|
|
708
|
-
public void BDAuthenticate(Promise promise) {
|
|
709
|
-
|
|
710
|
-
promise.reject("SERVICE_NOT_BOUND", "北斗服务未绑定,请先调用bindBeidouServiceMethod");
|
|
711
|
-
return;
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
try {
|
|
715
|
-
boolean result = beidouService.BDAuthenticate();
|
|
716
|
-
promise.resolve(result);
|
|
717
|
-
} catch (Exception e) {
|
|
718
|
-
promise.reject("REMOTE_ERROR", "北斗鉴权失败: " + e.getMessage());
|
|
719
|
-
}
|
|
759
|
+
public void BDAuthenticate(int slotId, Promise promise) {
|
|
760
|
+
beidouAidlHelper.authenticate(slotId, promise);
|
|
720
761
|
}
|
|
721
762
|
|
|
722
763
|
@ReactMethod
|
|
723
|
-
public void getBDMsgStatus(Promise promise) {
|
|
724
|
-
|
|
725
|
-
promise.reject("SERVICE_NOT_BOUND", "北斗服务未绑定,请先调用bindBeidouServiceMethod");
|
|
726
|
-
return;
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
try {
|
|
730
|
-
BDStatusResponse response = beidouService.getBDMsgStatus();
|
|
731
|
-
WritableMap map = new WritableNativeMap();
|
|
732
|
-
map.putInt("code", response.code);
|
|
733
|
-
map.putString("statusMsg", response.statusMsg);
|
|
734
|
-
map.putInt("msgQuotaRemain", response.msgQuotaRemain);
|
|
735
|
-
promise.resolve(map);
|
|
736
|
-
} catch (Exception e) {
|
|
737
|
-
promise.reject("REMOTE_ERROR", "获取北斗状态失败: " + e.getMessage());
|
|
738
|
-
}
|
|
764
|
+
public void getBDMsgStatus(int slotId, Promise promise) {
|
|
765
|
+
beidouAidlHelper.getStatus(slotId, promise);
|
|
739
766
|
}
|
|
740
767
|
|
|
741
768
|
@ReactMethod
|
|
742
|
-
public void checkValidatedKey(Promise promise) {
|
|
743
|
-
|
|
744
|
-
promise.reject("SERVICE_NOT_BOUND", "北斗服务未绑定,请先调用bindBeidouServiceMethod");
|
|
745
|
-
return;
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
try {
|
|
749
|
-
int result = beidouService.checkValidatedKey();
|
|
750
|
-
promise.resolve(result);
|
|
751
|
-
} catch (Exception e) {
|
|
752
|
-
promise.reject("REMOTE_ERROR", "检查北斗密钥失败: " + e.getMessage());
|
|
753
|
-
}
|
|
769
|
+
public void checkValidatedKey(int slotId, Promise promise) {
|
|
770
|
+
beidouAidlHelper.checkValidatedKey(slotId, promise);
|
|
754
771
|
}
|
|
755
772
|
|
|
756
773
|
@ReactMethod
|
|
757
|
-
public void commonBDMsgEncrypt(ReadableArray receiveList, String inputMsg,
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
try {
|
|
764
|
-
List<String> receiveStringList = readableArrayToStringList(receiveList);
|
|
765
|
-
BDMsgEncryptResponse response = beidouService.commonBDMsgEncrypt(receiveStringList, inputMsg);
|
|
774
|
+
public void commonBDMsgEncrypt(int slotId, String speedType, @Nullable ReadableArray receiveList, String inputMsg,
|
|
775
|
+
Promise promise) {
|
|
776
|
+
beidouAidlHelper.commonBDMsgEncrypt(slotId, speedType, receiveList, inputMsg, promise);
|
|
777
|
+
}
|
|
766
778
|
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
map.putString("sendMobile", response.sendMobile);
|
|
772
|
-
promise.resolve(map);
|
|
773
|
-
} catch (Exception e) {
|
|
774
|
-
promise.reject("REMOTE_ERROR", "通用报文加密失败: " + e.getMessage());
|
|
775
|
-
}
|
|
779
|
+
@ReactMethod
|
|
780
|
+
public void positionBDMsgEncrypt(int slotId, String speedType, @Nullable ReadableArray receiveList, String inputMsg,
|
|
781
|
+
double longitude, double latitude, Promise promise) {
|
|
782
|
+
beidouAidlHelper.positionBDMsgEncrypt(slotId, speedType, receiveList, inputMsg, longitude, latitude, promise);
|
|
776
783
|
}
|
|
777
784
|
|
|
778
785
|
@ReactMethod
|
|
779
|
-
public void
|
|
786
|
+
public void commonEmergencyBDMsgEncrypt(int slotId, String speedType, @Nullable ReadableArray receiveList, String inputMsg,
|
|
780
787
|
Promise promise) {
|
|
781
|
-
|
|
782
|
-
promise.reject("SERVICE_NOT_BOUND", "北斗服务未绑定,请先调用bindBeidouServiceMethod");
|
|
783
|
-
return;
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
try {
|
|
787
|
-
List<String> receiveStringList = readableArrayToStringList(receiveList);
|
|
788
|
-
BDMsgEncryptResponse response = beidouService.positionBDMsgEncrypt(receiveStringList, inputMsg, longitude,
|
|
789
|
-
latitude);
|
|
790
|
-
|
|
791
|
-
WritableMap map = new WritableNativeMap();
|
|
792
|
-
map.putInt("code", response.code);
|
|
793
|
-
map.putString("statusMsg", response.statusMsg);
|
|
794
|
-
map.putArray("data", byteArrayToWritableArray(response.data));
|
|
795
|
-
map.putString("sendMobile", response.sendMobile);
|
|
796
|
-
promise.resolve(map);
|
|
797
|
-
} catch (Exception e) {
|
|
798
|
-
promise.reject("REMOTE_ERROR", "位置报文加密失败: " + e.getMessage());
|
|
799
|
-
}
|
|
788
|
+
beidouAidlHelper.commonEmergencyBDMsgEncrypt(slotId, speedType, receiveList, inputMsg, promise);
|
|
800
789
|
}
|
|
801
790
|
|
|
802
791
|
@ReactMethod
|
|
803
|
-
public void
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
}
|
|
792
|
+
public void positionEmergencyBDMsgEncrypt(int slotId, String speedType, @Nullable ReadableArray receiveList, String inputMsg,
|
|
793
|
+
double longitude, double latitude, Promise promise) {
|
|
794
|
+
beidouAidlHelper.positionEmergencyBDMsgEncrypt(slotId, speedType, receiveList, inputMsg, longitude, latitude, promise);
|
|
795
|
+
}
|
|
808
796
|
|
|
809
|
-
|
|
810
|
-
|
|
797
|
+
@ReactMethod
|
|
798
|
+
public void commonRichMediaBDMsgEncrypt(int slotId, String speedType, @Nullable ReadableArray receiveList, String msgType,
|
|
799
|
+
@Nullable ReadableArray inputRichMediaData, Promise promise) {
|
|
800
|
+
beidouAidlHelper.commonRichMediaBDMsgEncrypt(slotId, speedType, receiveList, msgType, inputRichMediaData, promise);
|
|
801
|
+
}
|
|
811
802
|
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
promise.resolve(map);
|
|
818
|
-
} catch (Exception e) {
|
|
819
|
-
promise.reject("REMOTE_ERROR", "信箱查询加密失败: " + e.getMessage());
|
|
820
|
-
}
|
|
803
|
+
@ReactMethod
|
|
804
|
+
public void positionRichMediaBDMsgEncrypt(int slotId, String speedType, @Nullable ReadableArray receiveList, String msgType,
|
|
805
|
+
@Nullable ReadableArray inputRichMediaData, double longitude, double latitude, Promise promise) {
|
|
806
|
+
beidouAidlHelper.positionRichMediaBDMsgEncrypt(slotId, speedType, receiveList, msgType, inputRichMediaData, longitude,
|
|
807
|
+
latitude, promise);
|
|
821
808
|
}
|
|
822
809
|
|
|
823
810
|
@ReactMethod
|
|
824
|
-
public void
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
811
|
+
public void commonRichMediaAndTextBDMsgEncrypt(int slotId, String speedType, @Nullable ReadableArray receiveList, String text,
|
|
812
|
+
String msgType, @Nullable ReadableArray inputRichMediaData, Promise promise) {
|
|
813
|
+
beidouAidlHelper.commonRichMediaAndTextBDMsgEncrypt(slotId, speedType, receiveList, text, msgType, inputRichMediaData,
|
|
814
|
+
promise);
|
|
815
|
+
}
|
|
829
816
|
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
817
|
+
@ReactMethod
|
|
818
|
+
public void positionRichMediaAndTextBDMsgEncrypt(int slotId, String speedType, @Nullable ReadableArray receiveList, String text,
|
|
819
|
+
String msgType, @Nullable ReadableArray inputRichMediaData, double longitude, double latitude, Promise promise) {
|
|
820
|
+
beidouAidlHelper.positionRichMediaAndTextBDMsgEncrypt(slotId, speedType, receiveList, text, msgType, inputRichMediaData,
|
|
821
|
+
longitude, latitude, promise);
|
|
822
|
+
}
|
|
833
823
|
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
map.putString("rcvMobile", response.rcvMobile);
|
|
838
|
-
map.putString("data", response.data);
|
|
839
|
-
promise.resolve(map);
|
|
840
|
-
} catch (Exception e) {
|
|
841
|
-
promise.reject("REMOTE_ERROR", "报文解密失败: " + e.getMessage());
|
|
842
|
-
}
|
|
824
|
+
@ReactMethod
|
|
825
|
+
public void BDMailboxQueryEncrypt(int slotId, Promise promise) {
|
|
826
|
+
beidouAidlHelper.mailboxQueryEncrypt(slotId, promise);
|
|
843
827
|
}
|
|
844
828
|
|
|
845
829
|
@ReactMethod
|
|
846
|
-
public void
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
return;
|
|
850
|
-
}
|
|
830
|
+
public void EmergencyBDMailboxQueryEncrypt(int slotId, String replyMobile, Promise promise) {
|
|
831
|
+
beidouAidlHelper.emergencyMailboxQueryEncrypt(slotId, replyMobile, promise);
|
|
832
|
+
}
|
|
851
833
|
|
|
852
|
-
|
|
853
|
-
|
|
834
|
+
@ReactMethod
|
|
835
|
+
public void BDMsgDecrypt(int slotId, @Nullable ReadableArray msg, int len, Promise promise) {
|
|
836
|
+
beidouAidlHelper.decryptMessage(slotId, msg, len, promise);
|
|
837
|
+
}
|
|
854
838
|
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
map.putArray("ephemerisZipFile", byteArrayToWritableArray(response.ephemerisZipFile));
|
|
859
|
-
map.putString("version", response.version);
|
|
860
|
-
promise.resolve(map);
|
|
861
|
-
} catch (Exception e) {
|
|
862
|
-
promise.reject("REMOTE_ERROR", "下载星历文件失败: " + e.getMessage());
|
|
863
|
-
}
|
|
839
|
+
@ReactMethod
|
|
840
|
+
public void DLEphemerisFile(int slotId, String type, String version, Promise promise) {
|
|
841
|
+
beidouAidlHelper.downloadEphemerisFile(slotId, type, version, promise);
|
|
864
842
|
}
|
|
865
843
|
|
|
866
844
|
// 设置BLE密钥
|