Commit 87545692 authored by George Nash's avatar George Nash Committed by Rick Bell

Code Cleanup

Removed commented out code. Most of this code
is old code that used the Resource Container.

Change-Id: I51d9215c1ebcd05deaa06776766908b0a425b3ab
Signed-off-by: George Nash's avatarGeorge Nash <george.nash@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/19019Tested-by: default avatarjenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Larry Sachs's avatarLarry Sachs <larry.j.sachs@intel.com>
Reviewed-by: default avatarRick Bell <richard.s.bell@intel.com>
parent ebd8cf7f
......@@ -21,43 +21,6 @@ using namespace std;
static const string MODULE = "UpnpAttribute";
//UpnpAttributeInfo *UpnpAttribute::getAttributeInfo(std::vector <UpnpAttributeInfo>
// *serviceAttributes,
// std::string attrName)
//{
// vector<UpnpAttributeInfo>::iterator attrInfo;
// for (attrInfo = serviceAttributes->begin() ; attrInfo != serviceAttributes->end() ; ++attrInfo)
// {
// if (attrInfo->name == attrName)
// {
// return &(*attrInfo);
// }
// }
// return nullptr;
//}
//
//bool UpnpAttribute::isValidRequest(map <string, pair <UpnpAttributeInfo *, int>> *attrMap,
// string attrName,
// UpnpActionType actionType)
//
//{
// // Check if the attribute is present
// map <string, pair< UpnpAttributeInfo *, int>>::iterator attr = attrMap->find(attrName);
// if (attr == attrMap->end())
// {
// return false;
// }
//
// // Check that expected action for the attribute has been found
// if ((attr->second.second) & (int) actionType)
// {
// return true;
// }
//
// return false;
//}
void UpnpAttribute::getCb(GUPnPServiceProxy *proxy,
GUPnPServiceProxyAction *actionProxy,
gpointer userData)
......@@ -185,90 +148,3 @@ void UpnpAttribute::setCb(GUPnPServiceProxy *proxy,
UpnpRequest::requestDone(request, status);
}
//bool UpnpAttribute::set(GUPnPServiceProxy *serviceProxy,
// UpnpRequest *request,
// UpnpAttributeInfo *attrInfo,
// RCSResourceAttributes::Value *attrValue)
//{
// GUPnPServiceProxyAction *actionProxy;
// UpnpVar value;
//
// if (attrValue != NULL)
// {
// // Type of the value to be stored can be derived either from
// // input variable type or from state variable type
// GType type = (attrInfo->actions[1].varType != G_TYPE_NONE) ?
// attrInfo->actions[1].varType : attrInfo->type;
//
// switch (type)
// {
// case G_TYPE_STRING:
// {
// const char *sValue = (attrValue->get< string >()).c_str();
// DEBUG_PRINT("resource: " << request->resource->m_uri << ", (string) " << sValue);
// value.var_pchar = (char *) sValue;
// break;
// }
// case G_TYPE_BOOLEAN:
// {
// value.var_boolean = attrValue->get< bool >();
// DEBUG_PRINT("resource: " << request->resource->m_uri << ", (bool) " << value.var_boolean);
// break;
// }
// case G_TYPE_INT:
// case G_TYPE_UINT:
// {
// value.var_int = attrValue->get< int >();
// DEBUG_PRINT("resource: " << request->resource->m_uri << ", (int) " << value.var_int);
// break;
// }
// case G_TYPE_INT64:
// case G_TYPE_UINT64:
// {
// value.var_int64 = attrValue->get< double >();
// DEBUG_PRINT("resource: " << request->resource->m_uri << ", (int64) " << value.var_int64);
// break;
// }
// default:
// {
// //TODO: handle additional types?
// ERROR_PRINT("Type handling not implemented!");
// assert(0);
// }
// }
// }
//
// if (string(attrInfo->actions[1].varName) == "")
// {
// DEBUG_PRINT("action (no args): " << attrInfo->actions[1].name);
// actionProxy = gupnp_service_proxy_begin_action (serviceProxy,
// attrInfo->actions[1].name,
// setCb,
// (gpointer *) request,
// NULL);
// }
// else
// {
// DEBUG_PRINT("action: " << attrInfo->actions[1].name << "( " << attrInfo->actions[1].varName <<
// " )");
// actionProxy = gupnp_service_proxy_begin_action (serviceProxy,
// attrInfo->actions[1].name,
// setCb,
// (gpointer *) request,
// attrInfo->actions[1].varName,
// attrInfo->actions[1].varType,
// value.var_int64,
// NULL);
// }
//
// if (NULL == actionProxy)
// {
// return false;
// }
//
// // Hold on to the attribute info
// request->proxyMap[actionProxy] = attrInfo;
//
// return true;
//}
......@@ -24,14 +24,6 @@
class UpnpAttribute
{
public:
// static UpnpAttributeInfo *getAttributeInfo(std::vector <UpnpAttributeInfo> *serviceAttributes,
// std::string attrName);
//
// static bool isValidRequest(std::map <std::string, std::pair <UpnpAttributeInfo *, int>> *attrMap,
// std::string,
// UpnpActionType actionType);
static void getCb(GUPnPServiceProxy *proxy,
GUPnPServiceProxyAction *action,
gpointer userData);
......@@ -43,12 +35,6 @@ class UpnpAttribute
static void setCb(GUPnPServiceProxy *proxy,
GUPnPServiceProxyAction *action,
gpointer userData);
// static bool set(GUPnPServiceProxy *serviceProxy,
// UpnpRequest *request,
// UpnpAttributeInfo *attrInfo,
// RCSResourceAttributes::Value *attrValue);
};
#endif
......@@ -105,15 +105,12 @@ static const map< string, function< char *(GUPnPDeviceInfo *deviceInfo)>> s_devi
void UpnpDevice::initBasicAttributes(GUPnPDeviceInfo *deviceInfo)
{
// BundleResource::setAttribute("device_type", m_deviceType);
for (auto const &kv : s_deviceInfo2AttributesMap)
{
char *c_field = kv.second(deviceInfo);
if (c_field != NULL)
{
string s_field = string(c_field);
// BundleResource::setAttribute(kv.first, s_field);
g_free(c_field);
}
}
......@@ -121,14 +118,8 @@ void UpnpDevice::initBasicAttributes(GUPnPDeviceInfo *deviceInfo)
char *iconUrl = gupnp_device_info_get_icon_url(deviceInfo, NULL, -1, -1, -1, false, NULL, NULL, NULL, NULL);
if (iconUrl != NULL)
{
// BundleResource::setAttribute("icon_url", string(iconUrl));
g_free(iconUrl);
}
// BundleResource::setAttribute("name",
// m_name); // need to keep name with attributes (OCRepresentation bug)
// BundleResource::setAttribute("uri",
// m_uri); // need to keep uri with attributes (OCRepresentation bug)
}
void UpnpDevice::initAttributes()
......
......@@ -132,8 +132,6 @@ static std::map<std::string, std::string > UpnpUriPrefixMap =
{UPNP_OIC_TYPE_SCHEDULED_RECORDING, UPNP_OIC_URI_PREFIX_SCHEDULED_RECORDING}
};
//typedef std::vector<RCSResourceAttributes> CompositeAttribute;
typedef enum
{
UPNP_ACTION_GET = 1,
......
......@@ -30,17 +30,10 @@ static const string MODULE = "UpnpResource";
UpnpResource::UpnpResource()
{
// m_ready = false;
// m_registered = false;
// m_udn = "";
// m_links.clear();
}
UpnpResource::~UpnpResource()
{
// m_registered = false;
// m_ready = false;
// m_links.clear();
}
void UpnpResource::setRegistered(bool registered)
......@@ -55,14 +48,6 @@ bool UpnpResource::isRegistered()
void UpnpResource::addLink(UpnpResource::Ptr pResource)
{
// RCSResourceAttributes singleLink ;
//
// singleLink["href"] = pResource->m_uri;
// singleLink["rel"] = "contains";
// singleLink["rt"] = pResource->getResourceType();
//
// m_links.push_back(singleLink);
_link singleLink;
singleLink.href = pResource->m_uri;
......@@ -74,11 +59,6 @@ void UpnpResource::addLink(UpnpResource::Ptr pResource)
void UpnpResource::setLinkAttribute()
{
// if (!m_links.empty())
// {
// DEBUG_PRINT("Setting links");
// //BundleResource::setAttribute("links", m_links);
// }
}
std::string UpnpResource::getResourceType()
......
......@@ -62,7 +62,6 @@ class UpnpResource
std::string m_resourceType;
std::string m_interface;
std::string m_address;
// CompositeAttribute m_links;
vector<_link> m_links;
string m_udn;
bool m_ready;
......
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