mirror of git://git.sysmocom.de/ofono
qmimodem: Add helper function for accessing 64-bit integers
This commit is contained in:
parent
797f3a502e
commit
74d208768a
|
@ -1320,6 +1320,28 @@ bool qmi_result_get_uint32(struct qmi_result *result, uint8_t type,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool qmi_result_get_uint64(struct qmi_result *result, uint8_t type,
|
||||
uint64_t *value)
|
||||
{
|
||||
const unsigned char *ptr;
|
||||
uint16_t len;
|
||||
uint64_t tmp;
|
||||
|
||||
if (!result || !type)
|
||||
return false;
|
||||
|
||||
ptr = tlv_get(result->data, result->length, type, &len);
|
||||
if (!ptr)
|
||||
return false;
|
||||
|
||||
memcpy(&tmp, ptr, 8);
|
||||
|
||||
if (value)
|
||||
*value = GUINT64_FROM_LE(tmp);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
struct service_create_data {
|
||||
struct qmi_device *device;
|
||||
uint8_t type;
|
||||
|
|
|
@ -114,6 +114,8 @@ bool qmi_result_get_uint16(struct qmi_result *result, uint8_t type,
|
|||
uint16_t *value);
|
||||
bool qmi_result_get_uint32(struct qmi_result *result, uint8_t type,
|
||||
uint32_t *value);
|
||||
bool qmi_result_get_uint64(struct qmi_result *result, uint8_t type,
|
||||
uint64_t *value);
|
||||
|
||||
|
||||
struct qmi_service;
|
||||
|
|
Loading…
Reference in New Issue