Change enum and struct name using convention 25/318825/1
authorAbhimanyu Swami <abhimanyu1.s@samsung.com>
Fri, 24 Jan 2025 11:08:56 +0000 (16:38 +0530)
committerAbhimanyu Swami <abhimanyu1.s@samsung.com>
Fri, 24 Jan 2025 11:08:56 +0000 (16:38 +0530)
Change-Id: I0d736924a3065061360d6185a7e028b9bb371779
Signed-off-by: Abhimanyu Swami <abhimanyu1.s@samsung.com>
gps-plugin/include/nmea_parser.h
gps-plugin/src/gps_plugin_replay.c
gps-plugin/src/nmea_parser.c

index 2226af9d530b83fcea5a53a29a35b103e5ca9587..b817b6bfa04e26cedb03056203a9c6d964c6e931 100644 (file)
@@ -25,7 +25,7 @@
 extern "C" {
 #endif                         /* __cplusplus */
 
-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);
 
 #ifdef __cplusplus
 }
index f2f67b1a13ff981a0a6db5a1614c537dedd790a4..6a01af60f4811ed5380b5dc5f510730d513a1033 100755 (executable)
@@ -58,11 +58,11 @@ typedef struct {
        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;
@@ -72,21 +72,21 @@ replay_timeout *g_replay_timer = NULL;
 
 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(&timestamp);
 
-       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;
@@ -101,7 +101,7 @@ void gps_plugin_replay_pos_event(pos_data_t *data)
                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;
@@ -113,7 +113,7 @@ void add_batch_data(pos_data_t *data, replay_timeout *timer, int idx, time_t tim
        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(&timestamp);
@@ -125,7 +125,7 @@ void gps_plugin_replay_batch_event(pos_data_t *data, replay_timeout *timer)
                }
 
                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;
        }
@@ -155,18 +155,18 @@ void gps_plugin_replay_batch_event(pos_data_t *data, replay_timeout *timer)
         */
        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;
                }
@@ -178,21 +178,21 @@ void gps_plugin_replay_batch_event(pos_data_t *data, replay_timeout *timer)
        }
 }
 
-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(&timestamp);
-       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;
@@ -209,26 +209,26 @@ void gps_plugin_replay_sv_event(sv_data_t *data)
                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(&timestamp);
 
-       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;
@@ -250,13 +250,13 @@ void gps_plugin_replay_nmea_event(nmea_data_t *data)
 
 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);
@@ -264,10 +264,10 @@ void gps_plugin_respond_start_session(gboolean ret)
 
 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);
@@ -328,7 +328,7 @@ gboolean gps_plugin_replay_read_nmea(replay_timeout *timer, char *nmea_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;
 
@@ -364,9 +364,9 @@ gboolean gps_plugin_replay_timeout_cb(gpointer data)
                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) {
@@ -613,14 +613,14 @@ replay_timeout *gps_plugin_replay_timer_init()
 
        //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);
@@ -628,7 +628,7 @@ replay_timeout *gps_plugin_replay_timer_init()
                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);
@@ -637,7 +637,7 @@ replay_timeout *gps_plugin_replay_timer_init()
                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);
@@ -688,7 +688,7 @@ static int gps_plugin_replay_gps_init(gps_event_cb gps_event_cb, void *user_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;
@@ -697,7 +697,7 @@ static int gps_plugin_replay_gps_deinit(gps_failure_reason_t *reason_code)
        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;
 
index 26c26628f0c7428c55af06e41f7bc9debf05d5db..78d3df4a5e9ce1fadf757833449419c1866eed5a 100644 (file)
@@ -39,7 +39,7 @@
 #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)
 {
@@ -157,7 +157,7 @@ static double nmea_parser_get_altitude(const char *alt, const char *unit)
        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;
@@ -187,7 +187,7 @@ static int nmea_parser_gpgga(char *token[], pos_data_t *pos, sv_data_t *sv)
        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;
@@ -214,7 +214,7 @@ static int nmea_parser_gprmc(char *token[], pos_data_t *pos)
        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;
@@ -234,7 +234,7 @@ static int nmea_parser_gpgll(char *token[], pos_data_t *pos)
        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;
 
@@ -247,7 +247,7 @@ static int nmea_parser_gpgsa(char *token[], pos_data_t *pos)
        /*      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]);
 
 
@@ -258,7 +258,7 @@ static int nmea_parser_gpgsa(char *token[], pos_data_t *pos)
        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;
 
@@ -273,7 +273,7 @@ static int nmea_parser_gpvtg(char *token[], pos_data_t *pos)
        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;
@@ -302,7 +302,7 @@ static int nmea_parser_gpgsv(char *token[], sv_data_t *sv)
                        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;
@@ -317,7 +317,7 @@ static int nmea_parser_gpgsv(char *token[], sv_data_t *sv)
        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)
@@ -339,7 +339,7 @@ int nmea_parser_sentence(char *sentence, char *token[], pos_data_t *pos, sv_data
        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;