diff --git a/etc/gps.conf b/etc/gps.conf index 322fe162..b38526a2 100644 --- a/etc/gps.conf +++ b/etc/gps.conf @@ -1,3 +1,12 @@ +XTRA_SERVER_1=http://xtra1.gpsonextra.net/xtra.bin +XTRA_SERVER_2=http://xtra2.gpsonextra.net/xtra.bin +XTRA_SERVER_3=http://xtra3.gpsonextra.net/xtra.bin + +# Error Estimate +# _SET = 1 +# _CLEAR = 0 +ERR_ESTIMATE=0 + #Test NTP_SERVER=time.gpsonextra.net #Asia @@ -7,13 +16,9 @@ NTP_SERVER=time.gpsonextra.net #North America # NTP_SERVER=north-america.pool.ntp.org -XTRA_SERVER_1=http://xtra1.gpsonextra.net/xtra.bin -XTRA_SERVER_2=http://xtra2.gpsonextra.net/xtra.bin -XTRA_SERVER_3=http://xtra3.gpsonextra.net/xtra.bin - # DEBUG LEVELS: 0 - none, 1 - Error, 2 - Warning, 3 - Info # 4 - Debug, 5 - Verbose -DEBUG_LEVEL = 2 +DEBUG_LEVEL = 3 # Intermediate position report, 1=enable, 0=disable INTERMEDIATE_POS=0 @@ -21,15 +26,11 @@ INTERMEDIATE_POS=0 # supl version 1.0 SUPL_VER=0x10000 -# Error Estimate -# _SET = 1 -# _CLEAR = 0 -ERR_ESTIMATE=0 - # GPS Capabilities bit mask # SCHEDULING = 1 # MSB = 2 # MSA = 4 +# ON_DEMAND_TIME = 0x10 # ULP = 0x20 # default = MSA | MSB | SCHEDULING | ULP CAPABILITIES=0x27 @@ -50,42 +51,17 @@ CAPABILITIES=0x27 # C2K_HOST=c2k.pde.com or IP # C2K_PORT=1234 -################################ -# Sensor Settings -################################ - -# Needs to be set explicitly based on sensor -# There is no default value. -#GYRO_BIAS_RANDOM_WALK= - -SENSOR_ACCEL_BATCHES_PER_SEC=2 -SENSOR_ACCEL_SAMPLES_PER_BATCH=5 -SENSOR_GYRO_BATCHES_PER_SEC=2 -SENSOR_GYRO_SAMPLES_PER_BATCH=5 - -# Sensor Control Mode (0=AUTO, 1=FORCE_ON) -SENSOR_CONTROL_MODE=0 - -# Enable or Disable Sensors for GPS use (0=Enable, 1=Disable) -SENSOR_USAGE=0 - -# Choose GSIFF sensor provider (1=DSPS, 2=Android NDK) -SENSOR_PROVIDER=1 - -################################ -# Indoor Positioning Settings -################################ -# 0: QUIPC disabled, 1: QUIPC enabled, 2: forced QUIPC only -QUIPC_ENABLED = 0 +#################################### +# LTE Positioning Profile Settings +#################################### +# 0: Enable RRLP on LTE(Default) +# 1: Enable LPP_User_Plane on LTE +# 2: Enable LPP_Control_Plane +# 3: Enable both LPP_User_Plane and LPP_Control_Plane +LPP_PROFILE = 0 ################################ # EXTRA SETTINGS ################################ -# Enable or Disable Wiper (1=Enable, 0=Disable) -ENABLE_WIPER=1 - -#################################### -# LTE Positioning Profile Settings -#################################### -# 0: Enable RRLP on LTE(Default) 1: Enable LPP_User_Plane on LTE -LPP_PROFILE = 0 +# NMEA provider (1=Modem Processor, 0=Application Processor) +NMEA_PROVIDER=0 diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp index caa01ec2..09e9c4c3 100644 --- a/loc_api/libloc_api_50001/loc_eng.cpp +++ b/loc_api/libloc_api_50001/loc_eng.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2009-2012, The Linux Foundation. All rights reserved. +/* Copyright (c) 2009-2013, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -67,6 +67,14 @@ #define SUCCESS TRUE #define FAILURE FALSE +#ifndef GPS_CONF_FILE +#define GPS_CONF_FILE "/etc/gps.conf" //??? platform independent +#endif + +#ifndef SAP_CONF_FILE +#define SAP_CONF_FILE "/etc/sap.conf" +#endif + static void loc_eng_deferred_action_thread(void* context); static void* loc_eng_create_msg_q(); static void loc_eng_free_msg(void* msg); @@ -74,9 +82,10 @@ static void loc_eng_free_msg(void* msg); pthread_mutex_t LocEngContext::lock = PTHREAD_MUTEX_INITIALIZER; pthread_cond_t LocEngContext::cond = PTHREAD_COND_INITIALIZER; LocEngContext* LocEngContext::me = NULL; -boolean gpsConfigAlreadyRead = false; +boolean configAlreadyRead = false; loc_gps_cfg_s_type gps_conf; +loc_sap_cfg_s_type sap_conf; /* Parameter spec table */ static loc_param_s_type loc_parameter_table[] = @@ -87,22 +96,22 @@ static loc_param_s_type loc_parameter_table[] = {"NMEA_PROVIDER", &gps_conf.NMEA_PROVIDER, NULL, 'n'}, {"SUPL_VER", &gps_conf.SUPL_VER, NULL, 'n'}, {"CAPABILITIES", &gps_conf.CAPABILITIES, NULL, 'n'}, - {"GYRO_BIAS_RANDOM_WALK", &gps_conf.GYRO_BIAS_RANDOM_WALK, &gps_conf.GYRO_BIAS_RANDOM_WALK_VALID, 'f'}, - {"ACCEL_RANDOM_WALK_SPECTRAL_DENSITY", &gps_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY, &gps_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'}, - {"ANGLE_RANDOM_WALK_SPECTRAL_DENSITY", &gps_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY, &gps_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'}, - {"RATE_RANDOM_WALK_SPECTRAL_DENSITY", &gps_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY, &gps_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'}, - {"VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY", &gps_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY, &gps_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'}, - {"SENSOR_ACCEL_BATCHES_PER_SEC", &gps_conf.SENSOR_ACCEL_BATCHES_PER_SEC, NULL, 'n'}, - {"SENSOR_ACCEL_SAMPLES_PER_BATCH", &gps_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH, NULL, 'n'}, - {"SENSOR_GYRO_BATCHES_PER_SEC", &gps_conf.SENSOR_GYRO_BATCHES_PER_SEC, NULL, 'n'}, - {"SENSOR_GYRO_SAMPLES_PER_BATCH", &gps_conf.SENSOR_GYRO_SAMPLES_PER_BATCH, NULL, 'n'}, - {"SENSOR_ACCEL_BATCHES_PER_SEC_HIGH", &gps_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH, NULL, 'n'}, - {"SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH", &gps_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH, NULL, 'n'}, - {"SENSOR_GYRO_BATCHES_PER_SEC_HIGH", &gps_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH, NULL, 'n'}, - {"SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH", &gps_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH, NULL, 'n'}, - {"SENSOR_CONTROL_MODE", &gps_conf.SENSOR_CONTROL_MODE, NULL, 'n'}, - {"SENSOR_USAGE", &gps_conf.SENSOR_USAGE, NULL, 'n'}, - {"SENSOR_ALGORITHM_CONFIG_MASK", &gps_conf.SENSOR_ALGORITHM_CONFIG_MASK, NULL, 'n'}, + {"GYRO_BIAS_RANDOM_WALK", &sap_conf.GYRO_BIAS_RANDOM_WALK, &sap_conf.GYRO_BIAS_RANDOM_WALK_VALID, 'f'}, + {"ACCEL_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'}, + {"ANGLE_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'}, + {"RATE_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'}, + {"VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'}, + {"SENSOR_ACCEL_BATCHES_PER_SEC", &sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC, NULL, 'n'}, + {"SENSOR_ACCEL_SAMPLES_PER_BATCH", &sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH, NULL, 'n'}, + {"SENSOR_GYRO_BATCHES_PER_SEC", &sap_conf.SENSOR_GYRO_BATCHES_PER_SEC, NULL, 'n'}, + {"SENSOR_GYRO_SAMPLES_PER_BATCH", &sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH, NULL, 'n'}, + {"SENSOR_ACCEL_BATCHES_PER_SEC_HIGH", &sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH, NULL, 'n'}, + {"SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH", &sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH, NULL, 'n'}, + {"SENSOR_GYRO_BATCHES_PER_SEC_HIGH", &sap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH, NULL, 'n'}, + {"SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH", &sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH, NULL, 'n'}, + {"SENSOR_CONTROL_MODE", &sap_conf.SENSOR_CONTROL_MODE, NULL, 'n'}, + {"SENSOR_USAGE", &sap_conf.SENSOR_USAGE, NULL, 'n'}, + {"SENSOR_ALGORITHM_CONFIG_MASK", &sap_conf.SENSOR_ALGORITHM_CONFIG_MASK, NULL, 'n'}, {"QUIPC_ENABLED", &gps_conf.QUIPC_ENABLED, NULL, 'n'}, {"LPP_PROFILE", &gps_conf.LPP_PROFILE, NULL, 'n'}, {"A_GLONASS_POS_PROTOCOL_SELECT", &gps_conf.A_GLONASS_POS_PROTOCOL_SELECT, NULL, 'n'}, @@ -118,31 +127,31 @@ static void loc_default_parameters(void) gps_conf.SUPL_VER = 0x10000; gps_conf.CAPABILITIES = 0x7; - gps_conf.GYRO_BIAS_RANDOM_WALK = 0; - gps_conf.SENSOR_ACCEL_BATCHES_PER_SEC = 2; - gps_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH = 5; - gps_conf.SENSOR_GYRO_BATCHES_PER_SEC = 2; - gps_conf.SENSOR_GYRO_SAMPLES_PER_BATCH = 5; - gps_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH = 4; - gps_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH = 25; - gps_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH = 4; - gps_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH = 25; - gps_conf.SENSOR_CONTROL_MODE = 0; /* AUTO */ - gps_conf.SENSOR_USAGE = 0; /* Enabled */ - gps_conf.SENSOR_ALGORITHM_CONFIG_MASK = 0; /* INS Disabled = FALSE*/ + sap_conf.GYRO_BIAS_RANDOM_WALK = 0; + sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC = 2; + sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH = 5; + sap_conf.SENSOR_GYRO_BATCHES_PER_SEC = 2; + sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH = 5; + sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH = 4; + sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH = 25; + sap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH = 4; + sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH = 25; + sap_conf.SENSOR_CONTROL_MODE = 0; /* AUTO */ + sap_conf.SENSOR_USAGE = 0; /* Enabled */ + sap_conf.SENSOR_ALGORITHM_CONFIG_MASK = 0; /* INS Disabled = FALSE*/ /* Values MUST be set by OEMs in configuration for sensor-assisted navigation to work. There are NO default values */ - gps_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY = 0; - gps_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY = 0; - gps_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY = 0; - gps_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY = 0; + sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY = 0; + sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY = 0; + sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY = 0; + sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY = 0; - gps_conf.GYRO_BIAS_RANDOM_WALK_VALID = 0; - gps_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0; - gps_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0; - gps_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0; - gps_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0; + sap_conf.GYRO_BIAS_RANDOM_WALK_VALID = 0; + sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0; + sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0; + sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0; + sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0; /* LTE Positioning Profile configuration is disable by default*/ gps_conf.LPP_PROFILE = 0; @@ -371,7 +380,7 @@ static int loc_eng_reinit(loc_eng_data_s_type &loc_eng_data) lpp_msg, loc_eng_free_msg); loc_eng_msg_sensor_control_config *sensor_control_config_msg( - new loc_eng_msg_sensor_control_config(&loc_eng_data, gps_conf.SENSOR_USAGE)); + new loc_eng_msg_sensor_control_config(&loc_eng_data, sap_conf.SENSOR_USAGE)); msg_q_snd((void*)((LocEngContext*)(loc_eng_data.context))->deferred_q, sensor_control_config_msg, loc_eng_free_msg); @@ -381,40 +390,40 @@ static int loc_eng_reinit(loc_eng_data_s_type &loc_eng_data) a_glonass_protocol_msg, loc_eng_free_msg); /* Make sure at least one of the sensor property is specified by the user in the gps.conf file. */ - if( gps_conf.GYRO_BIAS_RANDOM_WALK_VALID || - gps_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID || - gps_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID || - gps_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID || - gps_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID ) + if( sap_conf.GYRO_BIAS_RANDOM_WALK_VALID || + sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID || + sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID || + sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID || + sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID ) { loc_eng_msg_sensor_properties *sensor_properties_msg( new loc_eng_msg_sensor_properties(&loc_eng_data, - gps_conf.GYRO_BIAS_RANDOM_WALK_VALID, - gps_conf.GYRO_BIAS_RANDOM_WALK, - gps_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID, - gps_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY, - gps_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, - gps_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY, - gps_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, - gps_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY, - gps_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID, - gps_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY)); + sap_conf.GYRO_BIAS_RANDOM_WALK_VALID, + sap_conf.GYRO_BIAS_RANDOM_WALK, + sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID, + sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY, + sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, + sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY, + sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, + sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY, + sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID, + sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY)); msg_q_snd((void*)((LocEngContext*)(loc_eng_data.context))->deferred_q, sensor_properties_msg, loc_eng_free_msg); } loc_eng_msg_sensor_perf_control_config *sensor_perf_control_conf_msg( new loc_eng_msg_sensor_perf_control_config(&loc_eng_data, - gps_conf.SENSOR_CONTROL_MODE, - gps_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH, - gps_conf.SENSOR_ACCEL_BATCHES_PER_SEC, - gps_conf.SENSOR_GYRO_SAMPLES_PER_BATCH, - gps_conf.SENSOR_GYRO_BATCHES_PER_SEC, - gps_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH, - gps_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH, - gps_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH, - gps_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH, - gps_conf.SENSOR_ALGORITHM_CONFIG_MASK)); + sap_conf.SENSOR_CONTROL_MODE, + sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH, + sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC, + sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH, + sap_conf.SENSOR_GYRO_BATCHES_PER_SEC, + sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH, + sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH, + sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH, + sap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH, + sap_conf.SENSOR_ALGORITHM_CONFIG_MASK)); msg_q_snd((void*)((LocEngContext*)(loc_eng_data.context))->deferred_q, sensor_perf_control_conf_msg, loc_eng_free_msg); } @@ -2228,14 +2237,15 @@ SIDE EFFECTS int loc_eng_read_config(void) { ENTRY_LOG_CALLFLOW(); - if(gpsConfigAlreadyRead == false) + if(configAlreadyRead == false) { // Initialize our defaults before reading of configuration file overwrites them. loc_default_parameters(); - // Ee only want to parse the conf file once. This is a good place to ensure that. + // We only want to parse the conf file once. This is a good place to ensure that. // In fact one day the conf file should go into context. UTIL_READ_CONF(GPS_CONF_FILE, loc_parameter_table); - gpsConfigAlreadyRead = true; + UTIL_READ_CONF(SAP_CONF_FILE, loc_parameter_table); + configAlreadyRead = true; } else { LOC_LOGV("GPS Config file has already been read\n"); } diff --git a/loc_api/libloc_api_50001/loc_eng.h b/loc_api/libloc_api_50001/loc_eng.h index 36da419c..e5cb7146 100644 --- a/loc_api/libloc_api_50001/loc_eng.h +++ b/loc_api/libloc_api_50001/loc_eng.h @@ -160,39 +160,44 @@ typedef struct /* GPS.conf support */ typedef struct loc_gps_cfg_s { - unsigned long INTERMEDIATE_POS; - unsigned long ACCURACY_THRES; - unsigned long ENABLE_WIPER; - uint8_t NMEA_PROVIDER; - unsigned long SUPL_VER; - unsigned long CAPABILITIES; - uint8_t GYRO_BIAS_RANDOM_WALK_VALID; - double GYRO_BIAS_RANDOM_WALK; - unsigned long SENSOR_ACCEL_BATCHES_PER_SEC; - unsigned long SENSOR_ACCEL_SAMPLES_PER_BATCH; - unsigned long SENSOR_GYRO_BATCHES_PER_SEC; - unsigned long SENSOR_GYRO_SAMPLES_PER_BATCH; - unsigned long SENSOR_ACCEL_BATCHES_PER_SEC_HIGH; - unsigned long SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH; - unsigned long SENSOR_GYRO_BATCHES_PER_SEC_HIGH; - unsigned long SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH; - unsigned long SENSOR_CONTROL_MODE; - unsigned long SENSOR_USAGE; - unsigned long QUIPC_ENABLED; - unsigned long LPP_PROFILE; - unsigned long SENSOR_ALGORITHM_CONFIG_MASK; - unsigned long A_GLONASS_POS_PROTOCOL_SELECT; - uint8_t ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID; - double ACCEL_RANDOM_WALK_SPECTRAL_DENSITY; - uint8_t ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID; - double ANGLE_RANDOM_WALK_SPECTRAL_DENSITY; - uint8_t RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID; - double RATE_RANDOM_WALK_SPECTRAL_DENSITY; - uint8_t VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID; - double VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY; + unsigned long INTERMEDIATE_POS; + unsigned long ACCURACY_THRES; + unsigned long ENABLE_WIPER; + unsigned long SUPL_VER; + unsigned long CAPABILITIES; + unsigned long QUIPC_ENABLED; + unsigned long LPP_PROFILE; + uint8_t NMEA_PROVIDER; + unsigned long A_GLONASS_POS_PROTOCOL_SELECT; } loc_gps_cfg_s_type; +typedef struct +{ + uint8_t GYRO_BIAS_RANDOM_WALK_VALID; + double GYRO_BIAS_RANDOM_WALK; + unsigned long SENSOR_ACCEL_BATCHES_PER_SEC; + unsigned long SENSOR_ACCEL_SAMPLES_PER_BATCH; + unsigned long SENSOR_GYRO_BATCHES_PER_SEC; + unsigned long SENSOR_GYRO_SAMPLES_PER_BATCH; + unsigned long SENSOR_ACCEL_BATCHES_PER_SEC_HIGH; + unsigned long SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH; + unsigned long SENSOR_GYRO_BATCHES_PER_SEC_HIGH; + unsigned long SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH; + unsigned long SENSOR_CONTROL_MODE; + unsigned long SENSOR_USAGE; + unsigned long SENSOR_ALGORITHM_CONFIG_MASK; + uint8_t ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID; + double ACCEL_RANDOM_WALK_SPECTRAL_DENSITY; + uint8_t ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID; + double ANGLE_RANDOM_WALK_SPECTRAL_DENSITY; + uint8_t RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID; + double RATE_RANDOM_WALK_SPECTRAL_DENSITY; + uint8_t VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID; + double VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY; +} loc_sap_cfg_s_type; + extern loc_gps_cfg_s_type gps_conf; +extern loc_sap_cfg_s_type sap_conf; int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks, diff --git a/utils/loc_cfg.cpp b/utils/loc_cfg.cpp index 1dd4ef22..e4a47722 100644 --- a/utils/loc_cfg.cpp +++ b/utils/loc_cfg.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -56,35 +56,8 @@ static loc_param_s_type loc_parameter_table[] = {"DEBUG_LEVEL", &DEBUG_LEVEL, NULL, 'n'}, {"TIMESTAMP", &TIMESTAMP, NULL, 'n'}, }; - int loc_param_num = sizeof(loc_parameter_table) / sizeof(loc_param_s_type); -/*=========================================================================== -FUNCTION loc_default_parameters - -DESCRIPTION - Resets the parameters to default - -DEPENDENCIES - N/A - -RETURN VALUE - None - -SIDE EFFECTS - N/A -===========================================================================*/ - -static void loc_default_parameters() -{ - /* defaults */ - DEBUG_LEVEL = 3; /* debug level */ - TIMESTAMP = 0; - - /* reset logging mechanism */ - loc_logger_init(DEBUG_LEVEL, TIMESTAMP); -} - /*=========================================================================== FUNCTION trim_space @@ -246,15 +219,14 @@ void loc_read_conf(const char* conf_file_name, loc_param_s_type* config_table, u loc_param_v_type config_value; uint32_t i; - loc_default_parameters(); - if((gps_conf_fp = fopen(conf_file_name, "r")) != NULL) { - LOC_LOGD("%s: using %s", __FUNCTION__, GPS_CONF_FILE); + LOC_LOGD("%s: using %s", __FUNCTION__, conf_file_name); } else { - LOC_LOGW("%s: no %s file found", __FUNCTION__, GPS_CONF_FILE); + LOC_LOGW("%s: no %s file found", __FUNCTION__, conf_file_name); + loc_logger_init(DEBUG_LEVEL, TIMESTAMP); return; /* no parameter file */ } diff --git a/utils/loc_cfg.h b/utils/loc_cfg.h index d9a96f2e..df833389 100644 --- a/utils/loc_cfg.h +++ b/utils/loc_cfg.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -36,11 +36,6 @@ #define LOC_MAX_PARAM_STRING 80 #define LOC_MAX_PARAM_LINE 80 -// Don't want to overwrite the pre-def'ed value -#ifndef GPS_CONF_FILE -#define GPS_CONF_FILE "/etc/gps.conf" //??? platform independent -#endif - #define UTIL_READ_CONF_DEFAULT(filename) \ loc_read_conf((filename), NULL, 0);