1 /******************************************************************
3 * Copyright 2014 Samsung Electronics All Rights Reserved.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 ******************************************************************/
21 #ifndef TIZEN_PROXIMITY_H_
22 #define TIZEN_PROXIMITY_H_
24 #include <bluetooth.h>
26 #include "tizen_CbleDevice.h"
28 void proximity_loop( void *param );
29 void what_return_value( bt_error_e returnValue );
32 #define JOB_GET_RSSI 1
33 #define JOB_GET_PROX 2
34 #define JOB_PUT_OUTPUT 3
43 CRSSI() : cnt(0), rssi(0) {}
44 CRSSI( int count ) : cnt(0), rssi(0) { init(count); }
55 void init( int count )
59 rssi = new int[count];
69 typedef void *(*workfunc)( void *);
70 typedef std::map<std::string, CRSSI> rssiMAP;
73 static int get_rssi_cnt;
74 static int num_set_rssi;
75 static rssiMAP map_rssi;
85 CProximity( workfunc func );
89 static bool find_referenceThing( bt_adapter_device_discovery_info_s *discovery_info ,
90 CbleDevice *pdevice );
92 static void CB_discover_state_change(int result,
93 bt_adapter_device_discovery_state_e discovery_state, \
94 bt_adapter_device_discovery_info_s *discovery_info, void *user_data);
96 bool GetRSSI(CbleDevice *pdevice);
98 void GetProximity(CbleDevice *pdevice);
100 bool set_threadFunc(workfunc func);
102 workfunc get_threadFunc(void);
104 void set_output( CbleDevice *pdevice );
106 void prox_first_setting( int reference_ea );
108 friend void proximity_loop( void *param );
113 #endif /* TIZEN_PROXIMITY_H_ */