From: chakradhar pogiri Date: Mon, 8 Feb 2021 09:03:14 +0000 (+0530) Subject: Apply next HAL architecture X-Git-Tag: submit/tizen/20210222.074141^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fb5538a90ef72cb42724c0b55b5bd999fc92d75d;p=platform%2Fcore%2Flocation%2Flbs-server.git Apply next HAL architecture Change-Id: Iaa493eb68a3c69be04d0ebd7730367d136b56d87 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index c88762e..31cb9a0 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(BIN_DIR "${PREFIX}/bin") #Dependencies -SET(common_dp "glib-2.0 lbs-dbus dlog gio-2.0 lbs-location libsyscommon") +SET(common_dp "glib-2.0 lbs-dbus dlog gio-2.0 lbs-location libsyscommon hal-api-common hal-api-location") SET(server_dp "${common_dp} tapi vconf vconf-internal-keys gthread-2.0 gio-unix-2.0 capi-network-connection capi-network-wifi-manager capi-system-info libtzplatform-config") SET(module_dp "${common_dp} gmodule-2.0") diff --git a/lbs-server/include/gps_plugin_data_types.h b/lbs-server/include/gps_plugin_data_types.h deleted file mode 100644 index 635127a..0000000 --- a/lbs-server/include/gps_plugin_data_types.h +++ /dev/null @@ -1,148 +0,0 @@ -/* - * lbs-server - * - * Copyright (c) 2011-2013 Samsung Electronics Co., Ltd. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef _GPS_PLUGIN_DATA_TYPES_H_ -#define _GPS_PLUGIN_DATA_TYPES_H_ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - - -/** Maximum number of satellite which is in used */ -#define MAX_GPS_NUM_SAT_USED (12) - -/** Maximum number of satellite which is in view */ -#define MAX_GPS_NUM_SAT_IN_VIEW (32) - -/** - * This enumeration has error type. - */ -typedef enum { - GPS_ERR_NONE = 0, /**< Error None */ - GPS_ERR_TIMEOUT = -100, /**< pos_cb error GPS Timeout */ - GPS_ERR_OUT_OF_SERVICE = -101, /**< pos_cb error GPS out of service */ - GPS_ERR_COMMUNICATION = -200, /**< Plugin event callback error */ -} gps_error_t; - -/** - * This enumeration has geofence service status. - */ -typedef enum { - GEOFENCE_STATUS_UNAVAILABLE = 0, - GEOFENCE_STATUS_AVAILABLE = 1, -} geofence_status_t; - -/** - * This enumeration has geofence service error type. - */ -typedef enum { - GEOFENCE_ERR_NONE = 0, - GEOFENCE_ERR_TOO_MANY_GEOFENCE = -100, - GEOFENCE_ERR_ID_EXISTS = -101, - GEOFENCE_ERR_ID_UNKNOWN = -200, - GEOFENCE_ERR_INVALID_TRANSITION = -300, - GEOFENCE_ERR_UNKNOWN = -400, -} geofence_error_t; - -/** - * This enumeration has XTRA request error type (wearable profile use only). - */ -typedef enum { - XTRA_REQUEST_ERR_NONE = 0, - XTRA_REQUEST_ERR_UNKNOWN = -100, -} xtra_request_error_t; - -/** - * This structure defines the GPS position data. - */ -typedef struct { - time_t timestamp; /**< Timestamp */ - double latitude; /**< Latitude data (in degree) */ - double longitude; /**< Longitude data (in degree) */ - double altitude; /**< Altitude data (in meter) */ - double speed; /**< Speed (in m/s) */ - double bearing; /**< Direction from true north(in degree) */ - double hor_accuracy; /**< Horizontal position error(in meter) */ - double ver_accuracy; /**< Vertical position error(in meter) */ -} pos_data_t; - -/** - * This structure defines the GPS batch data. - */ -typedef struct { - int num_of_location; /**< Number of batch data */ - pos_data_t *data; -} batch_data_t; - -/** - * This structure defines the satellite data. - */ -typedef struct { - int prn; /**< Pseudo Random Noise code of satellite */ - int snr; /**< Signal to Noise Ratio */ - int elevation; /**< Elevation */ - int azimuth; /**< Degrees from true north */ - int used; /**< Satellite was used for position fix */ -} sv_info_t; - -/** - * This structure defines the GPS satellite in view data. - */ -typedef struct { - time_t timestamp; /**< Timestamp */ - unsigned char pos_valid; /**< TRUE, if position is valid */ - int num_of_sat; /**< Number of satellites in view */ - sv_info_t sat[MAX_GPS_NUM_SAT_IN_VIEW]; /**< Satellite information */ -} sv_data_t; - -/** - * This structure defines the NMEA data. - */ -typedef struct { - time_t timestamp; /**< Timestamp */ - int len; /**< NMEA data length */ - char *data; /**< Raw NMEA data */ -} nmea_data_t; - -/** - * This structure defines the geofence data. - */ -typedef struct { - int geofence_id; /**< Geofence ID */ - double latitude; /**< Latitude data (in degree) */ - double longitude; /**< Longitude data (in degree) */ - int radius; /**< Radius data (in meters) */ -} geofence_data_t; - -typedef struct { - char imsi[16]; /**< IMSI */ - int mcc; /**< MCC */ - int mnc; /**< MNC */ - int lac; /**< Location area code */ - int psc; /**< Primary Srambling code */ - int cid; /**< Cell id */ -} mobile_info_t; - -#ifdef __cplusplus -} -#endif -#endif /* _GPS_PLUGIN_DATA_TYPES_H_ */ diff --git a/lbs-server/include/gps_plugin_extra_data_types.h b/lbs-server/include/gps_plugin_extra_data_types.h deleted file mode 100644 index 6535a1e..0000000 --- a/lbs-server/include/gps_plugin_extra_data_types.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * lbs-server - * - * Copyright (c) 2011-2013 Samsung Electronics Co., Ltd. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef _GPS_PLUGIN_EXTRA_DATA_TYPES_H_ -#define _GPS_PLUGIN_EXTRA_DATA_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * This enumeration has GPS session type. - */ -typedef enum { - GPS_SESSION_SINGLE_FIX = 0, /**< Single fix starting */ - GPS_SESSION_TRACKING_MODE /**< Tracking mode starting */ -} gps_session_t; - -/** - * This enumeration has GPS operation mode. - */ -typedef enum { - GPS_OPERATION_STANDALONE = 0, /**< GPS standalone (no assistance) */ - GPS_OPERATION_MS_BASED, /**< MS-Based AGPS */ - GPS_OPERATION_MS_ASSISTED /**< MS-Assisted AGPS */ -} gps_operation_t; - -/** - * This enumeration has GPS starting type. - */ -typedef enum { - GPS_STARTING_HOT_ = 0, /**< Hot start */ - GPS_STARTING_COLD, /**< Cold start */ - GPS_STARTING_NONE /**< None */ -} gps_starting_t; - -/** - * This enumeration has the SSL mode. - */ -typedef enum { - AGPS_SSL_DISABLE = 0, /**< SSL disable */ - AGPS_SSL_ENABLE /**< SSL enable */ -} agps_ssl_mode_t; - -/** - * This enumeration has the SSL certification type. - */ -typedef enum { - AGPS_CERT_VERISIGN = 0, - AGPS_CERT_THAWTE, - AGPS_CERT_CMCC, - AGPS_CERT_SPIRENT_TEST, - AGPS_CERT_THALES_TEST, - AGPS_CERT_CMCC_TEST, - AGPS_CERT_BMC_TEST, - AGPS_CERT_GOOGLE -} agps_ssl_cert_type_t; - -/** - * This enumeration has the verification confirm type. - */ -typedef enum { - AGPS_VER_CNF_YES = 0x00, /**< Specifies Confirmation yes. */ - AGPS_VER_CNF_NO = 0x01, /**< Specifies Confirmation no. */ - AGPS_VER_CNF_NORESPONSE = 0x02 /**< Specifies Confirmation no response. */ -} agps_verification_cnf_type_t; - -/** - * This enumeration has the zone in/out type. - */ -typedef enum { - GEOFENCE_ZONE_OUT = 0x00, - GEOFENCE_ZONE_IN = 0x01, - GEOFENCE_ZONE_UNCERTAIN = 0x02 -} geofence_zone_state_t; - -/** - * This structure is used to get the Extra Fix request parameters. - */ -typedef struct { - int accuracy; /**< accuracy */ - int tbf; /**< time between fixes */ - int num_fixes; /**< num fixes */ - unsigned char timeout; /**< session timeout */ -} gps_qos_param_t; - -#ifdef __cplusplus -} -#endif - -#endif /* _GPS_PLUGIN_EXTRA_DATA_TYPES_H_ */ diff --git a/lbs-server/include/gps_plugin_intf.h b/lbs-server/include/gps_plugin_intf.h deleted file mode 100644 index e4a2490..0000000 --- a/lbs-server/include/gps_plugin_intf.h +++ /dev/null @@ -1,502 +0,0 @@ -/* - * lbs-server - * - * Copyright (c) 2011-2013 Samsung Electronics Co., Ltd. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef _GPS_PLUGIN_PLUGIN_INTF_H_ -#define _GPS_PLUGIN_PLUGIN_INTF_H_ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define GPS_PLUGIN_PATH LIB_DIR"/libSLP-lbs-plugin.so" -#define MAX_REQUESTER_ID_LEN (128) -#define MAX_CLIENT_NAME_LEN (128) -#define MAX_SUPL_URL_LEN (128) - -/** - * GPS asynchronous event type - */ -typedef enum { - GPS_EVENT_START_SESSION = 0x0000, /**< The session is started */ - GPS_EVENT_STOP_SESSION, /**< The session is stopped */ - GPS_EVENT_CHANGE_INTERVAL, /**< Change updating interval */ - GPS_EVENT_REPORT_POSITION = 0x0100, /**< Bring up GPS position data */ - GPS_EVENT_REPORT_SATELLITE, /**< Bring up GPS SV data */ - GPS_EVENT_REPORT_NMEA, /**< Bring up GPS NMEA data */ - GPS_EVENT_REPORT_BATCH, /**< Bring up GPS batch data */ - GPS_EVENT_SET_OPTION = 0x0200, /**< The option is set */ - GPS_EVENT_GET_REF_LOCATION = 0x0300, /**< Get the reference location for AGPS */ - GPS_EVENT_GET_IMSI, /**< Get IMSI for identification */ - GPS_EVENT_GET_REF_TIME, /**< Get the reference time for AGPS */ - GPS_EVENT_OPEN_DATA_CONNECTION = 0x0400, /**< Request opening data network connection */ - GPS_EVENT_CLOSE_DATA_CONNECTION, /**< Request closing data network connection */ - GPS_EVENT_DNS_LOOKUP_IND, /**< Request resolving host name */ - GPS_EVENT_AGPS_VERIFICATION_INDI, /**< Verification indicator for AGPS is required */ - GPS_EVENT_FACTORY_TEST = 0x0500, /**< Factory test is done */ - GPS_EVENT_GEOFENCE_TRANSITION = 0x0600, /**< Geofence transition is occured */ - GPS_EVENT_GEOFENCE_STATUS, /**< Report geofence serivce status */ - GPS_EVENT_ADD_GEOFENCE, /**< Geofence is added(Start geofence) */ - GPS_EVENT_DELETE_GEOFENCE, /**< Geofence is deleted(Stop geofence) */ - GPS_EVENT_PAUSE_GEOFENCE, /**< Geofence is paused */ - GPS_EVENT_RESUME_GEOFENCE, /**< Geofence is resumed */ - GPS_EVENT_REQUEST_XTRA = 0x0700, /**< XTRA is requested. Used by Wearable profile only. */ - GPS_EVENT_ERR_CAUSE = 0xFFFF /**< Some error is occurred */ -} gps_event_id_t; - -/** - * Start session response event data - */ -typedef struct { - gps_error_t error; -} gps_start_session_ev_info_t; - -/** - * Response of stop session - */ -typedef struct { - gps_error_t error; -} gps_stop_session_ev_info_t; - -/** - * Set option response event data - */ -typedef struct { - gps_error_t error; -} gps_set_option_ev_info_t; - -typedef struct { - gps_error_t error; -} gps_change_interval_ev_info_t; - -/** - * Position data from GPS - */ -typedef struct { - gps_error_t error; - pos_data_t pos; -} gps_pos_ev_info_t; - -/** - * Batch data from GPS - */ -typedef struct { - gps_error_t error; - batch_data_t batch; -} gps_batch_ev_info_t; - -/** - * Satellite data from GPS - */ -typedef struct { - gps_error_t error; - sv_data_t sv; -} gps_sv_ev_info_t; - -/** - * NMEA data from GPS - */ -typedef struct { - gps_error_t error; - nmea_data_t nmea; -} gps_nmea_ev_info_t; - -/** - * This enumeration defines values for notify type for GPS verification message. - */ -typedef enum { - AGPS_NOTIFY_NO_VERIFY = 0x00, - AGPS_NOTIFY_ONLY = 0x01, - AGPS_NOTIFY_ALLOW_NORESPONSE = 0x02, - AGPS_NOTIFY_NOTALLOW_NORESPONSE = 0x03, - AGPS_NOTIFY_PRIVACY_NEEDED = 0x04, - AGPS_NOTIFY_PRIVACY_OVERRIDE = 0x05 -} agps_notify_t; - -/** - * This enumeration defines values for requester type for GPS verification message - */ -typedef enum { - AGPS_REQ_LOGICAL_NAME = 0x00, /**< Specifies logical name. */ - AGPS_REQ_EMAIL_ADDR = 0x01, /**< Specifies e-mail address */ - AGPS_REQ_MSISDN = 0x02, /**< Specifies MSISDN number */ - AGPS_REQ_URL = 0x03, /**< Specifies URL */ - AGPS_REQ_SIPURL = 0x04, /**< Specifies SIPURL */ - AGPS_REQ_MIN = 0x05, /**< Specifies MIN */ - AGPS_REQ_MDN = 0x06, /**< Specifies MDN */ - AGPS_REQ_UNKNOWN = 0x07 /**< Unknown request */ -} agps_supl_format_t; - -/** - * This enumeration defines values for GPS encoding type for GPS verification message. - */ -typedef enum { - AGPS_ENCODE_ISO646IRV = 0x00, - AGPS_ENCODE_ISO8859 = 0x01, - AGPS_ENCODE_UTF8 = 0x02, - AGPS_ENCODE_UTF16 = 0x03, - AGPS_ENCODE_UCS2 = 0x04, - AGPS_ENCODE_GSMDEFAULT = 0x05, - AGPS_ENCODE_SHIFT_JIS = 0x06, - AGPS_ENCODE_JIS = 0x07, - AGPS_ENCODE_EUC = 0x08, - AGPS_ENCODE_GB2312 = 0x09, - AGPS_ENCODE_CNS11643 = 0x0A, - AGPS_ENCODE_KSC1001 = 0x0B, - AGPS_ENCODE_GERMAN = 0x0C, - AGPS_ENCODE_ENGLISH = 0x0D, - AGPS_ENCODE_ITALIAN = 0x0E, - AGPS_ENCODE_FRENCH = 0x0F, - AGPS_ENCODE_SPANISH = 0x10, - AGPS_ENCODE_DUTCH = 0x11, - AGPS_ENCODE_SWEDISH = 0x12, - AGPS_ENCODE_DANISH = 0x13, - AGPS_ENCODE_PORTUGUESE = 0x14, - AGPS_ENCODE_FINNISH = 0x15, - AGPS_ENCODE_NORWEGIAN = 0x16, - AGPS_ENCODE_GREEK = 0x17, - AGPS_ENCODE_TURKISH = 0x18, - AGPS_ENCODE_HUNGARIAN = 0x19, - AGPS_ENCODE_POLISH = 0x1A, - AGPS_ENCODE_LANGUAGE_UNSPEC = 0xFF -} agps_encoding_scheme_t; - -/** - * This enumeration defines values for GPS encoding type for GPS verification message. - */ -typedef enum { - AGPS_ID_ENCODE_ISO646IRV = 0x00, - AGPS_ID_ENCODE_EXN_PROTOCOL_MSG = 0x01, - AGPS_ID_ENCODE_ASCII = 0x02, - AGPS_ID_ENCODE_IA5 = 0x03, - AGPS_ID_ENCODE_UNICODE = 0x04, - AGPS_ID_ENCODE_SHIFT_JIS = 0x05, - AGPS_ID_ENCODE_KOREAN = 0x06, - AGPS_ID_ENCODE_LATIN_HEBREW = 0x07, - AGPS_ID_ENCODE_LATIN = 0x08, - AGPS_ID_ENCODE_GSM = 0x09 -} agps_requester_id_encoding_t; - -/** - * This structure defines the values for GPS Verification message indication. - */ -typedef struct { - /** Specifies notification type refer enum tapi_gps_notify_type_t */ - agps_notify_t notify_type; - - /** Specifies encoding type refer enum tapi_gps_encoding_type_t */ - agps_supl_format_t supl_format; - - /** Specifies requester type */ - agps_encoding_scheme_t datacoding_scheme; - - agps_requester_id_encoding_t requester_id_encoding; - - /** Specifies requester ID */ - char requester_id[MAX_REQUESTER_ID_LEN]; - - /** Specifies client name */ - char client_name[MAX_CLIENT_NAME_LEN]; - - /** Response timer */ - int resp_timer; -} agps_verification_ev_info_t; - -/** - * Factory test result information - */ -typedef struct { - gps_error_t error; - int prn; - double snr; -} gps_factory_test_ev_info_t; - -/** - * DNS query request information - */ -typedef struct { - gps_error_t error; - char domain_name[MAX_SUPL_URL_LEN]; -} gps_dns_query_ev_info_t; - -/** - * Geofecne transition information - */ -typedef struct { - time_t geofence_timestamp; - int geofence_id; - pos_data_t pos; - geofence_zone_state_t state; -} geofence_transition_ev_info_t; - -/** - * Geofecne status information - */ -typedef struct { - geofence_status_t status; - pos_data_t last_pos; -} geofence_status_ev_info_t; - -/** - * Geofecne event information - */ -typedef struct { - int geofence_id; - geofence_error_t error; -} geofence_event_t; - -/** - * Type of XTRA request. Used by Wearable profile only. - */ -typedef enum { - XTRA_REQUEST_TYPE_NONE = 0x00, - XTRA_REQUEST_TYPE_QCOM = 0x01, - XTRA_REQUEST_TYPE_BRCM = 0x02, - XTRA_REQEUST_TYPE_NUM, -} xtra_request_type_t; - -/** - * XTRA request information. Used by Wearable profile only. - */ -typedef struct { - xtra_request_type_t xtra_id; - xtra_request_error_t error; -} xtra_request_info_t; - -typedef struct { - time_t timeout; -}ref_data_request_info_t; - -/** - * GPS event info - */ -typedef union { - /** Callback related with Response */ - gps_start_session_ev_info_t start_session_rsp; - gps_stop_session_ev_info_t stop_session_rsp; - gps_set_option_ev_info_t set_option_rsp; - gps_change_interval_ev_info_t change_interval_rsp; - - /** Callback related with Indication */ - gps_pos_ev_info_t pos_ind; - gps_sv_ev_info_t sv_ind; - gps_nmea_ev_info_t nmea_ind; - gps_batch_ev_info_t batch_ind; - agps_verification_ev_info_t agps_verification_ind; - - gps_factory_test_ev_info_t factory_test_rsp; - gps_dns_query_ev_info_t dns_query_ind; - - /** Callback related with Geofence. */ - geofence_transition_ev_info_t geofence_transition_ind; - geofence_status_ev_info_t geofence_status_ind; - geofence_event_t geofence_event_rsp; - - /** Callback related with XTRA. Used by Wearable profile only. */ - xtra_request_info_t xtra_request_ind; - ref_data_request_info_t ref_data_req_ind; -} gps_event_data_t; - -/** - * Transport Error Cause - */ -typedef enum { - GPS_FAILURE_CAUSE_NORMAL = 0x00, - GPS_FAILURE_CAUSE_FACTORY_TEST, - GPS_FAILURE_CAUSE_DNS_QUERY, - GPS_FAILURE_CAUSE_LBS_SERVER_FINISH -} gps_failure_reason_t; - -/** - * GPS Event Info - */ -typedef struct { - gps_event_id_t event_id; /**< GPS asynchronous event id */ - gps_event_data_t event_data; /**< GPS event information data */ -} gps_event_info_t; - -/** - * Callback function - * LBS server needs to register a callback function with GPS OEM to receive asynchronous events. - */ -typedef int (*gps_event_cb)(gps_event_info_t *gps_event_info, void *user_data); - -/** - * GPS action type - */ -typedef enum { - GPS_ACTION_SEND_PARAMS = 0x000, - GPS_ACTION_START_SESSION, - GPS_ACTION_STOP_SESSION, - GPS_ACTION_CHANGE_INTERVAL, - - GPS_INDI_SUPL_VERIFICATION, - GPS_INDI_SUPL_DNSQUERY, - - GPS_ACTION_START_FACTTEST, - GPS_ACTION_STOP_FACTTEST, - GPS_ACTION_REQUEST_SUPL_NI, - GPS_ACTION_REQUEST_SUPL_NI_NOMODEM, - GPS_ACTION_DELETE_GPS_DATA, - - GPS_ACTION_ADD_GEOFENCE, - GPS_ACTION_DELETE_GEOFENCE, - GPS_ACTION_PAUSE_GEOFENCE, - GPS_ACTION_RESUME_GEOFENCE, - - GPS_ACTION_DOWNLOAD_XTRA, /* Used by Wearable profile only. */ - GPS_ACTION_CONSUMER_CONNECTED, /* Used by Wearable profile only. */ - GPS_ACTION_CONSUMER_DISCONNECTED, /* Used by Wearable profile only. */ - - GPS_ACTION_CHANGE_INTERVAL_SPORTMODE, - - GPS_ACTION_SET_REF_LOCATION, /* Used by Wearable profile only. */ - GPS_ACTION_SET_REF_TIME, /* Used by Wearable profile only. */ - - GPS_ACTION_START_BATCH, - GPS_ACTION_STOP_BATCH, - GPS_ACTION_ADD_REDUCE_SET, - GPS_ACTION_REMOVE_REDUCE_SET -} gps_action_t; - -/** - * Cell information type - */ -typedef enum { - GPS_CELL_INFO_TYPE_aRFCNPresent = 0, - GPS_CELL_INFO_TYPE_bSICPresent, - GPS_CELL_INFO_TYPE_rxLevPresent, - GPS_CELL_INFO_TYPE_frequencyInfoPresent, - GPS_CELL_INFO_TYPE_cellMeasuredResultPresent, - - GPS_CELL_INFO_TYPE_refMCC, - GPS_CELL_INFO_TYPE_refMNC, - GPS_CELL_INFO_TYPE_refLAC, - GPS_CELL_INFO_TYPE_refCI, - GPS_CELL_INFO_TYPE_refUC, - GPS_CELL_INFO_TYPE_aRFCN, - GPS_CELL_INFO_TYPE_bSIC, - GPS_CELL_INFO_TYPE_rxLev -} agps_cell_info_t; - -/** - * Mobile service type - */ -typedef enum { - SVCTYPE_NONE = 0, /**< Unknown network */ - SVCTYPE_NOSVC, /**< Network in no service */ - SVCTYPE_EMERGENCY, /**< Network emergency */ - SVCTYPE_SEARCH, /**< Network search 1900 */ - SVCTYPE_2G, /**< Network 2G */ - SVCTYPE_2_5G, /**< Network 2.5G */ - SVCTYPE_2_5G_EDGE, /**< Network EDGE */ - SVCTYPE_3G, /**< Network UMTS */ - SVCTYPE_HSDPA /**< Network HSDPA */ -} agps_svc_type_t; - -/** - * SUPL network-initiated information - */ -typedef struct { - char *msg_body; /**< SUPL NI message body */ - int msg_size; /**< SUPL NI message size */ - int status; /**< Return code of Status */ -} agps_supl_ni_info_t; - -/** - * SUPL network-initiated information in case of no-modem - */ -typedef struct { - char *msg_body; /**< SUPL NI message body */ - int msg_size; /**< SUPL NI message size */ - char imsi[16]; /**< IMSI */ - int mcc; /**< MCC */ - int mnc; /**< MNC */ - int lac; /**< Location area code */ - int psc; /**< Primary Srambling code */ - int cid; /**< Cell id */ - int status; /**< Return code of Status */ -} agps_supl_ni_nomodem_info_t; - -/** - * Geofence action data type - */ -typedef struct { - geofence_data_t geofence; - geofence_zone_state_t last_state; - int monitor_states; - int notification_responsiveness_ms; - int unknown_timer_ms; -} geofence_action_data_t; - -typedef struct { - int interval; - int period; /**< Emulator */ - int session_status; /**< Emulator */ -} gps_action_start_data_t; - -typedef struct { - int interval; -} gps_action_change_interval_data_t; - -/* -* GPS_ACTION_SET_REF_LOCATION -*/ -typedef struct { - int result; - int reason; - time_t timestamp; /**< Timestamp */ - double latitude; /**< Latitude data (in degree) */ - double longitude; /**< Longitude data (in degree) */ - double accuracy; /**< Horizontal position error(in meter) */ -} gps_action_set_ref_location_t; // Added 2016.06.30 - -/* -* GPS_ACTION_SET_REF_TIME -*/ -typedef struct { - int result; - int reason; - int method; - int64_t ntp_timestamp; /**< Timestamp from NTP */ - int64_t elapsed_systime; /**< Milliseconds since boot, including time spent in sleep */ - int uncertainty; /**< Half of round trip time in milliseconds */ -} gps_action_set_ref_time_t; // Added 2016.06.30 - -/** - * gps-plugin plugin interface - */ -typedef struct { - /** Initialize plugin module and register callback function for event delivery. */ - int (*init)(gps_event_cb gps_event_cb, void *user_data); - - /** Deinitialize plugin module */ - int (*deinit)(gps_failure_reason_t *reason_code); - - /** Request specific action to plugin module */ - int (*request)(gps_action_t gps_action, void *gps_action_data, gps_failure_reason_t *reason_code); -} gps_plugin_interface; - -const gps_plugin_interface *get_gps_plugin_interface(); - -#ifdef __cplusplus -} -#endif -#endif /* _GPS_PLUGIN_INTF_H_ */ diff --git a/lbs-server/src/gps_plugin_module.c b/lbs-server/src/gps_plugin_module.c index 074f7dc..9e4d21b 100644 --- a/lbs-server/src/gps_plugin_module.c +++ b/lbs-server/src/gps_plugin_module.c @@ -18,7 +18,6 @@ #include #include -#include #include #include #include @@ -26,60 +25,19 @@ #include "setting.h" #include "debug_util.h" -#define REPLAY_PLUGIN_PATH LIB_DIR"/libSLP-lbs-plugin-replay.so" - -static const gps_plugin_interface *g_plugin_interface = NULL; - int load_plugin_module(gboolean replay_enabled, void **plugin_handle) { - char plugin_path[256]; - - if (replay_enabled) - strncpy(plugin_path, REPLAY_PLUGIN_PATH, sizeof(plugin_path)); - else - strncpy(plugin_path, GPS_PLUGIN_PATH, sizeof(plugin_path)); - - LOG_GPS(DBG_ERR, "Load plugin module : %s", replay_enabled ? "REPLAY" : "GPS"); - *plugin_handle = dlopen(plugin_path, RTLD_NOW); - if (!*plugin_handle) { - LOG_GPS(DBG_ERR, "Failed to load plugin module: %s", plugin_path); - LOG_GPS(DBG_ERR, "%s", dlerror()); - return FALSE; - } - - const gps_plugin_interface *(*get_gps_plugin_interface)(); - get_gps_plugin_interface = dlsym(*plugin_handle, "get_gps_plugin_interface"); - if (!get_gps_plugin_interface) { - LOG_GPS(DBG_ERR, "Failed to find entry symbol in plugin module."); - dlclose(*plugin_handle); - return FALSE; - } - - g_plugin_interface = get_gps_plugin_interface(); - - if (!g_plugin_interface) { - LOG_GPS(DBG_ERR, "Failed to find load symbol in plugin module."); - dlclose(*plugin_handle); + int r = hal_location_get_backend(); + if (r < 0) { + LOG_GPS(DBG_ERR, "Failed to load plugin module : %d", r); return FALSE; } - LOG_GPS(DBG_LOW, "Success to load plugin module (%s)", plugin_path); - return TRUE; } int unload_plugin_module(void *plugin_handle) { - if (plugin_handle == NULL) { - LOG_GPS(DBG_ERR, "plugin_handle is already NULL."); - return FALSE; - } - - dlclose(plugin_handle); - + hal_location_put_backend(); return TRUE; } -const gps_plugin_interface *get_plugin_module(void) -{ - return g_plugin_interface; -} diff --git a/lbs-server/src/gps_plugin_module.h b/lbs-server/src/gps_plugin_module.h index 225d3ac..69ba088 100644 --- a/lbs-server/src/gps_plugin_module.h +++ b/lbs-server/src/gps_plugin_module.h @@ -20,10 +20,10 @@ #define _GPS_PLUGIN_MODULE_H_ #include -#include "gps_plugin_intf.h" +#include +#include int load_plugin_module(gboolean replay_enabled, void **plugin_handle); int unload_plugin_module(void *plugin_handle); -const gps_plugin_interface *get_plugin_module(void); #endif /* _GPS_PLUGIN_MODULE_H_ */ diff --git a/lbs-server/src/last_position.c b/lbs-server/src/last_position.c index 8e9cc38..1424d6a 100644 --- a/lbs-server/src/last_position.c +++ b/lbs-server/src/last_position.c @@ -21,7 +21,6 @@ #include #include -#include "gps_plugin_data_types.h" #include "last_position.h" #include "debug_util.h" #include "setting.h" diff --git a/lbs-server/src/last_position.h b/lbs-server/src/last_position.h index 2bbe5b6..38cde85 100644 --- a/lbs-server/src/last_position.h +++ b/lbs-server/src/last_position.h @@ -19,7 +19,7 @@ #ifndef _LAST_POSITON_H_ #define _LAST_POSITON_H_ -#include "gps_plugin_data_types.h" +#include void gps_set_last_position(const pos_data_t *pos); diff --git a/lbs-server/src/lbs_server.c b/lbs-server/src/lbs_server.c index e0e30d0..45428c2 100755 --- a/lbs-server/src/lbs_server.c +++ b/lbs-server/src/lbs_server.c @@ -28,7 +28,7 @@ #include #include -#include "gps_plugin_data_types.h" +#include #include "lbs_server.h" #include "nps_plugin_module.h" diff --git a/lbs-server/src/lbs_server.h b/lbs-server/src/lbs_server.h index a0aa3ec..d2d9ea4 100644 --- a/lbs-server/src/lbs_server.h +++ b/lbs-server/src/lbs_server.h @@ -19,8 +19,7 @@ #ifndef _LBS_SERVER_H_ #define _LBS_SERVER_H_ -#include -#include +#include #include #define SERVICE_NAME "org.tizen.lbs.Providers.LbsServer" diff --git a/lbs-server/src/server.c b/lbs-server/src/server.c index 14eb003..7171e9d 100755 --- a/lbs-server/src/server.c +++ b/lbs-server/src/server.c @@ -29,12 +29,11 @@ #include #include "server.h" -#include "gps_plugin_data_types.h" -#include "gps_plugin_intf.h" #include "nmea_logger.h" #include "data_connection.h" #include "setting.h" #include "gps_plugin_module.h" +#include #include "debug_util.h" #include "last_position.h" #include "dump_log.h" @@ -138,15 +137,24 @@ static void reload_plugin_module(gps_server_t *server) gps_failure_reason_t ReasonCode = GPS_FAILURE_CAUSE_NORMAL; LOG_GPS(DBG_LOW, "reload_plugin_module : replay enabled: %d", server->replay_enabled); - - if (!get_plugin_module()->deinit(&ReasonCode)) { + int ret = hal_location_get_backend(); + if( ret < 0){ + LOG_GPS(DBG_LOW, "plugin_module_load failed %d", ret); + return; + } + if (hal_location_deinit(&ReasonCode)) { LOG_GPS(DBG_ERR, "Fail to GPS plugin deinit"); } else { unload_plugin_module(&server->gps_plugin.handle); if (!load_plugin_module(server->replay_enabled, &server->gps_plugin.handle)) { LOG_GPS(DBG_ERR, "Fail to load plugin module"); } else { - if (!get_plugin_module()->init(_gps_server_gps_event_cb, (void *)server)) { + int ret = hal_location_get_backend(); + if( ret < 0){ + LOG_GPS(DBG_LOW, "plugin_module_load failed %d", ret); + return; + } + if (!hal_location_init(_gps_server_gps_event_cb, (void *)server)) { LOG_GPS(DBG_ERR, "Fail to plugin init"); return; } @@ -215,7 +223,12 @@ int request_change_pos_update_interval_standalone_gps(unsigned int interval) if (server->session_state == GPS_SESSION_STARTING || server->session_state == GPS_SESSION_STARTED) { gps_action_change_interval_data_t gps_change_interval_data; gps_change_interval_data.interval = (int)interval; - status = get_plugin_module()->request(GPS_ACTION_CHANGE_INTERVAL, &gps_change_interval_data, &reason_code); + int ret = hal_location_get_backend(); + if( ret < 0){ + LOG_GPS(DBG_LOW, "plugin_module_load failed %d", ret); + return FALSE; + } + status = hal_location_request(GPS_ACTION_CHANGE_INTERVAL, &gps_change_interval_data, &reason_code); LOG_GPS(DBG_INFO, "requested go GPS module done. gps_change_interval_data.interval [%d]", gps_change_interval_data.interval); if (status == FALSE) { @@ -245,7 +258,12 @@ int request_start_session(int interval) server->session_state = GPS_SESSION_STARTING; LOG_GPS(DBG_LOW, "==GPSSessionState[%d]", server->session_state); gps_start_data.interval = interval; - status = get_plugin_module()->request(GPS_ACTION_START_SESSION, &gps_start_data, &reason_code); + int ret = hal_location_get_backend(); + if( ret < 0){ + LOG_GPS(DBG_LOW, "plugin_module_load failed %d", ret); + return FALSE; + } + status = hal_location_request(GPS_ACTION_START_SESSION, &gps_start_data, &reason_code); if (status == FALSE) { LOG_GPS(DBG_ERR, "Main: sending GPS_ACTION_START_SESSION Fail !"); @@ -268,7 +286,14 @@ int request_stop_session() LOG_GPS(DBG_LOW, "Main: Stop GPS Session, ==GPSSessionState[%d]", server->session_state); if (server->session_state == GPS_SESSION_STARTED || server->session_state == GPS_SESSION_STARTING) { - status = get_plugin_module()->request(GPS_ACTION_STOP_SESSION, NULL, &reason_code); + + int ret = hal_location_get_backend(); + if( ret < 0){ + LOG_GPS(DBG_LOW, "plugin_module_load failed %d", ret); + return 0; + } + status = hal_location_request(GPS_ACTION_STOP_SESSION, NULL, &reason_code); + if (status) { server->session_state = GPS_SESSION_STOPPING; LOG_GPS(DBG_LOW, "==GPSSessionState[%d]", server->session_state); @@ -307,7 +332,12 @@ int request_start_batch_session(int batch_interval, int batch_period) LOG_GPS(DBG_LOW, "==GPSSessionState[%d]", server->session_state); gps_start_data.interval = batch_interval; gps_start_data.period = batch_period; - status = get_plugin_module()->request(GPS_ACTION_START_BATCH, &gps_start_data, &reason_code); + int ret = hal_location_get_backend(); + if( ret < 0){ + LOG_GPS(DBG_LOW, "plugin_module_load failed %d", ret); + return FALSE; + } + status = hal_location_request(GPS_ACTION_START_BATCH, &gps_start_data, &reason_code); if (status == FALSE) { LOG_GPS(DBG_ERR, "Batch: sending GPS_ACTION_START_SESSION Fail !"); @@ -335,7 +365,12 @@ int request_stop_batch_session(int batch_interval, int batch_period, int session LOG_GPS(DBG_LOW, "Batch: Stop GPS Session, ==GPSSessionState[%d]", server->session_state); if (server->session_state == GPS_SESSION_STARTED || server->session_state == GPS_SESSION_STARTING) { /* TURE: All clients stopped, FALSE: Some clients are running with GPS or BATCH */ - status = get_plugin_module()->request(GPS_ACTION_STOP_BATCH, &gps_start_data, &reason_code); + int ret = hal_location_get_backend(); + if( ret < 0){ + LOG_GPS(DBG_LOW, "plugin_module_load failed %d", ret); + return 0; + } + status = hal_location_request(GPS_ACTION_STOP_BATCH, &gps_start_data, &reason_code); if (status == TRUE && session_status == 0) { server->session_state = GPS_SESSION_STOPPING; LOG_GPS(DBG_LOW, "==GPSSessionState[%d]", server->session_state); @@ -375,7 +410,12 @@ int request_add_geofence(int fence_id, double latitude, double longitude, int ra /* action_data.unknown_timer_ms = unknown_timer; */ LOG_GPS(DBG_LOW, "request_add_geofence with geofence_id [%d]", fence_id); - status = get_plugin_module()->request(GPS_ACTION_ADD_GEOFENCE, &action_data, &reason_code); + int ret = hal_location_get_backend(); + if( ret < 0){ + LOG_GPS(DBG_LOW, "plugin_module_load failed %d", ret); + return 0; + } + status = hal_location_request(GPS_ACTION_ADD_GEOFENCE, &action_data, &reason_code); return status; } @@ -386,7 +426,12 @@ int request_delete_geofence(int fence_id) gps_failure_reason_t reason_code = GPS_FAILURE_CAUSE_NORMAL; LOG_GPS(DBG_LOW, "request_delete_geofence with geofence_id [%d]", fence_id); - status = get_plugin_module()->request(GPS_ACTION_DELETE_GEOFENCE, &fence_id, &reason_code); + int ret = hal_location_get_backend(); + if( ret < 0){ + LOG_GPS(DBG_LOW, "plugin_module_load failed %d", ret); + return 0; + } + status = hal_location_request(GPS_ACTION_DELETE_GEOFENCE, &fence_id, &reason_code); return status; } @@ -397,7 +442,12 @@ int request_pause_geofence(int fence_id) gps_failure_reason_t reason_code = GPS_FAILURE_CAUSE_NORMAL; LOG_GPS(DBG_LOW, "request_pause_geofence with geofence_id [%d]", fence_id); - status = get_plugin_module()->request(GPS_ACTION_PAUSE_GEOFENCE, &fence_id, &reason_code); + int ret = hal_location_get_backend(); + if( ret < 0){ + LOG_GPS(DBG_LOW, "plugin_module_load failed %d", ret); + return 0; + } + status = hal_location_request(GPS_ACTION_PAUSE_GEOFENCE, &fence_id, &reason_code); return status; } @@ -412,7 +462,12 @@ int request_resume_geofence(int fence_id, int monitor_states) action_data.monitor_states = monitor_states; LOG_GPS(DBG_LOW, "request_resume_geofence with geofence_id [%d]", fence_id); - status = get_plugin_module()->request(GPS_ACTION_RESUME_GEOFENCE, &action_data, &reason_code); + int ret = hal_location_get_backend(); + if( ret < 0){ + LOG_GPS(DBG_LOW, "plugin_module_load failed %d", ret); + return 0; + } + status = hal_location_request(GPS_ACTION_RESUME_GEOFENCE, &action_data, &reason_code); return status; } @@ -421,8 +476,13 @@ int request_delete_gps_data() { gboolean status = TRUE; gps_failure_reason_t reason_code = GPS_FAILURE_CAUSE_NORMAL; - - status = get_plugin_module()->request(GPS_ACTION_DELETE_GPS_DATA, NULL, &reason_code); + + int ret = hal_location_get_backend(); + if( ret < 0){ + LOG_GPS(DBG_LOW, "plugin_module_load failed %d", ret); + return FALSE; + } + status = hal_location_request(GPS_ACTION_DELETE_GPS_DATA, NULL, &reason_code); if (status == FALSE) { LOG_GPS(DBG_ERR, "Fail : GPS_ACTION_DELETE_GPS_DATA [%d]", reason_code); @@ -675,11 +735,23 @@ static int _gps_server_resolve_dns(char *domain) result = query_dns(domain, &ipaddr, &port); if (result == TRUE) { LOG_GPS(DBG_LOW, "Success to resolve domain name [ %s ] / ipaddr [ %u ]", domain, ipaddr); - get_plugin_module()->request(GPS_INDI_SUPL_DNSQUERY, (void *)(&ipaddr), &reason_code); + + int ret = hal_location_get_backend(); + if( ret < 0){ + LOG_GPS(DBG_LOW, "plugin_module_load failed %d", ret); + return FALSE; + } + hal_location_request(GPS_INDI_SUPL_DNSQUERY, (void *)(&ipaddr), &reason_code); + } else { ipaddr = 0; LOG_GPS(DBG_ERR, "Fail to resolve domain name [ %s ] / ipaddr [ %u ]", domain, ipaddr); - get_plugin_module()->request(GPS_INDI_SUPL_DNSQUERY, (void *)(&ipaddr), &reason_code); + int retrn = hal_location_get_backend(); + if( retrn < 0){ + LOG_GPS(DBG_LOW, "plugin_module_load failed %d", retrn); + return FALSE; + } + hal_location_request(GPS_INDI_SUPL_DNSQUERY, (void *)(&ipaddr), &reason_code); return FALSE; } @@ -905,8 +977,14 @@ int request_supl_ni_session(const char *header, const char *body, int size) info.msg_body = (char *)body; info.msg_size = size; info.status = TRUE; + + int ret = hal_location_get_backend(); + if( ret < 0){ + LOG_GPS(DBG_LOW, "plugin_module_load failed %d", ret); + return FALSE; + } - if (!get_plugin_module()->request(GPS_ACTION_REQUEST_SUPL_NI, &info, &reason_code)) { + if (!hal_location_request(GPS_ACTION_REQUEST_SUPL_NI, &info, &reason_code)) { LOG_GPS(DBG_ERR, "Failed to request SUPL NI (code:%d)", reason_code); return FALSE; } @@ -924,7 +1002,13 @@ static void *request_supl_ni_session(void *data) info.msg_size = ni_data->msg_size; info.status = TRUE; - if (!get_plugin_module()->request(GPS_ACTION_REQUEST_SUPL_NI, &info, &reason_code)) + int ret = hal_location_get_backend(); + if( ret < 0){ + LOG_GPS(DBG_LOW, "plugin_module_load failed %d", ret); + return; + } + + if (!hal_location_request(GPS_ACTION_REQUEST_SUPL_NI, &info, &reason_code)) LOG_GPS(DBG_ERR, "Failed to request SUPL NI (code:%d)", reason_code); free(ni_data); @@ -1155,7 +1239,12 @@ int initialize_server(int argc, char **argv) return -1; } - if (!get_plugin_module()->init(_gps_server_gps_event_cb, (void *)server)) { + int ret = hal_location_get_backend(); + if( ret < 0){ + LOG_GPS(DBG_LOW, "plugin_module_load failed %d", ret); + return -1; + } + if (!hal_location_init(_gps_server_gps_event_cb, (void *)server)) { LOG_GPS(DBG_WARN, "Fail to gps module initialization"); return -1; } @@ -1188,7 +1277,12 @@ int deinitialize_server() _gps_ignore_params(); - if (!get_plugin_module()->deinit(&ReasonCode)) + int ret = hal_location_get_backend(); + if( ret < 0){ + LOG_GPS(DBG_LOW, "plugin_module_load failed %d", ret); + return 0; + } + if (!hal_location_deinit(&ReasonCode)) LOG_GPS(DBG_WARN, "Fail to gps module de-initialization"); unload_plugin_module(g_gps_server->gps_plugin.handle); diff --git a/packaging/lbs-server.spec b/packaging/lbs-server.spec index 147f1d0..e67c5e3 100755 --- a/packaging/lbs-server.spec +++ b/packaging/lbs-server.spec @@ -1,6 +1,6 @@ Name: lbs-server Summary: LBS Server for Tizen -Version: 1.3.5 +Version: 1.3.6 Release: 1 Group: Location/Service License: Apache-2.0 @@ -25,6 +25,8 @@ BuildRequires: pkgconfig(gthread-2.0) BuildRequires: pkgconfig(gmodule-2.0) BuildRequires: pkgconfig(libtzplatform-config) BuildRequires: pkgconfig(capi-network-connection) +BuildRequires: pkgconfig(hal-api-common) +BuildRequires: pkgconfig(hal-api-location) BuildRequires: pkgconfig(libsyscommon)