White spaces.

git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@522 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
Marcelo Roberto Jimenez 2010-03-22 09:07:44 +00:00
parent 35392132af
commit c434f275ef
2 changed files with 27 additions and 48 deletions

View File

@ -138,8 +138,7 @@ TvCtrlPointDeleteNode( struct TvDeviceNode *node )
* UDN -- The Unique Device Name for the device to remove * UDN -- The Unique Device Name for the device to remove
* *
********************************************************************************/ ********************************************************************************/
int int TvCtrlPointRemoveDevice(const char *UDN)
TvCtrlPointRemoveDevice(const char *UDN)
{ {
struct TvDeviceNode *curdevnode; struct TvDeviceNode *curdevnode;
struct TvDeviceNode *prevdevnode; struct TvDeviceNode *prevdevnode;
@ -1016,10 +1015,10 @@ void TvCtrlPointHandleSubscribeUpdate(
ithread_mutex_unlock( &DeviceListMutex ); ithread_mutex_unlock( &DeviceListMutex );
} }
void void TvCtrlPointHandleGetVar(
TvCtrlPointHandleGetVar( const char *controlURL, const char *controlURL,
const char *varName, const char *varName,
const DOMString varValue ) const DOMString varValue)
{ {
struct TvDeviceNode *tmpdevnode; struct TvDeviceNode *tmpdevnode;
@ -1030,9 +1029,9 @@ TvCtrlPointHandleGetVar( const char *controlURL,
tmpdevnode = GlobalDeviceList; tmpdevnode = GlobalDeviceList;
while (tmpdevnode) { while (tmpdevnode) {
for (service = 0; service < TV_SERVICE_SERVCOUNT; service++) { for (service = 0; service < TV_SERVICE_SERVCOUNT; service++) {
if (strcmp(tmpdevnode->device.TvService[service].ControlURL, controlURL ) == 0 ) { if (strcmp(tmpdevnode->device.TvService[service].ControlURL, controlURL) == 0) {
SampleUtil_StateUpdate( SampleUtil_StateUpdate(
varName, varValue, tmpdevnode->device.UDN, GET_VAR_COMPLETE ); varName, varValue, tmpdevnode->device.UDN, GET_VAR_COMPLETE);
break; break;
} }
} }
@ -1069,13 +1068,12 @@ int TvCtrlPointCallbackEventHandler(Upnp_EventType EventType, void *Event, void
IXML_Document *DescDoc = NULL; IXML_Document *DescDoc = NULL;
const char *location = NULL; const char *location = NULL;
int errCode = UpnpDiscovery_get_ErrCode(d_event); int errCode = UpnpDiscovery_get_ErrCode(d_event);
if (errCode != UPNP_E_SUCCESS) { if (errCode != UPNP_E_SUCCESS) {
SampleUtil_Print( SampleUtil_Print(
"Error in Discovery Callback -- %d", errCode); "Error in Discovery Callback -- %d", errCode);
} }
location = UpnpString_get_String(UpnpDiscovery_get_Location(d_event));
location = UpnpString_get_String(
UpnpDiscovery_get_Location(d_event));
errCode = UpnpDownloadXmlDoc(location, &DescDoc); errCode = UpnpDownloadXmlDoc(location, &DescDoc);
if (errCode != UPNP_E_SUCCESS) { if (errCode != UPNP_E_SUCCESS) {
SampleUtil_Print( SampleUtil_Print(
@ -1085,19 +1083,15 @@ int TvCtrlPointCallbackEventHandler(Upnp_EventType EventType, void *Event, void
TvCtrlPointAddDevice( TvCtrlPointAddDevice(
DescDoc, location, UpnpDiscovery_get_Expires(d_event)); DescDoc, location, UpnpDiscovery_get_Expires(d_event));
} }
if (DescDoc) {
if( DescDoc ) {
ixmlDocument_free(DescDoc); ixmlDocument_free(DescDoc);
} }
TvCtrlPointPrintList(); TvCtrlPointPrintList();
break; break;
} }
case UPNP_DISCOVERY_SEARCH_TIMEOUT: case UPNP_DISCOVERY_SEARCH_TIMEOUT:
/* Nothing to do here... */ /* Nothing to do here... */
break; break;
case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE: { case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE: {
UpnpDiscovery *d_event = (UpnpDiscovery *)Event; UpnpDiscovery *d_event = (UpnpDiscovery *)Event;
int errCode = UpnpDiscovery_get_ErrCode(d_event); int errCode = UpnpDiscovery_get_ErrCode(d_event);
@ -1106,18 +1100,14 @@ int TvCtrlPointCallbackEventHandler(Upnp_EventType EventType, void *Event, void
if (errCode != UPNP_E_SUCCESS) { if (errCode != UPNP_E_SUCCESS) {
SampleUtil_Print( SampleUtil_Print(
"Error in Discovery ByeBye Callback -- %d", errCode); "Error in Discovery ByeBye Callback -- %d", errCode);
} }
SampleUtil_Print("Received ByeBye for Device: %s", deviceId); SampleUtil_Print("Received ByeBye for Device: %s", deviceId);
TvCtrlPointRemoveDevice(deviceId); TvCtrlPointRemoveDevice(deviceId);
SampleUtil_Print("After byebye:"); SampleUtil_Print("After byebye:");
TvCtrlPointPrintList(); TvCtrlPointPrintList();
break; break;
} }
/* SOAP Stuff */ /* SOAP Stuff */
case UPNP_CONTROL_ACTION_COMPLETE: { case UPNP_CONTROL_ACTION_COMPLETE: {
UpnpActionComplete *a_event = (UpnpActionComplete *)Event; UpnpActionComplete *a_event = (UpnpActionComplete *)Event;
@ -1127,29 +1117,24 @@ int TvCtrlPointCallbackEventHandler(Upnp_EventType EventType, void *Event, void
"Error in Action Complete Callback -- %d", "Error in Action Complete Callback -- %d",
errCode); errCode);
} }
/* No need for any processing here, just print out results. /* No need for any processing here, just print out results.
* Service state table updates are handled by events. */ * Service state table updates are handled by events. */
break; break;
} }
case UPNP_CONTROL_GET_VAR_COMPLETE: { case UPNP_CONTROL_GET_VAR_COMPLETE: {
UpnpStateVarComplete *sv_event = (UpnpStateVarComplete *)Event; UpnpStateVarComplete *sv_event = (UpnpStateVarComplete *)Event;
int errCode = UpnpStateVarComplete_get_ErrCode(sv_event); int errCode = UpnpStateVarComplete_get_ErrCode(sv_event);
if (errCode != UPNP_E_SUCCESS) { if (errCode != UPNP_E_SUCCESS) {
SampleUtil_Print( SampleUtil_Print(
"Error in Get Var Complete Callback -- %d", "Error in Get Var Complete Callback -- %d", errCode);
errCode );
} else { } else {
TvCtrlPointHandleGetVar( TvCtrlPointHandleGetVar(
UpnpString_get_String(UpnpStateVarComplete_get_CtrlUrl(sv_event)), UpnpString_get_String(UpnpStateVarComplete_get_CtrlUrl(sv_event)),
UpnpString_get_String(UpnpStateVarComplete_get_StateVarName(sv_event)), UpnpString_get_String(UpnpStateVarComplete_get_StateVarName(sv_event)),
UpnpStateVarComplete_get_CurrentVal(sv_event) ); UpnpStateVarComplete_get_CurrentVal(sv_event));
} }
break; break;
} }
/* GENA Stuff */ /* GENA Stuff */
case UPNP_EVENT_RECEIVED: { case UPNP_EVENT_RECEIVED: {
UpnpEvent *e_event = (UpnpEvent *)Event; UpnpEvent *e_event = (UpnpEvent *)Event;
@ -1159,26 +1144,23 @@ int TvCtrlPointCallbackEventHandler(Upnp_EventType EventType, void *Event, void
UpnpEvent_get_ChangedVariables(e_event)); UpnpEvent_get_ChangedVariables(e_event));
break; break;
} }
case UPNP_EVENT_SUBSCRIBE_COMPLETE: case UPNP_EVENT_SUBSCRIBE_COMPLETE:
case UPNP_EVENT_UNSUBSCRIBE_COMPLETE: case UPNP_EVENT_UNSUBSCRIBE_COMPLETE:
case UPNP_EVENT_RENEWAL_COMPLETE: { case UPNP_EVENT_RENEWAL_COMPLETE: {
UpnpEventSubscribe *es_event = (UpnpEventSubscribe *)Event; UpnpEventSubscribe *es_event = (UpnpEventSubscribe *)Event;
errCode = UpnpEventSubscribe_get_ErrCode(es_event); errCode = UpnpEventSubscribe_get_ErrCode(es_event);
if (errCode != UPNP_E_SUCCESS) { if (errCode != UPNP_E_SUCCESS) {
SampleUtil_Print( SampleUtil_Print(
"Error in Event Subscribe Callback -- %d", "Error in Event Subscribe Callback -- %d", errCode);
errCode);
} else { } else {
TvCtrlPointHandleSubscribeUpdate( TvCtrlPointHandleSubscribeUpdate(
UpnpString_get_String(UpnpEventSubscribe_get_PublisherUrl(es_event)), UpnpString_get_String(UpnpEventSubscribe_get_PublisherUrl(es_event)),
UpnpString_get_String(UpnpEventSubscribe_get_SID(es_event)), UpnpString_get_String(UpnpEventSubscribe_get_SID(es_event)),
UpnpEventSubscribe_get_TimeOut(es_event)); UpnpEventSubscribe_get_TimeOut(es_event));
} }
break; break;
} }
case UPNP_EVENT_AUTORENEWAL_FAILED: case UPNP_EVENT_AUTORENEWAL_FAILED:
case UPNP_EVENT_SUBSCRIPTION_EXPIRED: { case UPNP_EVENT_SUBSCRIPTION_EXPIRED: {
UpnpEventSubscribe *es_event = (UpnpEventSubscribe *)Event; UpnpEventSubscribe *es_event = (UpnpEventSubscribe *)Event;
@ -1190,24 +1172,22 @@ int TvCtrlPointCallbackEventHandler(Upnp_EventType EventType, void *Event, void
UpnpString_get_String(UpnpEventSubscribe_get_PublisherUrl(es_event)), UpnpString_get_String(UpnpEventSubscribe_get_PublisherUrl(es_event)),
&TimeOut, &TimeOut,
newSID); newSID);
if (errCode == UPNP_E_SUCCESS) { if (errCode == UPNP_E_SUCCESS) {
SampleUtil_Print("Subscribed to EventURL with SID=%s", newSID); SampleUtil_Print("Subscribed to EventURL with SID=%s", newSID);
TvCtrlPointHandleSubscribeUpdate( TvCtrlPointHandleSubscribeUpdate(
UpnpString_get_String(UpnpEventSubscribe_get_PublisherUrl(es_event)), UpnpString_get_String(UpnpEventSubscribe_get_PublisherUrl(es_event)),
newSID, newSID,
TimeOut); TimeOut);
} else { } else {
SampleUtil_Print("Error Subscribing to EventURL -- %d", errCode); SampleUtil_Print("Error Subscribing to EventURL -- %d", errCode);
} }
break; break;
} }
/* ignore these cases, since this is not a device */ /* ignore these cases, since this is not a device */
case UPNP_EVENT_SUBSCRIPTION_REQUEST: case UPNP_EVENT_SUBSCRIPTION_REQUEST:
case UPNP_CONTROL_GET_VAR_REQUEST: case UPNP_CONTROL_GET_VAR_REQUEST:
case UPNP_CONTROL_ACTION_REQUEST: case UPNP_CONTROL_ACTION_REQUEST:
break; break;
} }
return 0; return 0;

View File

@ -1079,8 +1079,7 @@ int TvCtrlPointCallbackEventHandler(Upnp_EventType EventType, void *Event, void
"Error in Discovery Callback -- %d", errCode); "Error in Discovery Callback -- %d", errCode);
} }
location = UpnpString_get_String( location = UpnpString_get_String(UpnpDiscovery_get_Location(d_event));
UpnpDiscovery_get_Location(d_event));
errCode = UpnpDownloadXmlDoc(location, &DescDoc); errCode = UpnpDownloadXmlDoc(location, &DescDoc);
if (errCode != UPNP_E_SUCCESS) { if (errCode != UPNP_E_SUCCESS) {
SampleUtil_Print( SampleUtil_Print(
@ -1111,7 +1110,7 @@ int TvCtrlPointCallbackEventHandler(Upnp_EventType EventType, void *Event, void
if (errCode != UPNP_E_SUCCESS) { if (errCode != UPNP_E_SUCCESS) {
SampleUtil_Print( SampleUtil_Print(
"Error in Discovery ByeBye Callback -- %d", errCode); "Error in Discovery ByeBye Callback -- %d", errCode);
} }
SampleUtil_Print("Received ByeBye for Device: %s", deviceId); SampleUtil_Print("Received ByeBye for Device: %s", deviceId);
@ -1198,10 +1197,10 @@ int TvCtrlPointCallbackEventHandler(Upnp_EventType EventType, void *Event, void
if (errCode == UPNP_E_SUCCESS) { if (errCode == UPNP_E_SUCCESS) {
SampleUtil_Print("Subscribed to EventURL with SID=%s", newSID); SampleUtil_Print("Subscribed to EventURL with SID=%s", newSID);
TvCtrlPointHandleSubscribeUpdate( TvCtrlPointHandleSubscribeUpdate(
UpnpString_get_String(UpnpEventSubscribe_get_PublisherUrl(es_event)), UpnpString_get_String(UpnpEventSubscribe_get_PublisherUrl(es_event)),
newSID, newSID,
TimeOut); TimeOut);
} else { } else {
SampleUtil_Print("Error Subscribing to EventURL -- %d", errCode); SampleUtil_Print("Error Subscribing to EventURL -- %d", errCode);
} }
@ -1212,7 +1211,7 @@ int TvCtrlPointCallbackEventHandler(Upnp_EventType EventType, void *Event, void
case UPNP_EVENT_SUBSCRIPTION_REQUEST: case UPNP_EVENT_SUBSCRIPTION_REQUEST:
case UPNP_CONTROL_GET_VAR_REQUEST: case UPNP_CONTROL_GET_VAR_REQUEST:
case UPNP_CONTROL_ACTION_REQUEST: case UPNP_CONTROL_ACTION_REQUEST:
break; break;
} }
return 0; return 0;