• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 HiSilicon (Shanghai) Technologies CO., LIMITED.
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 LinkServiceAgent__H
17 #define LinkServiceAgent__H
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 typedef struct LinkServiceAgent {
24     /*
25      * this funtion to get device's property value.
26      * s : ServiceAgent
27      * property : device's property name
28      * value : a json string of device's property value
29      * len : value's length
30      * StatusOk : get value successfully
31      * StatusFailure : failure to get value
32      * StatusDeviceOfffline : device had offline
33      */
34     int (*get)(struct LinkServiceAgent* s, const char* property, char* value, int len);
35     /*
36      * this funtion to modify device's property
37      * s : ServiceAgent
38      * property : device's property name
39      * value : a json string of device's property
40      * len : value's length
41      * StatusOk : moified value successfully
42      * StatusFailure : failure to moified value
43      * StatusDeviceOfffline : device had offline
44      */
45     int (*modify)(struct LinkServiceAgent* s, const char* property, char* value, int len);
46     /*
47      * get device's service type
48      * if type is not null, then return a string,otherwise,
49      * a null string return
50      */
51     const char* (*type)(struct LinkServiceAgent* s);
52     /*
53      * get address of device's service
54      */
55     const char* (*addr)(struct LinkServiceAgent* s);
56     /*
57      * the id of device's service
58      */
59     int (*id)(struct LinkServiceAgent* s);
60 } LinkServiceAgent;
61 
62 /*
63  * free ServiceAgent that malloced by LinkAgent
64  */
65 void LinkServiceAgentFree(LinkServiceAgent* s);
66 
67 // /for C++
68 #ifdef __cplusplus
69 }
70 #endif
71 
72 #endif /* __LinkServiceAgent__H__ */
73