Add a bunch of APNs
Fork of C027_Support by
Diff: MDM.h
- Revision:
- 73:2b32e0a21df2
- Parent:
- 72:d1e943ad6558
- Child:
- 74:208e3e32d263
--- a/MDM.h Thu May 15 07:06:07 2014 +0000 +++ b/MDM.h Thu May 15 08:25:45 2014 +0000 @@ -282,24 +282,43 @@ // DUMP status to standard out (printf) // ---------------------------------------------------------------- + //! helper type for DPRINT + typedef int (*_DPRINT)(void* param, char const * format, ...); + + //! helper to declate templates and void versions +#define _DUMP_TEMPLATE(func, type, arg) \ + template<class T> \ + inline void func(type arg, \ + int (*dprint)( T* param, char const * format, ...), \ + T* param) { func(arg, (_DPRINT)dprint, (void*)param); } \ + static void func(type arg, \ + _DPRINT dprint = (_DPRINT)fprintf, \ + void* param = (void*)stdout); + /** dump the device status to stdout using printf \param status the status to convert to textual form, unavailable fields are ommited (not printed) + \param dprint a function pointer + \param param the irst argument passed to dprint */ - static void dumpDevStatus(MDMParser::DevStatus *status); + _DUMP_TEMPLATE(dumpDevStatus, MDMParser::DevStatus*, status) /** dump the network status to stdout using printf \param status the status to convert to textual form, unavailable fields are ommited (not printed) + \param dprint a function pointer + \param param the irst argument passed to dprint */ - static void dumpNetStatus(MDMParser::NetStatus *status); - + _DUMP_TEMPLATE(dumpNetStatus, MDMParser::NetStatus*, status) + /** dump the ip address to stdout using printf \param ip the ip to convert to textual form, unavailable fields are ommited (not printed) + \param dprint a function pointer + \param param the irst argument passed to dprint */ - static void dumpIp(MDMParser::IP ip); - + _DUMP_TEMPLATE(dumpIp, MDMParser::IP, ip) + // ---------------------------------------------------------------- // Parseing // ---------------------------------------------------------------- @@ -386,9 +405,9 @@ \sa waitFinalResp */ template<class T> - int waitFinalResp(int (*cb)(int type, const char* buf, int len, - T* param), - T* param, int timeout_ms = 10000) + inline int waitFinalResp(int (*cb)(int type, const char* buf, int len, T* param), + T* param, + int timeout_ms = 10000) { return waitFinalResp((_CALLBACKPTR)cb, (void*)param, timeout_ms); }