Commit 91f007e8 authored by Larry Sachs's avatar Larry Sachs Committed by Rick Bell

Add name and uri attributes to services

This was done in the UpnpBridge and is expected in the
Android UpnpClient App.

Change-Id: Icc4ff5170fd1e0c5482bc430368f7221f2e2da17
Signed-off-by: Larry Sachs's avatarLarry Sachs <larry.j.sachs@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/18583Tested-by: default avatarjenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: George Nash's avatarGeorge Nash <george.nash@intel.com>
Reviewed-by: default avatarRick Bell <richard.s.bell@intel.com>
parent 5984e508
......@@ -98,7 +98,7 @@ OCEntityHandlerResult UpnpDimming::processGetRequest(OCRepPayload *payload)
}
DEBUG_PRINT(brightnessLevelName << ": " << brightnessLevelValue);
return OC_EH_OK;
return UpnpService::processGetRequest(payload);
}
OCEntityHandlerResult UpnpDimming::processPutRequest(OCEntityHandlerRequest *ehRequest,
......
......@@ -77,7 +77,7 @@ OCEntityHandlerResult UpnpPowerSwitch::processGetRequest(OCRepPayload *payload)
}
DEBUG_PRINT(powerSwitchStateName << ": " << (powerSwitchStateValue ? "true" : "false"));
return OC_EH_OK;
return UpnpService::processGetRequest(payload);
}
OCEntityHandlerResult UpnpPowerSwitch::processPutRequest(OCEntityHandlerRequest *ehRequest,
......
......@@ -31,6 +31,9 @@ using namespace std;
static const string MODULE = "UpnpService";
static const char* nameAttribute = "name";
static const char* uriAttribute = "uri";
UpnpService::UpnpService(GUPnPServiceInfo *serviceInfo,
string type,
UpnpRequestState *requestState,
......@@ -144,11 +147,21 @@ string UpnpService::getStringField(function< char *(GUPnPServiceInfo *serviceInf
return "";
}
OCEntityHandlerResult UpnpService::processGetRequest(OCRepPayload*)
OCEntityHandlerResult UpnpService::processGetRequest(OCRepPayload *payload)
{
ERROR_PRINT("Service processGetRequest() not implemented!");
throw NotImplementedException("Service processGetRequest() not implemented!");
return OC_EH_ERROR;
if (!OCRepPayloadSetPropString(payload, nameAttribute, m_name.c_str()))
{
throw "Failed to set name in payload";
}
DEBUG_PRINT(nameAttribute << ": " << m_name);
if (!OCRepPayloadSetPropString(payload, uriAttribute, m_uri.c_str()))
{
throw "Failed to set uri in payload";
}
DEBUG_PRINT(uriAttribute << ": " << m_uri);
return OC_EH_OK;
}
OCEntityHandlerResult UpnpService::processPutRequest(OCEntityHandlerRequest*,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment