/** * Returns the unique device ID if the Id property was included in the required * list of properties when the Provider was constructed. * @returns the device ID as a string */ string Match::getDeviceId() { string result; int bufferSize = ws->dataSet->header.components.count * 10; char *buffer = new char[bufferSize]; fiftyoneDegreesGetDeviceId(ws, buffer, bufferSize); result.assign(buffer); delete buffer; return result; }
/** * Adds a new element to the array with the key Id and the value as the device * Id. * @param returnArray the array being built */ void addDeviceIdToArray(zval *returnArray) { int componentIndex; int bufferLength = FIFTYONE_G(ws)->dataSet->header.components.count * 10; char *buffer = (char *)malloc(bufferLength * sizeof(char)); if (buffer != NULL) { fiftyoneDegreesGetDeviceId(FIFTYONE_G(ws), buffer, bufferLength); add_assoc_string(returnArray, "Id", buffer, 1); free(buffer); } }