1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef OHOS_DEVICE_MANAGER_FFI_H 16 #define OHOS_DEVICE_MANAGER_FFI_H 17 18 #include "cj_common_ffi.h" 19 #include "ffi_remote_data.h" 20 21 extern "C" { 22 typedef struct { 23 char *deviceId; 24 char *deviceName; 25 uint16_t deviceType; 26 char *networkId; 27 } FfiDeviceBasicInfo; 28 29 typedef struct { 30 FfiDeviceBasicInfo *head; 31 int64_t size; 32 } FfiDeviceBasicInfoArray; 33 34 FFI_EXPORT int64_t FfiOHOSDistributedDeviceManagerCreateDeviceManager(const char *name, int32_t *errCode); 35 36 FFI_EXPORT void FfiOHOSDistributedDeviceManagerReleaseDeviceManager(int64_t id, int32_t *errCode); 37 38 FFI_EXPORT void FfiOHOSDistributedDeviceManagerGetAvailableDeviceList( 39 int64_t id, FfiDeviceBasicInfoArray *deviceInfoList, int32_t *errCode); 40 41 FFI_EXPORT void FfiOHOSDistributedDeviceManagerFreeDeviceInfoList(FfiDeviceBasicInfoArray deviceInfoList); 42 43 FFI_EXPORT const char *FfiOHOSDistributedDeviceManagerGetLocalDeviceNetworkId(int64_t id, int32_t *errCode); 44 45 FFI_EXPORT const char *FfiOHOSDistributedDeviceManagerGetLocalDeviceName(int64_t id, int32_t *errCode); 46 47 FFI_EXPORT int32_t FfiOHOSDistributedDeviceManagerGetLocalDeviceType(int64_t id, int32_t *errCode); 48 49 FFI_EXPORT const char *FfiOHOSDistributedDeviceManagerGetLocalDeviceId(int64_t id, int32_t *errCode); 50 51 FFI_EXPORT const char *FfiOHOSDistributedDeviceManagerGetDeviceName( 52 int64_t id, const char *networkId, int32_t *errCode); 53 54 FFI_EXPORT int32_t FfiOHOSDistributedDeviceManagerGetDeviceType(int64_t id, const char *networkId, int32_t *errCode); 55 56 FFI_EXPORT void FfiOHOSDistributedDeviceManagerStartDiscovering(int64_t id, const char *extra, int32_t *errCode); 57 58 FFI_EXPORT void FfiOHOSDistributedDeviceManagerStopDiscovering(int64_t id, int32_t *errCode); 59 60 FFI_EXPORT void FfiOHOSDistributedDeviceManagerBindTarget(int64_t id, const char *deviceId, const char *bindParam, 61 bool isMetaType, int32_t *errCode); 62 63 FFI_EXPORT void FfiOHOSDistributedDeviceManagerUnbindTarget(int64_t id, const char *deviceId, int32_t *errCode); 64 65 FFI_EXPORT void FfiOHOSDistributedDeviceManagerOn(int64_t id, const char *type, void *callback, int32_t *errCode); 66 67 FFI_EXPORT void FfiOHOSDistributedDeviceManagerOff(int64_t id, const char *type, int32_t *errCode); 68 } 69 70 #endif // OHOS_DEVICE_MANAGER_FFI_H 71