Skip to content

chore: add README.OpenSource and OAT.XML and COMMITTERS.md #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions COMMITTERS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Committers列表

### 以下是此项目的committer人员

不区分先后顺序

- [MaDiXin](https://gitee.com/MaDiXin)
- [xiafeng_xf_admin](https://gitee.com/xiafeng_xf_admin)
- [ChenLixi](https://gitee.com/Louis-C7)
- [LinJiacheng](https://gitee.com/LLLLLLin)
- [ZhengJinshou](https://gitee.com/longziz)
85 changes: 85 additions & 0 deletions OAT.XML
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<oatconfig>
<licensefile>LICENSE</licensefile>
<policylist>
<policy name="projectPolicy" desc="">
<policyitem type="license" name="MIT" path=".*" desc="license under the MIT"/>
</policy>
<policy name="projectPolicy" desc="">
<policyitem type="compatibility" name="GPL-2.0+" path=".*" desc="Process that runs independently, invoked by the X process."/>
<policyitem type="compatibility" name="Apache-2.0" path=".*" desc="不影响兼容性"/>
<policyitem type="compatibility" name="BSDStyleLicense" path=".*" desc="不影响兼容性" />
<policyitem type="compatibility" name="MIT" path=".*" desc="不影响兼容性" />
<policyitem type="compatibility" name="GPLStyleLicense" path=".*" desc="不影响兼容性" />
</policy>
</policylist>
<filefilterlist>
<filefilter name="copyrightPolicyFilter" desc="Filters for compatibility,license header policies">
<filteritem type="filename" name="*.json5" desc="hvigor配置文件,DevEco Studio自动生成,不手动修改"/>
<filteritem type="filename" name="*/*.json5" desc="hvigor配置文件,DevEco Studio自动生成,不手动修改"/>
<filteritem type="filename" name="LICENSE" desc="版权文件,不添加版权头"/>
<filteritem type="filepath" name="hvigorw" desc="工程模板,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="hvigorw.bat" desc="工程模板,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="js/*.js" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="js/*.ts" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="src/*.js" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="src/*.ts" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="*.js" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="*.ts" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="index.*" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="hvigor/hvigor-wrapper.js" desc="工程模板,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="hvigor/hvigor-config.json5" desc="工程模板,不修改版权头,以防有修改版权风险"/>
<filteritem type="filename" name="LICENSE" desc="版权文件,不添加版权头"/>
<filteritem type="filename" name="hvigorw" desc="工程模板,不修改版权头,以防有修改版权风险"/>
<filteritem type="filename" name="hvigorw.bat" desc="工程模板,不修改版权头,以防有修改版权风险"/>
<filteritem type="filename" name=".npmrc" desc="项目配置文件,不添加版权头"/>
<filteritem type="filename" name="*.json5" desc="示例工程配置文件,非业务代码,不添加许可证头"/>
<filteritem type="filepath" name="docs/.*" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
<filteritem type="filename" name=".npmignore" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
<filteritem type="filename" name="yarn.lock" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
<filteritem type="filename" name="OAT.XML" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="harmony/ble_manager/hvigorfile.ts" desc="工程模板,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="react-native-ble-manager.podspec" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="src/index.ts" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="harmony/ble_manager/BuildProfile.ets" desc="工程模板,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="src/types.ts" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
</filefilter>
<filefilter name="defaultPolicyFilter" desc="Filters for compatibility,license header policies">
<filteritem type="filename" name="*.json5" desc="hvigor配置文件,DevEco Studio自动生成,不手动修改"/>
<filteritem type="filename" name="*/*.json5" desc="hvigor配置文件,DevEco Studio自动生成,不手动修改"/>
<filteritem type="filename" name="LICENSE" desc="版权文件,不添加版权头"/>
<filteritem type="filepath" name="hvigorw" desc="工程模板,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="hvigorw.bat" desc="工程模板,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="js/*.js" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="js/*.ts" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="src/*.js" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="src/*.ts" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="*.js" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="*.ts" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="index.*" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="hvigor/hvigor-wrapper.js" desc="工程模板,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="hvigor/hvigor-config.json5" desc="工程模板,不修改版权头,以防有修改版权风险"/>
<filteritem type="filename" name="LICENSE" desc="版权文件,不添加版权头"/>
<filteritem type="filename" name="hvigorw" desc="工程模板,不修改版权头,以防有修改版权风险"/>
<filteritem type="filename" name="hvigorw.bat" desc="工程模板,不修改版权头,以防有修改版权风险"/>
<filteritem type="filename" name=".npmrc" desc="项目配置文件,不添加版权头"/>
<filteritem type="filename" name="*.json5" desc="示例工程配置文件,非业务代码,不添加许可证头"/>
<filteritem type="filepath" name="docs/.*" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
<filteritem type="filename" name=".npmignore" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
<filteritem type="filename" name="yarn.lock" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
<filteritem type="filename" name="OAT.XML" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="harmony/ble_manager/hvigorfile.ts" desc="工程模板,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="react-native-ble-manager.podspec" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="src/index.ts" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="harmony/ble_manager/BuildProfile.ets" desc="工程模板,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="src/types.ts" desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"/>
</filefilter>
<filefilter name="binaryFileTypePolicyFilter" desc="Filters for copyright header policies">
<filteritem type="filepath" name="harmony/ble_managerGatt.har" desc="项目打包文件" />
<filteritem type="filepath" name="harmony/ble_managerServers.har" desc="项目打包文件" />
<filteritem type="filepath" name="harmony/ble_manager/src/main/ets.zip" desc="项目打包文件" />
</filefilter>
</filefilterlist>
</oatconfig>
</configuration>
11 changes: 11 additions & 0 deletions README.OpenSource
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"Name": "react-native-ble-manager",
"License": "Apache License",
"License File": "https://github.com/innoveit/react-native-ble-manager/blob/master/LICENSE",
"Version Number": "11.5.2",
"Owner" : "xiafeng@huawei.com",
"Upstream URL": "https://github.com/innoveit/react-native-ble-manager",
"Description": "A BLE module for react native."
}
]
6 changes: 6 additions & 0 deletions harmony/ble_manager/index.ets
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
* Use of this source code is governed by a MIT license that can be
* found in the LICENSE file.
*/

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

import hilog from '@ohos.hilog';
Expand Down
6 changes: 6 additions & 0 deletions harmony/ble_manager/src/main/ets/BlePackage.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
* Use of this source code is governed by a MIT license that can be
* found in the LICENSE file.
*/

import { RNPackage, TurboModulesFactory } from '@rnoh/react-native-openharmony/ts';
import type {
TurboModule,
Expand Down
6 changes: 6 additions & 0 deletions harmony/ble_manager/src/main/ets/BleTurboModule.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
* Use of this source code is governed by a MIT license that can be
* found in the LICENSE file.
*/

import { TurboModule, RNOHContext, RNOHLogger } from '@rnoh/react-native-openharmony/ts';
import { TM } from "@rnoh/react-native-openharmony/generated/ts"
import access from '@ohos.bluetooth.access';
Expand Down
6 changes: 6 additions & 0 deletions harmony/ble_manager/src/main/ets/DefaultScanManager.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
* Use of this source code is governed by a MIT license that can be
* found in the LICENSE file.
*/

import { BleTurboModule, TurboModuleContext } from './BleTurboModule';
import { BleScanMode, ScanOptions, BleScanMatchMode, BleStopScanEvent } from './types';
import ble from '@ohos.bluetooth.ble';
Expand Down
6 changes: 6 additions & 0 deletions harmony/ble_manager/src/main/ets/PeripheralData.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
* Use of this source code is governed by a MIT license that can be
* found in the LICENSE file.
*/

import ble from '@ohos.bluetooth.ble';
import { JSON, util } from '@kit.ArkTS';
import constant from '@ohos.bluetooth.constant';
Expand Down
6 changes: 6 additions & 0 deletions harmony/ble_manager/src/main/ets/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
* Use of this source code is governed by a MIT license that can be
* found in the LICENSE file.
*/

export type StartOptions = {
showAlert?: boolean,
restoreIdentifierKey?: string,
Expand Down
6 changes: 6 additions & 0 deletions harmony/ble_manager/src/main/ets/utils/Util.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
* Use of this source code is governed by a MIT license that can be
* found in the LICENSE file.
*/

import { buffer, util } from '@kit.ArkTS';

class Utils {
Expand Down
6 changes: 6 additions & 0 deletions harmony/ble_manager/ts.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
* Use of this source code is governed by a MIT license that can be
* found in the LICENSE file.
*/

export * from "./src/main/ets/BlePackage"
export * from "./src/main/ets/BleTurboModule"
98 changes: 98 additions & 0 deletions src/NativeGeneratedBleManagerTurboModule.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
* Use of this source code is governed by a MIT license that can be
* found in the LICENSE file.
*/

import { TurboModuleRegistry,NativeModule } from 'react-native';
import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport';

import { BleState, Peripheral, PeripheralInfo } from "./types";

export interface CompanionScanOptions {
single?: boolean;
}

export interface ScanOptions {
numberOfMatches?: Object;
matchMode?: Object;
callbackType?: Object;
scanMode?: Object;
reportDelay?: number;
phy?: Object;
legacy?: boolean;
exactAdvertisingName?: string | string[];
manufacturerData?: {
manufacturerId: number;
manufacturerData?: number[];
manufacturerDataMask?: number[];
}
single?: boolean;
companion?: boolean;
}

export interface StartOptions {
showAlert?: boolean;
restoreIdentifierKey?: string;
queueIdentifierKey?: string;
forceLegacy?: boolean;
}

export enum BleScanPhyMode {
LE_1M = 1,
LE_2M = 2,
LE_CODED = 3,
ALL_SUPPORTED = 255,
}

export enum ConnectionPriority {
balanced = 0,
high = 1,
low = 2,
}

export interface ConnectOptions {
autoconnect?: boolean;
phy?: BleScanPhyMode;
}

export interface Spec extends TurboModule {
read(peripheralId: string, serviceUUID: string, characteristicUUID: string): Promise<number[]>;
readDescriptor(peripheralId: string, serviceUUID: string, characteristicUUID: string, descriptorUUID: string): Promise<number[]>;
writeDescriptor(peripheralId: string, serviceUUID: string, characteristicUUID: string, descriptorUUID: string, data: number[]): Promise<void>;
readRSSI(peripheralId: string): Promise<number>;
retrieveServices(peripheralId: string, serviceUUIDs?: string[]): Promise<PeripheralInfo>;
write(peripheralId: string, serviceUUID: string, characteristicUUID: string, data: number[], maxByteSize?: number): Promise<void>;
connect(peripheralId: string, options?: ConnectOptions): Promise<void>;
createBond(peripheralId: string, peripheralPin?: string | null): Promise<void>;
removeBond(peripheralId: string): Promise<void>;
disconnect(peripheralId: string, force?: boolean): Promise<void>;
startNotification(peripheralId: string, serviceUUID: string, characteristicUUID: string): Promise<void>;
checkState(): Promise<BleState>;
start(options?: StartOptions): Promise<void>;
scan(serviceUUIDs: string[], seconds: number, allowDuplicates?: boolean, scanningOptions?: ScanOptions): Promise<void>;
stopScan(): Promise<void>;
enableBluetooth(): Promise<void>;
getConnectedPeripherals(serviceUUIDs?: string[]): Promise<Peripheral[]>;
getBondedPeripherals(): Promise<Peripheral[]>;
getDiscoveredPeripherals(): Promise<Peripheral[]>;
requestMTU(peripheralId: string, mtu: number): Promise<number>;
removePeripheral(peripheralId: string): Promise<void>;
isScanning(): Promise<boolean>;
isPeripheralConnected(peripheralId: string, serviceUUIDs?: string[]): Promise<boolean>;
refreshCache(peripheralId: string): Promise<boolean>;
writeWithoutResponse(peripheralId: string, serviceUUID: string, characteristicUUID: string, data: number[], maxByteSize?: number, queueSleepTime?: number): Promise<void>;
startNotificationUseBuffer(peripheralId: string, serviceUUID: string, characteristicUUID: string, buffer: number): Promise<void>;
stopNotification(peripheralId: string, serviceUUID: string, characteristicUUID: string): Promise<void>;
requestConnectionPriority(peripheralId: string, connectionPriority: ConnectionPriority): Promise<boolean>;
getAssociatedPeripherals(): Promise<Peripheral[]>;
removeAssociatedPeripheral(peripheralId: string): Promise<void>;
supportsCompanion(): Promise<boolean>;
companionScan(serviceUUIDs: string[], options?: CompanionScanOptions): Promise<Peripheral | null>;
setName(name: string): void;
getMaximumWriteValueLengthForWithoutResponse(peripheralId: string): Promise<number>;
getMaximumWriteValueLengthForWithResponse(peripheralId: string): Promise<number>;
}


export default TurboModuleRegistry.get<Spec>('ReactNativeBleManager')!;
Loading