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

Developer

API Reference

ISENSORUTIL_ITERNEXTREQUESTSTRING()

Brew Release
Brew MP 1.0.2
See Also
ISensorUtil_IterCreate
Description
Returns the request string that was echoed as part of the response message.
Params
_me
[in]:
Pointer to ISensorUtil interface
iter
[in]:
iterator object to be used for this operation.
pRequestStr
[out]:
The requested string that was part of the response string.
pRequestStrLen
[in]:
size of pRequestedStr buffer
pRequestStrLenReq
[out]:
a)number of bytes succesfully copied into pRequestStr, if pRequestStrLenReq is less than or equal to pRequestStrLen. [if pRequestStrLenReq <= pRequestStrLen, the response string is complete] or b) number of bytes required to succesfully copy the entire string to pRequestStr, if pRequestStrLenReq is greater than pRequestStrLen [if pRequestStrLenReq > pRequestStrLen, the pRequestStr is incomplete.]
Interface
Prototype
  • AEEResult ISensorUtil_IterNextRequestString(ISensorUtil* _me, ISensorUtil_iterator iter, 
                                                char* pRequestStr, int pRequestStrLen, int* pRequestStrLenReq)
    
Return

  • AEE_SUCCESS: if the response can be parsed for the requested string. AEE_ENOMEMORY: if no memory is allocated for the pRequestStr output parameter. AEE_EINVALIDFORMAT : if the response message in the iterator is invalid. AEE_EFAILED: Otherwise
Side Effect
  • None
Comments
if pRequestStr is non-null and the result would not fit, pRequestStr will contain an incomplete string euqal to the size specified in pRequestStrLen argument. Check pRequestStrLenReq to determine if the pRequestStr is complete or not. pRequestedStr is always null-terminated. Example code: { char *pRequestStr; int pRequestStrLen; int pRequestStrLenReq; // Assume pResponseStr has the message //"error=0#accelx=-198,accely=1008,accelz=176#get,accelx,accely,accelz" // myIter is the iterator having the pResponseStr ISensorUtil_iterator myIter; pRequestStrLen = STRLEN(pResponseStr)+1; pRequestStr = (char *)MALLOC(pRequestStrLen); ISensorUtil_GetRequestedString(pMe, myIter, pRequestStr, pRequestStrLen, &pRequestStrLenReq); // If ISensorUtil_GetRequestedString returns SUCCESS, pRequestStr holds the request string. // pRequestStrLenReq holds the number of bytes succesfully copied into pRequestStr (including // null termination). // If pRequestStrLenReq is less than or equal to pRequestStrLen, pRequeststr is completely formed. // If pRequestStrLenReq is greater than pRequestStrLen, pRequeststr is incomplete. // pRequestStrLenReq is the number of bytes needed to completer create pRequeststr }