11-21-2012 05:25 AM
I am trying to get the serial number of my device. I am quite c++ challenged and am struggling with this. Can someone point me to an example of how to call the deviceinfo.h functions.
More sepcifically I am trying to call deviceinfo_identifying_details_get_serial_number
Here is my failed attempt that does not compile.
Description Resource Path Location Type
cannot convert 'int*' to 'deviceinfo_identifying_details_t*' in initialization
cannot convert 'deviceinfo_identifying_details_t' to 'deviceinfo_identifying_details_t*' for argument '1' to 'long long int deviceinfo_identifying_details_get_serial_number(d
deviceinfo_identifying_details_t * deviceInfo = new deviceInfo();
deviceinfo_get_identifying_details(deviceInfo);
long long deviceinfo_identifying_details_get_serial_number(d eviceInfo);
11-21-2012 08:58 AM
You don't need to malloc or new the deviceinfo_identifying_details_t struct yourself. Use the "get" and "free" functions provided:
long long serial_number = -1;
deviceinfo_identifying_details_t *id_details = NULL;
int rc = deviceinfo_get_identifying_details(&id_details);
if (BPS_SUCCESS == rc) {
serial_number = deviceinfo_identifying_details_get_serial_number(i d_details);
deviceinfo_free_identifying_details(&id_details);
}
Note that your app must have the "read_device_identifying_information" capability. i.e. your bar descriptor must contain the line:
<permission>read_device_identifying_information</p