Close MDM node on shutdown
Added call to close mdm power node as part of procedure to shutdown CRs-fixed: 640576 Change-Id: Ie0c05272249401f6cf13e9443417b0ba5de1be52
This commit is contained in:
parent
6af016354e
commit
25244b3660
9 changed files with 102 additions and 13 deletions
|
@ -128,4 +128,8 @@ DEFAULT_IMPL(false)
|
||||||
bool LocAdapterBase::
|
bool LocAdapterBase::
|
||||||
requestNiNotify(GpsNiNotification ¬ify, const void* data)
|
requestNiNotify(GpsNiNotification ¬ify, const void* data)
|
||||||
DEFAULT_IMPL(false)
|
DEFAULT_IMPL(false)
|
||||||
|
|
||||||
|
void LocAdapterBase::
|
||||||
|
shutdown()
|
||||||
|
DEFAULT_IMPL()
|
||||||
} // namespace loc_core
|
} // namespace loc_core
|
||||||
|
|
|
@ -100,6 +100,7 @@ public:
|
||||||
virtual bool requestNiNotify(GpsNiNotification ¬ify,
|
virtual bool requestNiNotify(GpsNiNotification ¬ify,
|
||||||
const void* data);
|
const void* data);
|
||||||
inline virtual bool isInSession() { return false; }
|
inline virtual bool isInSession() { return false; }
|
||||||
|
virtual void shutdown();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace loc_core
|
} // namespace loc_core
|
||||||
|
|
|
@ -53,6 +53,10 @@ void LocInternalAdapter::getZppInt() {
|
||||||
sendMsg(new LocEngGetZpp(mLocEngAdapter));
|
sendMsg(new LocEngGetZpp(mLocEngAdapter));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LocInternalAdapter::shutdown() {
|
||||||
|
sendMsg(new LocEngShutdown(mLocEngAdapter));
|
||||||
|
}
|
||||||
|
|
||||||
LocEngAdapter::LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask,
|
LocEngAdapter::LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask,
|
||||||
void* owner, ContextBase* context,
|
void* owner, ContextBase* context,
|
||||||
MsgTask::tCreate tCreator) :
|
MsgTask::tCreate tCreator) :
|
||||||
|
|
|
@ -64,6 +64,7 @@ public:
|
||||||
virtual void stopFixInt();
|
virtual void stopFixInt();
|
||||||
virtual void getZppInt();
|
virtual void getZppInt();
|
||||||
virtual void setUlpProxy(UlpProxyBase* ulp);
|
virtual void setUlpProxy(UlpProxyBase* ulp);
|
||||||
|
virtual void shutdown();
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef void (*loc_msg_sender)(void* loc_eng_data_p, void* msgp);
|
typedef void (*loc_msg_sender)(void* loc_eng_data_p, void* msgp);
|
||||||
|
|
|
@ -74,7 +74,7 @@ static int loc_set_position_mode(GpsPositionMode mode, GpsPositionRecurrence re
|
||||||
uint32_t min_interval, uint32_t preferred_accuracy,
|
uint32_t min_interval, uint32_t preferred_accuracy,
|
||||||
uint32_t preferred_time);
|
uint32_t preferred_time);
|
||||||
static const void* loc_get_extension(const char* name);
|
static const void* loc_get_extension(const char* name);
|
||||||
|
static void loc_close_mdm_node();
|
||||||
// Defines the GpsInterface in gps.h
|
// Defines the GpsInterface in gps.h
|
||||||
static const GpsInterface sLocEngInterface =
|
static const GpsInterface sLocEngInterface =
|
||||||
{
|
{
|
||||||
|
@ -279,7 +279,8 @@ static int loc_init(GpsCallbacks* callbacks)
|
||||||
callbacks->create_thread_cb, /* create_thread_cb */
|
callbacks->create_thread_cb, /* create_thread_cb */
|
||||||
NULL, /* location_ext_parser */
|
NULL, /* location_ext_parser */
|
||||||
NULL, /* sv_ext_parser */
|
NULL, /* sv_ext_parser */
|
||||||
callbacks->request_utc_time_cb /* request_utc_time_cb */};
|
callbacks->request_utc_time_cb, /* request_utc_time_cb */
|
||||||
|
loc_close_mdm_node /*loc_shutdown_cb*/};
|
||||||
|
|
||||||
gps_loc_cb = callbacks->location_cb;
|
gps_loc_cb = callbacks->location_cb;
|
||||||
gps_sv_cb = callbacks->sv_status_cb;
|
gps_sv_cb = callbacks->sv_status_cb;
|
||||||
|
@ -333,6 +334,37 @@ err:
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*===========================================================================
|
||||||
|
FUNCTION loc_close_mdm_node
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
closes mdm_fd which is the modem powerup node obtained in loc_init
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
None
|
||||||
|
|
||||||
|
RETURN VALUE
|
||||||
|
None
|
||||||
|
|
||||||
|
SIDE EFFECTS
|
||||||
|
N/A
|
||||||
|
|
||||||
|
===========================================================================*/
|
||||||
|
static void loc_close_mdm_node()
|
||||||
|
{
|
||||||
|
ENTRY_LOG();
|
||||||
|
if (mdm_fd >= 0) {
|
||||||
|
LOC_LOGD("closing the powerup node");
|
||||||
|
close(mdm_fd);
|
||||||
|
mdm_fd = -1;
|
||||||
|
LOC_LOGD("finished closing the powerup node");
|
||||||
|
} else {
|
||||||
|
LOC_LOGD("powerup node has not been opened yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
EXIT_LOG(%s, VOID_RET);
|
||||||
|
}
|
||||||
|
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
FUNCTION loc_cleanup
|
FUNCTION loc_cleanup
|
||||||
|
|
||||||
|
@ -356,18 +388,10 @@ static void loc_cleanup()
|
||||||
loc_afw_data.adapter->setPowerVote(false);
|
loc_afw_data.adapter->setPowerVote(false);
|
||||||
|
|
||||||
loc_eng_cleanup(loc_afw_data);
|
loc_eng_cleanup(loc_afw_data);
|
||||||
|
loc_close_mdm_node();
|
||||||
gps_loc_cb = NULL;
|
gps_loc_cb = NULL;
|
||||||
gps_sv_cb = NULL;
|
gps_sv_cb = NULL;
|
||||||
|
|
||||||
if (mdm_fd >= 0) {
|
|
||||||
LOC_LOGD("closing the powerup node");
|
|
||||||
close(mdm_fd);
|
|
||||||
mdm_fd = -1;
|
|
||||||
LOC_LOGD("finished closing the powerup node");
|
|
||||||
} else {
|
|
||||||
LOC_LOGD("powerup node has not been opened yet.");
|
|
||||||
}
|
|
||||||
|
|
||||||
EXIT_LOG(%s, VOID_RET);
|
EXIT_LOG(%s, VOID_RET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ extern "C" {
|
||||||
typedef void (*loc_location_cb_ext) (UlpLocation* location, void* locExt);
|
typedef void (*loc_location_cb_ext) (UlpLocation* location, void* locExt);
|
||||||
typedef void (*loc_sv_status_cb_ext) (GpsSvStatus* sv_status, void* svExt);
|
typedef void (*loc_sv_status_cb_ext) (GpsSvStatus* sv_status, void* svExt);
|
||||||
typedef void* (*loc_ext_parser)(void* data);
|
typedef void* (*loc_ext_parser)(void* data);
|
||||||
|
typedef void (*loc_shutdown_cb) (void);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
loc_location_cb_ext location_cb;
|
loc_location_cb_ext location_cb;
|
||||||
|
@ -55,6 +56,7 @@ typedef struct {
|
||||||
loc_ext_parser location_ext_parser;
|
loc_ext_parser location_ext_parser;
|
||||||
loc_ext_parser sv_ext_parser;
|
loc_ext_parser sv_ext_parser;
|
||||||
gps_request_utc_time request_utc_time_cb;
|
gps_request_utc_time request_utc_time_cb;
|
||||||
|
loc_shutdown_cb shutdown_cb;
|
||||||
} LocCallbacks;
|
} LocCallbacks;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -187,7 +187,7 @@ static void loc_eng_handle_engine_up(loc_eng_data_s_type &loc_eng_data) ;
|
||||||
static int loc_eng_start_handler(loc_eng_data_s_type &loc_eng_data);
|
static int loc_eng_start_handler(loc_eng_data_s_type &loc_eng_data);
|
||||||
static int loc_eng_stop_handler(loc_eng_data_s_type &loc_eng_data);
|
static int loc_eng_stop_handler(loc_eng_data_s_type &loc_eng_data);
|
||||||
static int loc_eng_get_zpp_handler(loc_eng_data_s_type &loc_eng_data);
|
static int loc_eng_get_zpp_handler(loc_eng_data_s_type &loc_eng_data);
|
||||||
|
static void loc_eng_handle_shutdown(loc_eng_data_s_type &loc_eng_data);
|
||||||
static void deleteAidingData(loc_eng_data_s_type &logEng);
|
static void deleteAidingData(loc_eng_data_s_type &logEng);
|
||||||
static AgpsStateMachine*
|
static AgpsStateMachine*
|
||||||
getAgpsStateMachine(loc_eng_data_s_type& logEng, AGpsExtType agpsType);
|
getAgpsStateMachine(loc_eng_data_s_type& logEng, AGpsExtType agpsType);
|
||||||
|
@ -327,6 +327,27 @@ void LocEngGetZpp::send() const {
|
||||||
mAdapter->sendMsg(this);
|
mAdapter->sendMsg(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LocEngShutdown::LocEngShutdown(LocEngAdapter* adapter) :
|
||||||
|
LocMsg(), mAdapter(adapter)
|
||||||
|
{
|
||||||
|
locallog();
|
||||||
|
}
|
||||||
|
inline void LocEngShutdown::proc() const
|
||||||
|
{
|
||||||
|
loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mAdapter->getOwner();
|
||||||
|
LOC_LOGD("%s:%d]: Calling loc_eng_handle_shutdown", __func__, __LINE__);
|
||||||
|
loc_eng_handle_shutdown(*locEng);
|
||||||
|
}
|
||||||
|
inline void LocEngShutdown::locallog() const
|
||||||
|
{
|
||||||
|
LOC_LOGV("LocEngShutdown");
|
||||||
|
}
|
||||||
|
inline void LocEngShutdown::log() const
|
||||||
|
{
|
||||||
|
locallog();
|
||||||
|
}
|
||||||
|
|
||||||
// case LOC_ENG_MSG_SET_TIME:
|
// case LOC_ENG_MSG_SET_TIME:
|
||||||
struct LocEngSetTime : public LocMsg {
|
struct LocEngSetTime : public LocMsg {
|
||||||
LocEngAdapter* mAdapter;
|
LocEngAdapter* mAdapter;
|
||||||
|
@ -1521,7 +1542,7 @@ int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks,
|
||||||
loc_eng_data.sv_ext_parser = callbacks->sv_ext_parser ?
|
loc_eng_data.sv_ext_parser = callbacks->sv_ext_parser ?
|
||||||
callbacks->sv_ext_parser : noProc;
|
callbacks->sv_ext_parser : noProc;
|
||||||
loc_eng_data.intermediateFix = gps_conf.INTERMEDIATE_POS;
|
loc_eng_data.intermediateFix = gps_conf.INTERMEDIATE_POS;
|
||||||
|
loc_eng_data.shutdown_cb = callbacks->shutdown_cb;
|
||||||
// initial states taken care of by the memset above
|
// initial states taken care of by the memset above
|
||||||
// loc_eng_data.engine_status -- GPS_STATUS_NONE;
|
// loc_eng_data.engine_status -- GPS_STATUS_NONE;
|
||||||
// loc_eng_data.fix_session_status -- GPS_STATUS_NONE;
|
// loc_eng_data.fix_session_status -- GPS_STATUS_NONE;
|
||||||
|
@ -2606,3 +2627,27 @@ int loc_eng_read_config(void)
|
||||||
EXIT_LOG(%d, 0);
|
EXIT_LOG(%d, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*===========================================================================
|
||||||
|
FUNCTION loc_eng_handle_shutdown
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
Calls the shutdown callback function in the loc interface to close
|
||||||
|
the modem node
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
None
|
||||||
|
|
||||||
|
RETURN VALUE
|
||||||
|
0: success
|
||||||
|
|
||||||
|
SIDE EFFECTS
|
||||||
|
N/A
|
||||||
|
|
||||||
|
===========================================================================*/
|
||||||
|
void loc_eng_handle_shutdown(loc_eng_data_s_type &locEng)
|
||||||
|
{
|
||||||
|
ENTRY_LOG();
|
||||||
|
locEng.shutdown_cb();
|
||||||
|
EXIT_LOG(%d, 0);
|
||||||
|
}
|
||||||
|
|
|
@ -133,6 +133,7 @@ typedef struct loc_eng_data_s
|
||||||
|
|
||||||
loc_ext_parser location_ext_parser;
|
loc_ext_parser location_ext_parser;
|
||||||
loc_ext_parser sv_ext_parser;
|
loc_ext_parser sv_ext_parser;
|
||||||
|
loc_shutdown_cb shutdown_cb;
|
||||||
} loc_eng_data_s_type;
|
} loc_eng_data_s_type;
|
||||||
|
|
||||||
/* GPS.conf support */
|
/* GPS.conf support */
|
||||||
|
|
|
@ -289,6 +289,13 @@ struct LocEngGetZpp : public LocMsg {
|
||||||
void send() const;
|
void send() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct LocEngShutdown : public LocMsg {
|
||||||
|
LocEngAdapter* mAdapter;
|
||||||
|
LocEngShutdown(LocEngAdapter* adapter);
|
||||||
|
virtual void proc() const;
|
||||||
|
void locallog() const;
|
||||||
|
virtual void log() const;
|
||||||
|
};
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
Loading…
Reference in a new issue