• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 
16 #ifndef FUSION_DEVICE_PROFILE_ADAPTER_H
17 #define FUSION_DEVICE_PROFILE_ADAPTER_H
18 
19 #include <cstddef>
20 #include <cstdint>
21 
22 struct CIStringVector {
23     CIStringVector* (*clone)(CIStringVector *);
24     void (*destruct)(CIStringVector *);
25     const char* (*get)(CIStringVector *, size_t);
26     size_t (*getSize)(CIStringVector *);
27 };
28 
29 struct CICrossStateListener {
30     CICrossStateListener* (*clone)(CICrossStateListener* listener);
31     void (*destruct)(CICrossStateListener* listener);
32     void (*onUpdate)(CICrossStateListener* listener, const char* deviceId, int32_t switchState);
33 };
34 
35 using DeviceProfileCallback = void (*)(const char*, bool, void*);
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif /* __cplusplus */
40 
41 int32_t UpdateCrossSwitchState(size_t switchState);
42 int32_t SyncCrossSwitchState(size_t switchState, CIStringVector* deviceIds);
43 int32_t GetCrossSwitchState(const char* deviceId);
44 int32_t RegisterCrossStateListener(const char* deviceId, CICrossStateListener* listener);
45 int32_t UnregisterCrossStateListener(const char* deviceId);
46 
47 #ifdef __cplusplus
48 }
49 #endif /* __cplusplus */
50 #endif // FUSION_DEVICE_PROFILE_ADAPTER_H
51