Home | History | Annotate | Download | only in libloc_api
      1 /******************************************************************************
      2   @file:  loc_eng.h
      3   @brief:
      4 
      5   DESCRIPTION
      6     This file defines the global data structure used by this module.
      7 
      8   INITIALIZATION AND SEQUENCING REQUIREMENTS
      9 
     10   -----------------------------------------------------------------------------
     11 Copyright (c) 2009, QUALCOMM USA, INC.
     12 
     13 All rights reserved.
     14 
     15 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
     16 
     17          Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
     18 
     19          Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
     20 
     21          Neither the name of the QUALCOMM USA, INC.  nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
     22 
     23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     24   -----------------------------------------------------------------------------
     25 
     26 ******************************************************************************/
     27 
     28 /*=====================================================================
     29 $Header: $
     30 $DateTime: $
     31 $Author: $
     32 ======================================================================*/
     33 
     34 #ifndef LOC_ENG_H
     35 #define LOC_ENG_H
     36 
     37 // Define boolean type to be used by libgps on loc api module
     38 typedef unsigned char boolean;
     39 
     40 #ifndef TRUE
     41 #define TRUE 1
     42 #endif
     43 
     44 #ifndef FALSE
     45 #define FALSE 0
     46 #endif
     47 
     48 #include <loc_eng_ioctl.h>
     49 #include <loc_eng_xtra.h>
     50 #include <hardware_legacy/gps_ni.h>
     51 
     52 #define LOC_IOCTL_DEFAULT_TIMEOUT 1000 // 1000 milli-seconds
     53 
     54 // Module data
     55 typedef struct
     56 {
     57     rpc_loc_client_handle_type     client_handle;
     58 
     59     gps_location_callback          location_cb;
     60     gps_status_callback            status_cb;
     61     gps_sv_status_callback         sv_status_cb;
     62     agps_status_callback           agps_status_cb;
     63     gps_nmea_callback              nmea_cb;
     64     gps_ni_notify_callback         ni_notify_cb;
     65     int                            agps_status;
     66 
     67     loc_eng_xtra_data_s_type       xtra_module_data;
     68 
     69     loc_eng_ioctl_data_s_type      ioctl_data;
     70 
     71     // data from loc_event_cb
     72     rpc_loc_event_mask_type         loc_event;
     73     rpc_loc_event_payload_u_type    loc_event_payload;
     74 
     75     boolean                        data_connection_succeeded;
     76     boolean                        data_connection_closed;
     77     boolean                        data_connection_failed;
     78     // TBD:
     79     char                           agps_server_host[256];
     80     int                            agps_server_port;
     81     uint32                         agps_server_address;
     82     char                           apn_name[100];
     83     int                            position_mode;
     84     rpc_loc_server_connection_handle  conn_handle;
     85 
     86     // GPS engine status
     87     GpsStatusValue                 engine_status;
     88 
     89     // Aiding data information to be deleted, aiding data can only be deleted when GPS engine is off
     90     GpsAidingData                  aiding_data_for_deletion;
     91 
     92     // Data variables used by deferred action thread
     93     pthread_t                      deferred_action_thread;
     94     // Signal deferred action thread to exit
     95     boolean                        deferred_action_thread_need_exit;
     96     // Mutex used by deferred action thread
     97     pthread_mutex_t                deferred_action_mutex;
     98     // Condition variable used by deferred action thread
     99     pthread_cond_t                 deferred_action_cond;
    100 } loc_eng_data_s_type;
    101 
    102 extern loc_eng_data_s_type loc_eng_data;
    103 
    104 #endif // LOC_ENG_H
    105