1 /* 2 * Copyright (c) 2025 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 PROXY_CHANNEL_BR_CONNECTION_H 16 #define PROXY_CHANNEL_BR_CONNECTION_H 17 18 #include "proxy_manager.h" 19 20 #define BR_INVALID_SOCKET_HANDLE (-1) 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 typedef struct { 27 void (*onDataReceived)(uint32_t channelId, uint8_t *data, uint32_t dataLen); 28 void (*onDisconnected)(uint32_t channelId, int32_t reason); 29 } ProxyEventListener; 30 31 typedef struct { 32 void (*onConnectSuccess)(uint32_t channelId); 33 void (*onConnectFail)(uint32_t channelId, int32_t errorCode); 34 } ProxyBrConnectStateCallback; 35 36 typedef struct { 37 // public methods 38 int32_t (*registerEventListener)(const ProxyEventListener *listener); 39 int32_t (*connect)(struct ProxyConnection *connection, const ProxyBrConnectStateCallback *callback); 40 int32_t (*send)(struct ProxyConnection *connection, const uint8_t *data, uint32_t dataLen); 41 int32_t (*disconnect)(struct ProxyConnection *connection); 42 } ProxyBrConnectionManager; 43 44 ProxyBrConnectionManager *GetProxyBrConnectionManager(void); 45 46 #ifdef __cplusplus 47 } 48 #endif 49 #endif /* PROXY_CHANNEL_BR_CONNECTION_H */