• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 #include "sensor_agent_proxy.h"
17 
18 void *g_proxy;
19 
GetAllSensors(SensorInfo ** sensorInfo,int32_t * count)20 int32_t GetAllSensors(SensorInfo **sensorInfo, int32_t *count)
21 {
22     if (g_proxy == NULL) {
23         g_proxy = GetServiceProxy();
24     }
25     return GetAllSensorsByProxy(g_proxy, sensorInfo, count);
26 }
27 
ActivateSensor(int32_t sensorTypeId,SensorUser * user)28 int32_t ActivateSensor(int32_t sensorTypeId, SensorUser *user)
29 {
30     if (g_proxy == NULL) {
31         g_proxy = GetServiceProxy();
32     }
33     return ActivateSensorByProxy(g_proxy, sensorTypeId, user);
34 }
35 
DeactivateSensor(int32_t sensorTypeId,SensorUser * user)36 int32_t DeactivateSensor(int32_t sensorTypeId, SensorUser *user)
37 {
38     if (g_proxy == NULL) {
39         g_proxy = GetServiceProxy();
40     }
41     return DeactivateSensorByProxy(g_proxy, sensorTypeId, user);
42 }
43 
SetBatch(int32_t sensorTypeId,SensorUser * user,int64_t samplingInterval,int64_t reportInterval)44 int32_t SetBatch(int32_t sensorTypeId, SensorUser *user, int64_t samplingInterval, int64_t reportInterval)
45 {
46     if (g_proxy == NULL) {
47         g_proxy = GetServiceProxy();
48     }
49     return SetBatchByProxy(g_proxy, sensorTypeId, user, samplingInterval, reportInterval);
50 }
51 
SubscribeSensor(int32_t sensorTypeId,SensorUser * user)52 int32_t SubscribeSensor(int32_t sensorTypeId, SensorUser *user)
53 {
54     if (g_proxy == NULL) {
55         g_proxy = GetServiceProxy();
56     }
57     return SubscribeSensorByProxy(g_proxy, sensorTypeId, user);
58 }
59 
UnsubscribeSensor(int32_t sensorTypeId,SensorUser * user)60 int32_t UnsubscribeSensor(int32_t sensorTypeId, SensorUser *user)
61 {
62     if (g_proxy == NULL) {
63         g_proxy = GetServiceProxy();
64     }
65     return UnsubscribeSensorByProxy(g_proxy, sensorTypeId, user);
66 }
67 
SetMode(int32_t sensorTypeId,SensorUser * user,int32_t mode)68 int32_t SetMode(int32_t sensorTypeId, SensorUser *user, int32_t mode)
69 {
70     if (g_proxy == NULL) {
71         g_proxy = GetServiceProxy();
72     }
73     return SetModeByProxy(g_proxy, sensorTypeId, user, mode);
74 }
75 
SetOption(int32_t sensorTypeId,SensorUser * user,int32_t option)76 int32_t SetOption(int32_t sensorTypeId, SensorUser *user, int32_t option)
77 {
78     if (g_proxy == NULL) {
79         g_proxy = GetServiceProxy();
80     }
81     return SetOptionByProxy(g_proxy, sensorTypeId, user, option);
82 }