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

Developer

API Reference

ISENSORUTIL_ITERNEXTVALUE()

Brew Release
Brew MP 1.0.2
See Also
ISensorUtil_IterCreate ISensorUtil_IterDelete ISensorUtil_IterNumKeys ISensorUtil_IterNumValues ISensorUtil_IterNextKey ISensorUtil_GetValueByDataType
Description
Returns the next value corresponding to the current key from the response command.
Params
_me
[in]:
Pointer to ISensorUtil interface
iter
[in]:
iterator object to be used for this operation.
nValue
[out]:
Next value in the response command.
nTimeStamp
[out]:
Valid only if the timestamp was requested in the request command and the Next value in the iterator was a timestamp value. 0 otherwise.
nValueStr
[]:
[out ] : Valid if the request was a sys command, where the response is a character string instead of a integer. It will be "" if the request was not a sys.
nValueStrLen
[]:
[ in] : size of nValueStr.
nValueStrLenReq
[out]:
number of bytes copied to nValueStr.
bIsValid
[out]:
If nValue is a valid value. 1 = Valid 0 = Invalid
Interface
Prototype
  • AEEResult ISensorUtil_IterNextValue( ISensorUtil* _me, ISensorUtil_iterator iter, int64* nValue, 
                                         uint64* nTimeStamp, char* nValueStr, int nValueStrLen, 
                                         int* nValueStrLenReq, boolean* bIsValid)
    
Return

  • AEE_SUCCESS: if the next value can be returned. AEE_EINVALIDFORMAT : if the response message in the iterator is invalid. AEE_EFAILED: Otherwise
Side Effect
  • None
Comments
Example code: { // Assume pResponseStr has the message //"error=0#accelx=140,accely=1008,accelz=176#get,accelx,accely,accelz" // myIter is the iterator having the pResponseStr ISensorUtil_iterator myIter; int64 nValue; boolean bIsValid; char pDataType[32]; char pSys[32]; uint64 ts; { ISensorUtil_IterNextKey(me, myIter, pDataType, STRLEN(pDataType)+1, &pDataTypeLenReq, NULL, STRLEN(pAttribute)+1, &pAttributeLenReq); // pDataType returns "accelx" first time // pDataType returns "accely" second time // pDataType returns "accelz" third time ISensorUtil_IterNextValue(me, myIter, &nValue, ts, pSys, &bIsValid); } // nValue return 140 first time // bIsValid returns 1 // ts returns 0 first time //sys returns "" first time // nValue return 1008 second time // bIsValid returns 1 // ts returns 0 second time //sys returns "" second time // nValue return 176 third time // bIsValid returns 1 // ts returns 0 third time //sys returns "" third time } Example code: { // Assume pResponseStr has the message //"error=0#ts=1234223,accelx=140#get,ts,accelx" // myIter is the iterator having the pResponseStr ISensorUtil_iterator myIter; int64 nValue; boolean bIsValid; char pDataType[32]; char pSys[32]; uint64 ts; { ISensorUtil_IterNextKey(me, myIter, pDataType, STRLEN(pDataType)+1, &pDataTypeLenReq, NULL, STRLEN(pAttribute)+1, &pAttributeLenReq); // pDataType returns "ts" first time // pDataType returns "accelx" second time ISensorUtil_IterNextValue(me, myIter, &nValue, ts, pSys, &bIsValid); } // nValue return 0 first time // bIsValid returns 1 // ts returns 1234223 first time //sys returns "" first time // nValue return 140 second time // bIsValid returns 1 // ts returns 0 second time //sys returns "" second time } Example code: { // Assume pResponseStr has the message //"error=0#sys=acelx;accely;accelz;pressure;step#get,sys" // myIter is the iterator having the pResponseStr ISensorUtil_iterator myIter; int64 nValue; boolean bIsValid; char pDataType[32]; char pSys[32]; uint64 ts; { ISensorUtil_IterNextKey(me, myIter, pDataType, STRLEN(pDataType)+1, &pDataTypeLenReq, NULL, STRLEN(pAttribute)+1, &pAttributeLenReq); // pDataType returns "sys" first time ISensorUtil_IterNextValue(me, myIter, &nValue, ts, pSys, &bIsValid); } // nValue return 0 first time // bIsValid returns 1 // ts returns 0 first time //sys returns "accelx" first time // nValue return 0 second time // bIsValid returns 1 // ts returns 0 second time //sys returns "accely" second time // nValue return 176 third time // bIsValid returns 1 // ts returns 0 third time //sys returns "accelz" third time // nValue return 176 fourth time // bIsValid returns 1 // ts returns 0 fourth time //sys returns "pressure" fourth time // nValue return 176 fifth time // bIsValid returns 1 // ts returns 0 fifth time //sys returns "step" fifth time }