Skip to content

Commit 8c4fc53

Browse files
authored
chore: add README.OpenSource and OAT.XML and COMMITTERS.md (#42)
1 parent 6e0c114 commit 8c4fc53

14 files changed

+619
-480
lines changed

COMMITTERS.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Committers列表
2+
3+
### 以下是此项目的committer人员
4+
5+
不区分先后顺序
6+
7+
- [MaDiXin](https://gitee.com/MaDiXin)
8+
- [xiafeng_xf_admin](https://gitee.com/xiafeng_xf_admin)
9+
- [ChenLixi](https://gitee.com/Louis-C7)
10+
- [LinJiacheng](https://gitee.com/LLLLLLin)
11+
- [ZhengJinshou](https://gitee.com/longziz)

OAT.XML

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<configuration>
3+
<oatconfig>
4+
<licensefile>LICENSE</licensefile>
5+
<policylist>
6+
<policy name="projectPolicy" desc="">
7+
<policyitem type="license" name="MIT" path=".*" desc="license under the MIT"/>
8+
</policy>
9+
<policy name="projectPolicy" desc="">
10+
<policyitem type="compatibility" name="GPL-2.0+" path=".*" desc="Process that runs independently, invoked by the X process."/>
11+
<policyitem type="compatibility" name="Apache-2.0" path=".*" desc="不影响兼容性"/>
12+
<policyitem type="compatibility" name="BSDStyleLicense" path=".*" desc="不影响兼容性" />
13+
<policyitem type="compatibility" name="MIT" path=".*" desc="不影响兼容性" />
14+
<policyitem type="compatibility" name="GPLStyleLicense" path=".*" desc="不影响兼容性" />
15+
</policy>
16+
</policylist>
17+
<filefilterlist>
18+
<filefilter name="copyrightPolicyFilter" desc="Filters for compatibility,license header policies">
19+
<filteritem type="filename" name="*.json5" desc="hvigor配置文件,DevEco Studio自动生成,不手动修改"/>
20+
<filteritem type="filename" name="*/*.json5" desc="hvigor配置文件,DevEco Studio自动生成,不手动修改"/>
21+
<filteritem type="filename" name="LICENSE" desc="版权文件,不添加版权头"/>
22+
<filteritem type="filepath" name="hvigorw" desc="工程模板,不修改版权头,以防有修改版权风险"/>
23+
<filteritem type="filepath" name="hvigorw.bat" desc="工程模板,不修改版权头,以防有修改版权风险"/>
24+
<filteritem type="filepath" name="js/*.js" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
25+
<filteritem type="filepath" name="js/*.ts" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
26+
<filteritem type="filepath" name="src/*.js" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
27+
<filteritem type="filepath" name="src/*.ts" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
28+
<filteritem type="filepath" name="*.js" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
29+
<filteritem type="filepath" name="*.ts" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
30+
<filteritem type="filepath" name="index.*" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
31+
<filteritem type="filepath" name="hvigor/hvigor-wrapper.js" desc="工程模板,不修改版权头,以防有修改版权风险"/>
32+
<filteritem type="filepath" name="hvigor/hvigor-config.json5" desc="工程模板,不修改版权头,以防有修改版权风险"/>
33+
<filteritem type="filename" name="LICENSE" desc="版权文件,不添加版权头"/>
34+
<filteritem type="filename" name="hvigorw" desc="工程模板,不修改版权头,以防有修改版权风险"/>
35+
<filteritem type="filename" name="hvigorw.bat" desc="工程模板,不修改版权头,以防有修改版权风险"/>
36+
<filteritem type="filename" name=".npmrc" desc="项目配置文件,不添加版权头"/>
37+
<filteritem type="filename" name="*.json5" desc="示例工程配置文件,非业务代码,不添加许可证头"/>
38+
<filteritem type="filepath" name="docs/.*" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
39+
<filteritem type="filename" name=".npmignore" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
40+
<filteritem type="filename" name="yarn.lock" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
41+
<filteritem type="filename" name="OAT.XML" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
42+
<filteritem type="filepath" name="harmony/ble_manager/hvigorfile.ts" desc="工程模板,不修改版权头,以防有修改版权风险"/>
43+
<filteritem type="filepath" name="react-native-ble-manager.podspec" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
44+
<filteritem type="filepath" name="src/index.ts" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
45+
<filteritem type="filepath" name="harmony/ble_manager/BuildProfile.ets" desc="工程模板,不修改版权头,以防有修改版权风险"/>
46+
<filteritem type="filepath" name="src/types.ts" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
47+
</filefilter>
48+
<filefilter name="defaultPolicyFilter" desc="Filters for compatibility,license header policies">
49+
<filteritem type="filename" name="*.json5" desc="hvigor配置文件,DevEco Studio自动生成,不手动修改"/>
50+
<filteritem type="filename" name="*/*.json5" desc="hvigor配置文件,DevEco Studio自动生成,不手动修改"/>
51+
<filteritem type="filename" name="LICENSE" desc="版权文件,不添加版权头"/>
52+
<filteritem type="filepath" name="hvigorw" desc="工程模板,不修改版权头,以防有修改版权风险"/>
53+
<filteritem type="filepath" name="hvigorw.bat" desc="工程模板,不修改版权头,以防有修改版权风险"/>
54+
<filteritem type="filepath" name="js/*.js" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
55+
<filteritem type="filepath" name="js/*.ts" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
56+
<filteritem type="filepath" name="src/*.js" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
57+
<filteritem type="filepath" name="src/*.ts" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
58+
<filteritem type="filepath" name="*.js" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
59+
<filteritem type="filepath" name="*.ts" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
60+
<filteritem type="filepath" name="index.*" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
61+
<filteritem type="filepath" name="hvigor/hvigor-wrapper.js" desc="工程模板,不修改版权头,以防有修改版权风险"/>
62+
<filteritem type="filepath" name="hvigor/hvigor-config.json5" desc="工程模板,不修改版权头,以防有修改版权风险"/>
63+
<filteritem type="filename" name="LICENSE" desc="版权文件,不添加版权头"/>
64+
<filteritem type="filename" name="hvigorw" desc="工程模板,不修改版权头,以防有修改版权风险"/>
65+
<filteritem type="filename" name="hvigorw.bat" desc="工程模板,不修改版权头,以防有修改版权风险"/>
66+
<filteritem type="filename" name=".npmrc" desc="项目配置文件,不添加版权头"/>
67+
<filteritem type="filename" name="*.json5" desc="示例工程配置文件,非业务代码,不添加许可证头"/>
68+
<filteritem type="filepath" name="docs/.*" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
69+
<filteritem type="filename" name=".npmignore" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
70+
<filteritem type="filename" name="yarn.lock" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
71+
<filteritem type="filename" name="OAT.XML" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
72+
<filteritem type="filepath" name="harmony/ble_manager/hvigorfile.ts" desc="工程模板,不修改版权头,以防有修改版权风险"/>
73+
<filteritem type="filepath" name="react-native-ble-manager.podspec" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
74+
<filteritem type="filepath" name="src/index.ts" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
75+
<filteritem type="filepath" name="harmony/ble_manager/BuildProfile.ets" desc="工程模板,不修改版权头,以防有修改版权风险"/>
76+
<filteritem type="filepath" name="src/types.ts" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
77+
</filefilter>
78+
<filefilter name="binaryFileTypePolicyFilter" desc="Filters for copyright header policies">
79+
<filteritem type="filepath" name="harmony/ble_managerGatt.har" desc="项目打包文件" />
80+
<filteritem type="filepath" name="harmony/ble_managerServers.har" desc="项目打包文件" />
81+
<filteritem type="filepath" name="harmony/ble_manager/src/main/ets.zip" desc="项目打包文件" />
82+
</filefilter>
83+
</filefilterlist>
84+
</oatconfig>
85+
</configuration>

README.OpenSource

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[
2+
{
3+
"Name": "react-native-ble-manager",
4+
"License": "Apache License",
5+
"License File": "https://github.com/innoveit/react-native-ble-manager/blob/master/LICENSE",
6+
"Version Number": "11.5.2",
7+
"Owner" : "xiafeng@huawei.com",
8+
"Upstream URL": "https://github.com/innoveit/react-native-ble-manager",
9+
"Description": "A BLE module for react native."
10+
}
11+
]

harmony/ble_manager/index.ets

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1+
/*
2+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
3+
* Use of this source code is governed by a MIT license that can be
4+
* found in the LICENSE file.
5+
*/
6+
17
export * from './ts'

harmony/ble_manager/src/main/ets/BleManagerLogger.ts

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,7 @@
1-
/**
2-
* MIT License
3-
*
4-
* Copyright (C) 2024 Huawei Device Co., Ltd.
5-
*
6-
* Permission is hereby granted, free of charge, to any person obtaining a copy
7-
* of this software and associated documentation files (the "Software"), to deal
8-
* in the Software without restriction, including without limitation the rights
9-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10-
* copies of the Software, and to permit persons to whom the Software is
11-
* furnished to do so, subject to the following conditions:
12-
*
13-
* The above copyright notice and this permission notice shall be included in all
14-
* copies or substantial portions of the Software.
15-
*
16-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22-
* SOFTWARE.
1+
/*
2+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
3+
* Use of this source code is governed by a MIT license that can be
4+
* found in the LICENSE file.
235
*/
246

257
import hilog from '@ohos.hilog';

harmony/ble_manager/src/main/ets/BlePackage.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/*
2+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
3+
* Use of this source code is governed by a MIT license that can be
4+
* found in the LICENSE file.
5+
*/
6+
17
import { RNPackage, TurboModulesFactory } from '@rnoh/react-native-openharmony/ts';
28
import type {
39
TurboModule,

harmony/ble_manager/src/main/ets/BleTurboModule.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/*
2+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
3+
* Use of this source code is governed by a MIT license that can be
4+
* found in the LICENSE file.
5+
*/
6+
17
import { TurboModule, RNOHContext, RNOHLogger } from '@rnoh/react-native-openharmony/ts';
28
import { TM } from "@rnoh/react-native-openharmony/generated/ts"
39
import access from '@ohos.bluetooth.access';

harmony/ble_manager/src/main/ets/DefaultScanManager.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/*
2+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
3+
* Use of this source code is governed by a MIT license that can be
4+
* found in the LICENSE file.
5+
*/
6+
17
import { BleTurboModule, TurboModuleContext } from './BleTurboModule';
28
import { BleScanMode, ScanOptions, BleScanMatchMode, BleStopScanEvent } from './types';
39
import ble from '@ohos.bluetooth.ble';

harmony/ble_manager/src/main/ets/PeripheralData.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/*
2+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
3+
* Use of this source code is governed by a MIT license that can be
4+
* found in the LICENSE file.
5+
*/
6+
17
import ble from '@ohos.bluetooth.ble';
28
import { JSON, util } from '@kit.ArkTS';
39
import constant from '@ohos.bluetooth.constant';

harmony/ble_manager/src/main/ets/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/*
2+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
3+
* Use of this source code is governed by a MIT license that can be
4+
* found in the LICENSE file.
5+
*/
6+
17
export type StartOptions = {
28
showAlert?: boolean,
39
restoreIdentifierKey?: string,

harmony/ble_manager/src/main/ets/utils/Util.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/*
2+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
3+
* Use of this source code is governed by a MIT license that can be
4+
* found in the LICENSE file.
5+
*/
6+
17
import { buffer, util } from '@kit.ArkTS';
28

39
class Utils {

harmony/ble_manager/ts.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
1+
/*
2+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
3+
* Use of this source code is governed by a MIT license that can be
4+
* found in the LICENSE file.
5+
*/
6+
17
export * from "./src/main/ets/BlePackage"
28
export * from "./src/main/ets/BleTurboModule"
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/*
2+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
3+
* Use of this source code is governed by a MIT license that can be
4+
* found in the LICENSE file.
5+
*/
6+
7+
import { TurboModuleRegistry,NativeModule } from 'react-native';
8+
import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport';
9+
10+
import { BleState, Peripheral, PeripheralInfo } from "./types";
11+
12+
export interface CompanionScanOptions {
13+
single?: boolean;
14+
}
15+
16+
export interface ScanOptions {
17+
numberOfMatches?: Object;
18+
matchMode?: Object;
19+
callbackType?: Object;
20+
scanMode?: Object;
21+
reportDelay?: number;
22+
phy?: Object;
23+
legacy?: boolean;
24+
exactAdvertisingName?: string | string[];
25+
manufacturerData?: {
26+
manufacturerId: number;
27+
manufacturerData?: number[];
28+
manufacturerDataMask?: number[];
29+
}
30+
single?: boolean;
31+
companion?: boolean;
32+
}
33+
34+
export interface StartOptions {
35+
showAlert?: boolean;
36+
restoreIdentifierKey?: string;
37+
queueIdentifierKey?: string;
38+
forceLegacy?: boolean;
39+
}
40+
41+
export enum BleScanPhyMode {
42+
LE_1M = 1,
43+
LE_2M = 2,
44+
LE_CODED = 3,
45+
ALL_SUPPORTED = 255,
46+
}
47+
48+
export enum ConnectionPriority {
49+
balanced = 0,
50+
high = 1,
51+
low = 2,
52+
}
53+
54+
export interface ConnectOptions {
55+
autoconnect?: boolean;
56+
phy?: BleScanPhyMode;
57+
}
58+
59+
export interface Spec extends TurboModule {
60+
read(peripheralId: string, serviceUUID: string, characteristicUUID: string): Promise<number[]>;
61+
readDescriptor(peripheralId: string, serviceUUID: string, characteristicUUID: string, descriptorUUID: string): Promise<number[]>;
62+
writeDescriptor(peripheralId: string, serviceUUID: string, characteristicUUID: string, descriptorUUID: string, data: number[]): Promise<void>;
63+
readRSSI(peripheralId: string): Promise<number>;
64+
retrieveServices(peripheralId: string, serviceUUIDs?: string[]): Promise<PeripheralInfo>;
65+
write(peripheralId: string, serviceUUID: string, characteristicUUID: string, data: number[], maxByteSize?: number): Promise<void>;
66+
connect(peripheralId: string, options?: ConnectOptions): Promise<void>;
67+
createBond(peripheralId: string, peripheralPin?: string | null): Promise<void>;
68+
removeBond(peripheralId: string): Promise<void>;
69+
disconnect(peripheralId: string, force?: boolean): Promise<void>;
70+
startNotification(peripheralId: string, serviceUUID: string, characteristicUUID: string): Promise<void>;
71+
checkState(): Promise<BleState>;
72+
start(options?: StartOptions): Promise<void>;
73+
scan(serviceUUIDs: string[], seconds: number, allowDuplicates?: boolean, scanningOptions?: ScanOptions): Promise<void>;
74+
stopScan(): Promise<void>;
75+
enableBluetooth(): Promise<void>;
76+
getConnectedPeripherals(serviceUUIDs?: string[]): Promise<Peripheral[]>;
77+
getBondedPeripherals(): Promise<Peripheral[]>;
78+
getDiscoveredPeripherals(): Promise<Peripheral[]>;
79+
requestMTU(peripheralId: string, mtu: number): Promise<number>;
80+
removePeripheral(peripheralId: string): Promise<void>;
81+
isScanning(): Promise<boolean>;
82+
isPeripheralConnected(peripheralId: string, serviceUUIDs?: string[]): Promise<boolean>;
83+
refreshCache(peripheralId: string): Promise<boolean>;
84+
writeWithoutResponse(peripheralId: string, serviceUUID: string, characteristicUUID: string, data: number[], maxByteSize?: number, queueSleepTime?: number): Promise<void>;
85+
startNotificationUseBuffer(peripheralId: string, serviceUUID: string, characteristicUUID: string, buffer: number): Promise<void>;
86+
stopNotification(peripheralId: string, serviceUUID: string, characteristicUUID: string): Promise<void>;
87+
requestConnectionPriority(peripheralId: string, connectionPriority: ConnectionPriority): Promise<boolean>;
88+
getAssociatedPeripherals(): Promise<Peripheral[]>;
89+
removeAssociatedPeripheral(peripheralId: string): Promise<void>;
90+
supportsCompanion(): Promise<boolean>;
91+
companionScan(serviceUUIDs: string[], options?: CompanionScanOptions): Promise<Peripheral | null>;
92+
setName(name: string): void;
93+
getMaximumWriteValueLengthForWithoutResponse(peripheralId: string): Promise<number>;
94+
getMaximumWriteValueLengthForWithResponse(peripheralId: string): Promise<number>;
95+
}
96+
97+
98+
export default TurboModuleRegistry.get<Spec>('ReactNativeBleManager')!;

0 commit comments

Comments
 (0)