time_t batch_start_time;
gboolean is_flush;
- pos_data_t *pos_data;
- batch_data_t *batch_data;
- sv_data_t *sv_data;
- nmea_data_t *nmea_data;
- pos_data_t *batch_buf;
+ hal_location_pos_data_s *pos_data;
+ hal_location_batch_data_s *batch_data;
+ hal_location_sv_data_s *sv_data;
+ hal_location_nmea_data_s *nmea_data;
+ hal_location_pos_data_s *batch_buf;
GSource *timeout_src;
GMainContext *default_context;
const char* nmea_file_name;
-void gps_plugin_replay_pos_event(pos_data_t *data)
+void gps_plugin_replay_pos_event(hal_location_pos_data_s *data)
{
- gps_event_info_t gps_event;
+ gps_event_info_s gps_event;
time_t timestamp;
- memset(&gps_event, 0, sizeof(gps_event_info_t));
+ memset(&gps_event, 0, sizeof(gps_event_info_s));
time(×tamp);
- gps_event.event_id = GPS_EVENT_REPORT_POSITION;
+ gps_event.hal_location_gps_event_id_e = GPS_EVENT_REPORT_POSITION;
if (data == NULL) {
LOG_PLUGIN(DBG_ERR, "NULL POS data.");
- gps_event.event_data.pos_ind.error = GPS_ERR_COMMUNICATION;
+ gps_event.event_data.pos_ind.error = HAL_LOCATION_GPS_ERR_COMMUNICATION;
} else {
- gps_event.event_data.pos_ind.error = GPS_ERR_NONE;
+ gps_event.event_data.pos_ind.error = HAL_LOCATION_GPS_ERR_NONE;
gps_event.event_data.pos_ind.pos.timestamp = timestamp;
gps_event.event_data.pos_ind.pos.latitude = data->latitude;
gps_event.event_data.pos_ind.pos.longitude = data->longitude;
g_gps_event_cb(&gps_event, g_user_data);
}
-void add_batch_data(pos_data_t *data, replay_timeout *timer, int idx, time_t timestamp)
+void add_batch_data(hal_location_pos_data_s *data, replay_timeout *timer, int idx, time_t timestamp)
{
timer->batch_buf[idx].timestamp = timestamp;
timer->batch_buf[idx].latitude = data->latitude;
timer->batch_buf[idx].ver_accuracy = data->ver_accuracy;
}
-void gps_plugin_replay_batch_event(pos_data_t *data, replay_timeout *timer)
+void gps_plugin_replay_batch_event(hal_location_pos_data_s *data, replay_timeout *timer)
{
time_t timestamp;
time(×tamp);
}
int size = timer->batch_period / timer->batch_interval;
- timer->batch_buf = (pos_data_t *) malloc(sizeof(pos_data_t) * size);
+ timer->batch_buf = (hal_location_pos_data_s *) malloc(sizeof(hal_location_pos_data_s) * size);
LOG_PLUGIN(DBG_LOW, "--> set batch_buf[size : %d]", size);
timer->batch_buf_size = size;
}
*/
if (timer->is_flush) {
LOG_PLUGIN(DBG_LOW, "Batch invoked, Batch interval is expired or Batch stopped");
- gps_event_info_t gps_event;
- memset(&gps_event, 0, sizeof(gps_event_info_t));
+ gps_event_info_s gps_event;
+ memset(&gps_event, 0, sizeof(gps_event_info_s));
- gps_event.event_id = GPS_EVENT_REPORT_BATCH;
+ gps_event.hal_location_gps_event_id_e = GPS_EVENT_REPORT_BATCH;
timer->batch_start_time = timestamp;
timer->is_flush = FALSE;
if (timer->num_of_batch < 1) {
LOG_PLUGIN(DBG_ERR, "There is no Batch data");
- gps_event.event_data.batch_ind.error = GPS_ERR_COMMUNICATION;
+ gps_event.event_data.batch_ind.error = HAL_LOCATION_GPS_ERR_COMMUNICATION;
} else {
- gps_event.event_data.batch_ind.error = GPS_ERR_NONE;
+ gps_event.event_data.batch_ind.error = HAL_LOCATION_GPS_ERR_NONE;
gps_event.event_data.batch_ind.batch.num_of_location = timer->num_of_batch;
gps_event.event_data.batch_ind.batch.data = timer->batch_buf;
}
}
}
-void gps_plugin_replay_sv_event(sv_data_t *data)
+void gps_plugin_replay_sv_event(hal_location_sv_data_s *data)
{
int i;
- gps_event_info_t gps_event;
+ gps_event_info_s gps_event;
time_t timestamp;
- memset(&gps_event, 0, sizeof(gps_event_info_t));
+ memset(&gps_event, 0, sizeof(gps_event_info_s));
time(×tamp);
- gps_event.event_id = GPS_EVENT_REPORT_SATELLITE;
+ gps_event.hal_location_gps_event_id_e = GPS_EVENT_REPORT_SATELLITE;
if (data == NULL) {
LOG_PLUGIN(DBG_ERR, "NULL SV data.");
- gps_event.event_data.sv_ind.error = GPS_ERR_COMMUNICATION;
+ gps_event.event_data.sv_ind.error = HAL_LOCATION_GPS_ERR_COMMUNICATION;
} else {
- gps_event.event_data.sv_ind.error = GPS_ERR_NONE;
+ gps_event.event_data.sv_ind.error = HAL_LOCATION_GPS_ERR_NONE;
gps_event.event_data.sv_ind.sv.timestamp = timestamp;
gps_event.event_data.sv_ind.sv.pos_valid = data->pos_valid;
gps_event.event_data.sv_ind.sv.num_of_sat = data->num_of_sat;
g_gps_event_cb(&gps_event, g_user_data);
}
-void gps_plugin_replay_nmea_event(nmea_data_t *data)
+void gps_plugin_replay_nmea_event(hal_location_nmea_data_s *data)
{
- gps_event_info_t gps_event;
+ gps_event_info_s gps_event;
time_t timestamp;
- memset(&gps_event, 0, sizeof(gps_event_info_t));
+ memset(&gps_event, 0, sizeof(gps_event_info_s));
time(×tamp);
- gps_event.event_id = GPS_EVENT_REPORT_NMEA;
+ gps_event.hal_location_gps_event_id_e = GPS_EVENT_REPORT_NMEA;
if (data == NULL) {
LOG_PLUGIN(DBG_ERR, "NULL NMEA data.");
- gps_event.event_data.nmea_ind.error = GPS_ERR_COMMUNICATION;
+ gps_event.event_data.nmea_ind.error = HAL_LOCATION_GPS_ERR_COMMUNICATION;
} else {
if (data->len > REPLAY_NMEA_SENTENCE_SIZE) {
LOG_PLUGIN(DBG_WARN, "The Size of NMEA[ %d ] is larger then max ", data->len);
data->len = REPLAY_NMEA_SENTENCE_SIZE;
- gps_event.event_data.nmea_ind.error = GPS_ERR_COMMUNICATION;
+ gps_event.event_data.nmea_ind.error = HAL_LOCATION_GPS_ERR_COMMUNICATION;
} else {
- gps_event.event_data.nmea_ind.error = GPS_ERR_NONE;
+ gps_event.event_data.nmea_ind.error = HAL_LOCATION_GPS_ERR_NONE;
}
gps_event.event_data.nmea_ind.nmea.timestamp = timestamp;
gps_event.event_data.nmea_ind.nmea.len = data->len;
void gps_plugin_respond_start_session(gboolean ret)
{
- gps_event_info_t gps_event;
- gps_event.event_id = GPS_EVENT_START_SESSION;
+ gps_event_info_s gps_event;
+ gps_event.hal_location_gps_event_id_e = HAL_LOCATION_GPS_EVENT_START_SESSION;
if (ret == TRUE)
- gps_event.event_data.start_session_rsp.error = GPS_ERR_NONE;
+ gps_event.event_data.start_session_rsp.error = HAL_LOCATION_GPS_ERR_NONE;
else
- gps_event.event_data.start_session_rsp.error = GPS_ERR_COMMUNICATION;
+ gps_event.event_data.start_session_rsp.error = HAL_LOCATION_GPS_ERR_COMMUNICATION;
if (g_gps_event_cb != NULL)
g_gps_event_cb(&gps_event, g_user_data);
void gps_plugin_respond_stop_session(void)
{
- gps_event_info_t gps_event;
+ gps_event_info_s gps_event;
- gps_event.event_id = GPS_EVENT_STOP_SESSION;
- gps_event.event_data.stop_session_rsp.error = GPS_ERR_NONE;
+ gps_event.hal_location_gps_event_id_e = HAL_LOCATION_GPS_EVENT_STOP_SESSION;
+ gps_event.event_data.stop_session_rsp.error = HAL_LOCATION_GPS_ERR_NONE;
if (g_gps_event_cb != NULL)
g_gps_event_cb(&gps_event, g_user_data);
return ret;
}
-gboolean gps_plugin_replay_read_manual(pos_data_t *pos_data)
+gboolean gps_plugin_replay_read_manual(hal_location_pos_data_s *pos_data)
{
gboolean ret = TRUE;
return FALSE;
}
- memset(timer->pos_data, 0, sizeof(pos_data_t));
- memset(timer->batch_data, 0, sizeof(batch_data_t));
- memset(timer->sv_data, 0, sizeof(sv_data_t));
+ memset(timer->pos_data, 0, sizeof(hal_location_pos_data_s));
+ memset(timer->batch_data, 0, sizeof(hal_location_batch_data_s));
+ memset(timer->sv_data, 0, sizeof(hal_location_sv_data_s));
if (timer->replay_mode == REPLAY_NMEA) {
if (gps_plugin_replay_read_nmea(timer, nmea_data) == FALSE) {
//setting_notify_key_changed(VCONFKEY_PM_STATE, display_mode_changed_cb); moved to lbs-server module
- timer->pos_data = (pos_data_t *) malloc(sizeof(pos_data_t));
+ timer->pos_data = (hal_location_pos_data_s *) malloc(sizeof(hal_location_pos_data_s));
if (timer->pos_data == NULL) {
LOG_PLUGIN(DBG_ERR, "pos_data allocation is failed.");
free(timer);
return NULL;
}
- timer->batch_data = (batch_data_t *) malloc(sizeof(batch_data_t));
+ timer->batch_data = (hal_location_batch_data_s *) malloc(sizeof(hal_location_batch_data_s));
if (timer->batch_data == NULL) {
LOG_PLUGIN(DBG_ERR, "batch_data allocation is failed.");
free(timer->pos_data);
return NULL;
}
- timer->sv_data = (sv_data_t *) malloc(sizeof(sv_data_t));
+ timer->sv_data = (hal_location_sv_data_s *) malloc(sizeof(hal_location_sv_data_s));
if (timer->sv_data == NULL) {
LOG_PLUGIN(DBG_ERR, "sv_data allocation is failed.");
free(timer->pos_data);
return NULL;
}
- timer->nmea_data = (nmea_data_t *) malloc(sizeof(nmea_data_t));
+ timer->nmea_data = (hal_location_nmea_data_s *) malloc(sizeof(hal_location_nmea_data_s));
if (timer->nmea_data == NULL) {
LOG_PLUGIN(DBG_ERR, "nmea_data allocation is failed.");
free(timer->pos_data);
return TRUE;
}
-static int gps_plugin_replay_gps_deinit(gps_failure_reason_t *reason_code)
+static int gps_plugin_replay_gps_deinit(gps_failure_reason_e *reason_code)
{
gps_plugin_replay_timer_deinit(g_replay_timer);
g_gps_event_cb = NULL;
return TRUE;
}
-static int gps_plugin_replay_gps_request(gps_action_t gps_action, void *gps_action_data, gps_failure_reason_t *reason_code)
+static int gps_plugin_replay_gps_request(hal_location_gps_action_e gps_action, void *gps_action_data, gps_failure_reason_e *reason_code)
{
gps_action_start_data_t *gps_start_data = gps_action_data;
#define EAST 1
#define WEST -1
-int used_sat[MAX_GPS_NUM_SAT_USED] = { 0, };
+int used_sat[HAL_LOCATION_MAX_GPS_NUM_SAT_USED] = { 0, };
static unsigned char nmea_parser_c2n(unsigned char ch)
{
return altitude;
}
-static int nmea_parser_gpgga(char *token[], pos_data_t *pos, sv_data_t *sv)
+static int nmea_parser_gpgga(char *token[], hal_location_pos_data_s *pos, hal_location_sv_data_s *sv)
{
double latitude, longitude, altitude;
int quality;
return READ_SUCCESS;
}
-static int nmea_parser_gprmc(char *token[], pos_data_t *pos)
+static int nmea_parser_gprmc(char *token[], hal_location_pos_data_s *pos)
{
char *status;
double latitude, longitude, speed, bearing;
return READ_SUCCESS;
}
-static int nmea_parser_gpgll(char *token[], pos_data_t *pos)
+static int nmea_parser_gpgll(char *token[], hal_location_pos_data_s *pos)
{
char *status;
double latitude, longitude;
return READ_SUCCESS;
}
-static int nmea_parser_gpgsa(char *token[], pos_data_t *pos)
+static int nmea_parser_gpgsa(char *token[], hal_location_pos_data_s *pos)
{
int i, fix_type;
/* selection_type = *token[1]; */
memset(used_sat, 0, sizeof(used_sat));
- for (i = 0; i < MAX_GPS_NUM_SAT_USED; i++)
+ for (i = 0; i < HAL_LOCATION_MAX_GPS_NUM_SAT_USED; i++)
used_sat[i] = atoi(token[i + 3]);
return READ_SUCCESS;
}
-static int nmea_parser_gpvtg(char *token[], pos_data_t *pos)
+static int nmea_parser_gpvtg(char *token[], hal_location_pos_data_s *pos)
{
double true_course, kmh_speed;
return READ_SUCCESS;
}
-static int nmea_parser_gpgsv(char *token[], sv_data_t *sv)
+static int nmea_parser_gpgsv(char *token[], hal_location_sv_data_s *sv)
{
int i, j;
int p, q, iter;
return READ_ERROR;
}
sv->sat[p].prn = atoi(token[q]);
- for (j = 0; j < MAX_GPS_NUM_SAT_USED; j++) {
+ for (j = 0; j < HAL_LOCATION_MAX_GPS_NUM_SAT_USED; j++) {
if (sv->sat[p].prn == used_sat[j]) {
sv->sat[p].used = 1;
break;
return READ_SUCCESS;
}
-int nmea_parser_sentence(char *sentence, char *token[], pos_data_t *pos, sv_data_t *sv)
+int nmea_parser_sentence(char *sentence, char *token[], hal_location_pos_data_s *pos, hal_location_sv_data_s *sv)
{
int ret = READ_SUCCESS;
if (strcmp(sentence, "GPGGA") == 0)
return ret;
}
-int nmea_parser(char *data, pos_data_t *pos, sv_data_t *sv)
+int nmea_parser(char *data, hal_location_pos_data_s *pos, hal_location_sv_data_s *sv)
{
if (!data) return READ_ERROR;