修复温度不能获取负值
Change-Id: I5f1ee70905f9c5ae33e10e2a9faeede0a349449e
diff --git a/mbtk/include/mbtk/mbtk_info_api.h b/mbtk/include/mbtk/mbtk_info_api.h
index 6bff940..0c0212a 100755
--- a/mbtk/include/mbtk/mbtk_info_api.h
+++ b/mbtk/include/mbtk/mbtk_info_api.h
@@ -486,6 +486,11 @@
uint32_t oosPhase[3]; //单位为秒
} mbtk_oos_info;
+typedef struct
+{
+ int8 ther;
+} mbtk_thermal_info_t;
+
/**************led enum*********/
typedef enum
{
@@ -905,7 +910,7 @@
* temp[OUT]:
* temperature in celsius.
*/
-int mbtk_temp_get(mbtk_info_handle_t* handle, int type, int* temp);
+int mbtk_temp_get(mbtk_info_handle_t* handle, int type, mbtk_thermal_info_t* temp);
/*
* Set sim power state.
diff --git a/mbtk/liblynq_lib/src/lynq_thermal.c b/mbtk/liblynq_lib/src/lynq_thermal.c
index 08f3073..f3e6e3d 100755
--- a/mbtk/liblynq_lib/src/lynq_thermal.c
+++ b/mbtk/liblynq_lib/src/lynq_thermal.c
@@ -87,6 +87,8 @@
int ret = 0;
int thermal = -1;
int thermal_num = 0;
+ mbtk_thermal_info_t temp;
+ memset(&temp, 0, sizeof(mbtk_thermal_info_t));
ret = qser_thermal_client_init();
if(ret != QSER_RESULT_SUCCESS)
@@ -95,7 +97,8 @@
return QSER_RESULT_FAIL;
}
- ret = mbtk_temp_get(qser_info_handle, 0, &thermal);
+ ret = mbtk_temp_get(qser_info_handle, 0, &temp);
+ thermal = temp.ther;
if(ret != QSER_RESULT_SUCCESS)
{
LOGE("[qser_thermal]mbtk_temp_get fail.");
diff --git a/mbtk/libmbtk_ril/mbtk_info_api.c b/mbtk/libmbtk_ril/mbtk_info_api.c
index 608f9b0..0e4043b 100755
--- a/mbtk/libmbtk_ril/mbtk_info_api.c
+++ b/mbtk/libmbtk_ril/mbtk_info_api.c
@@ -2169,23 +2169,23 @@
* temp[OUT]:
* temperature in celsius.
*/
-int mbtk_temp_get(mbtk_info_handle_t* handle, int type, int* temp)
+int mbtk_temp_get(mbtk_info_handle_t* handle, int type, mbtk_thermal_info_t* temp)
{
if(handle == NULL)
{
LOGE("ARG error.");
return -1;
}
- if(type != 0 && type != 1 || temp == NULL)
+ if(type != 0 && type != 1)
{
return -1;
}
uint8 temp_type = (uint8)type;
- uint8 temp_ptr;
- if(info_item_process(handle, MBTK_INFO_ID_DEV_TEMP_REQ, &temp_type, sizeof(uint8), &temp_ptr) > 0) {
- *temp = temp_ptr;
- LOG("Temperature : %d", *temp);
+
+ if(info_item_process(handle, MBTK_INFO_ID_DEV_TEMP_REQ, &temp_type, sizeof(uint8), temp) > 0) {
+
+ LOG("Temperature : %d", temp->ther);
return 0;
} else {
return handle->info_err;
diff --git a/mbtk/mbtk_rild/src/mbtk_info_server.c b/mbtk/mbtk_rild/src/mbtk_info_server.c
index 78938dc..4379fc0 100755
--- a/mbtk/mbtk_rild/src/mbtk_info_server.c
+++ b/mbtk/mbtk_rild/src/mbtk_info_server.c
@@ -1329,7 +1329,7 @@
OK
*/
-static int req_temp_get(int type, int *temp, int *cme_err)
+static int req_temp_get(int type, mbtk_thermal_info_t *temp, int *cme_err)
{
ATResponse *response = NULL;
int err = -1;
@@ -1363,9 +1363,11 @@
{
goto exit;
}
- *temp = tmp_int;
+ temp->ther = tmp_int;
} else {
- *temp = tmp_int / 1000;
+ tmp_int = tmp_int / 1000;
+ temp->ther = tmp_int;
+ //LOG(" >>>temp =%d",temp->ther);
}
exit:
@@ -4351,7 +4353,8 @@
case MBTK_INFO_ID_DEV_TEMP_REQ: // <string> Temperature
{
if(pack->data_len == sizeof(uint8) && pack->data) {
- int temp;
+ mbtk_thermal_info_t temp;
+ memset(&temp, 0, sizeof(mbtk_thermal_info_t));
if(req_temp_get(*(pack->data), &temp, &cme_err) || cme_err != MBTK_INFO_ERR_CME_NON)
{
if(cme_err != MBTK_INFO_ERR_CME_NON) {
@@ -4363,7 +4366,7 @@
}
else
{
- pack_rsp_send(cli_info->fd, MBTK_INFO_ID_DEV_TEMP_RSP, &temp, sizeof(uint8));
+ pack_rsp_send(cli_info->fd, MBTK_INFO_ID_DEV_TEMP_RSP, &temp, sizeof(mbtk_thermal_info_t));
}
} else {
err = MBTK_INFO_ERR_FORMAT;