API Reference | developer.brewmp.com API Reference | developer.brewmp.com

Developer

API Reference

ISENSORUTIL_ITERNUMVALUES()

Brew Release
Brew MP 1.0.2
See Also
ISensorUtil_IterCreate ISensorUtil_IterDelete ISensorUtil_IterNumKeys ISensorUtil_IterNextKey ISensorUtil_IterNextValue ISensorUtil_GetValueByDataType
Description
Returns the number of values for the specified DataType or Datatype:Attribute pair.
Params
_me
[in]:
Pointer to ISensorUtil interface
iter
[in]:
iterator object to be used for this operation.
pDataType
[in]:
Data type for which number of values are desired. Cannot be NULL.
pDataTypeLen
[in]:
size of pDataType
pAttribute
[in]:
attribute (if applicable) whose value is desired. Can be NULL if attribute is not in the response.
pAttributeLen
[in]:
size of pAttribute.
numValues
[out]:
Number of values for the given data type or attribute
Interface
Prototype
  • AEEResult ISensorUtil_IterNumValues(ISensorUtil* _me, ISensorUtil_iterator iter, 
                                        const char* pDatatype, int pDatatypeLen, 
                                        const char* pAttribute, int pAttributeLen, 
                                        uint32* numValues)
    
Return

  • AEE_SUCCESS: if the number of values can be extracted AEE_EINVALIDFORMAT : if the response message in the iterator is invalid. AEE_EBADPARM : pDataType is NULL or pDataTypeLen is 0. AEE_EFAILED: Otherwise
Side Effect
  • None
Comments
Example code: { // Assume pResponseStr has the message //"error=0#accelx:maxfreq=40,accely=1008,accelz=176#get,accelx,accely,accelz" // myIter is the iterator having the pResponseStr ISensorUtil_iterator myIter; char pDataType[32] = "accelx" char pAttribute[32] = "maxfreq" int numValues; ISensorUtil_IterNumValues(me, myIter, pDatatype, STRLEN(pDatatype)+1, pAttribute, STRLEN(pAttribute), &numValues ); // numValues will return 1 since accelx:maxfreq has 1 value (40) } { // Assume pResponseStr has the message //"error=0#gpsinfo=40;12;32;3;3;2;1#get,gpsinfo" ISensorUtil_iterator myIter; char pDataType[32] = "gpsinfo" int numValues; ISensorUtil_IterNumValues(me, myIter, pDatatype, STRLEN(pDatatype)+1, NULL, 0, &numValues ); // numValues will return 7 since gpsinfo:maxfreq has 7 values (40;12;32;3;3;2;1) }