EXPORT std::list<std::string> libxbee::getModes(void) { xbee_err ret; char **modes; int i; std::list<std::string> modeList; if ((ret = xbee_modeGetList(&modes)) != XBEE_ENONE) throw(ret); for (i = 0; modes[i] != NULL; i++) { modeList.push_back(std::string(modes[i])); } free(modes); return modeList; }
int main(void) { char **modes; int i; if (xbee_modeGetList(&modes) != XBEE_ENONE) { printf("xbee_modeGetList() returned an error...\n"); return 1; } for (i = 0; modes[i]; i++) { printf("mode %d - %s\n", i, modes[i]); } free(modes); return 0; }
int main(void) { char **modes; int i; if (xbee_modeGetList(&modes) != XBEE_ENONE) { printf("xbee_modeGetList() returned an error...\n"); return 1; } for (i = 0; modes[i]; i++) { struct xbee *xbee; char **types; int o; printf("mode %d - %s\n", i, modes[i]); if (!strcmp(modes[i], "net")) continue; if (!strcmp(modes[i], "debug")) continue; if (xbee_setup(&xbee, "debug", modes[i]) != XBEE_ENONE) { printf(" couldn't startup libxbee...\n"); continue; } if (xbee_conGetTypes(xbee, &types) != XBEE_ENONE) { printf(" couldn't get a list of con types...\n"); continue; } for (o = 0; types[o]; o++) { printf(" type %d - %s\n", o, types[o]); } free(types); xbee_shutdown(xbee); } free(modes); return 0; }