bool round_finder_delete(RoundFinder* finder) { if (!finder) return false; if (finder->cp) { mupnp_controlpoint_delete(finder->cp); } free(finder); return true; }
MBEG #else int main(int argc, char* argv[]) #endif { mUpnpControlPoint* ctrlPoint; ctrlPoint = mupnp_controlpoint_new(); if (!mupnp_controlpoint_start(ctrlPoint)) { printf("Couldn't start this control point !!"); exit(1); } mupnp_controlpoint_search(ctrlPoint, MUPNP_ST_ROOT_DEVICE); mupnp_sleep(mupnp_controlpoint_getssdpsearchmx(ctrlPoint) * 1000); PrintDMSInfos(ctrlPoint); mupnp_controlpoint_stop(ctrlPoint); mupnp_controlpoint_delete(ctrlPoint); return (0); }
MBEG #else int main( int argc, char* argv[] ) #endif { mUpnpControlPoint *ctrlPoint; int key; ctrlPoint = mupnp_controlpoint_new(); mupnp_controlpoint_setssdplistener(ctrlPoint, SSDPNotifyListner); mupnp_controlpoint_seteventlistener(ctrlPoint, EventListener); if (mupnp_controlpoint_start(ctrlPoint) == false) { printf("Couldn't start this control point !!"); exit(1); } PrintKeyMessage(); #if (!defined(WIN32) || defined(__CYGWIN__)) && !defined(TENGINE) kbinit(); #endif key = 0; do { #if !defined(TENGINE) key = kbgetkey(); key = toupper(key); switch (key) { case 'P': PrintControlPointDevice(ctrlPoint); break; #if !defined(MUPNP_NOUSE_ACTIONCTRL) case 'C': ControlDeviceAlter(ctrlPoint, CMD_NO_ALTERATIONS); break; case 'O': ControlDeviceAlter(ctrlPoint, CMD_LOOP_ACTION_CALLS); break; #endif #if !defined(MUPNP_NOUSE_QUERYCTRL) case 'Q': QueryDevice(ctrlPoint); break; #endif #if !defined(MUPNP_NOUSE_SUBSCRIPTION) case 'S': SubscribeService(ctrlPoint); break; case 'U': UnsubscribeService(ctrlPoint); break; #endif case 'M': SetMXValue(ctrlPoint); break; case 'R': printf("M-Search upnp::rootdevice\n"); mupnp_controlpoint_search(ctrlPoint, MUPNP_ST_ROOT_DEVICE); break; case 'H': printf("M-Search ssdp:all\n"); mupnp_controlpoint_search(ctrlPoint, "ssdp:all"); break; case 'V': printf("M-Search device type\n"); mupnp_controlpoint_search(ctrlPoint, "urn:schemas-upnp-org:device:clock:1"); break; case 'T': printf("M-Search service type\n"); mupnp_controlpoint_search(ctrlPoint, "urn:schemas-upnp-org:service:timer:1"); break; case 'A': { int i; printf("Doing all searches four times...\n"); for (i=0; i<4; i++) { mupnp_controlpoint_search(ctrlPoint, MUPNP_ST_ROOT_DEVICE); mupnp_controlpoint_search(ctrlPoint, "ssdp:all"); mupnp_controlpoint_search(ctrlPoint, "urn:schemas-upnp-org:device:clock:1"); mupnp_controlpoint_search(ctrlPoint, "urn:schemas-upnp-org:service:timer:1"); } printf("Done (doing all searches four times).\n"); } break; case 'X': break; default: PrintKeyMessage(); } #else mupnp_wait(1000); #endif } while( key != 'X'); #if (!defined(WIN32) || defined(__CYGWIN__)) && !defined(TENGINE) kbexit(); #endif mupnp_controlpoint_stop(ctrlPoint); mupnp_controlpoint_delete(ctrlPoint); return(0); }