Commit e9166608 authored by Brendan Long's avatar Brendan Long

Fill in ConfigManager::BuildServiceName()

parent 40e02f25
...@@ -322,13 +322,12 @@ bridge::AllJoynHelper::EncodeStringForInterfaceName(std::string const& s, std::s ...@@ -322,13 +322,12 @@ bridge::AllJoynHelper::EncodeStringForInterfaceName(std::string const& s, std::s
t = TrimChar(t, '.'); t = TrimChar(t, '.');
} }
void std::string
bridge::AllJoynHelper::EncodeStringForServiceName(std::string const& s, std::string &t) bridge::AllJoynHelper::EncodeStringForServiceName(std::string const& s)
{ {
std::string t;
std::string temp; std::string temp;
t.clear();
for (char ch : s) for (char ch : s)
{ {
if (std::isalpha(ch)) if (std::isalpha(ch))
...@@ -341,15 +340,15 @@ bridge::AllJoynHelper::EncodeStringForServiceName(std::string const& s, std::str ...@@ -341,15 +340,15 @@ bridge::AllJoynHelper::EncodeStringForServiceName(std::string const& s, std::str
t += '_'; t += '_';
t += temp; t += temp;
} }
return t;
} }
void std::string
bridge::AllJoynHelper::EncodeStringForRootServiceName(std::string const& s, std::string &t) bridge::AllJoynHelper::EncodeStringForRootServiceName(std::string const& s)
{ {
std::string t;
char curr = '\0'; char curr = '\0';
t.clear();
for (char ch : s) for (char ch : s)
{ {
if (std::isalpha(ch) || ch == '.') if (std::isalpha(ch) || ch == '.')
...@@ -367,6 +366,7 @@ bridge::AllJoynHelper::EncodeStringForRootServiceName(std::string const& s, std: ...@@ -367,6 +366,7 @@ bridge::AllJoynHelper::EncodeStringForRootServiceName(std::string const& s, std:
} }
t = TrimChar(t, '.'); t = TrimChar(t, '.');
return t;
} }
std::string std::string
......
...@@ -33,9 +33,9 @@ namespace bridge ...@@ -33,9 +33,9 @@ namespace bridge
static void EncodeBusObjectName(std::string const& s, std::string &builtName); static void EncodeBusObjectName(std::string const& s, std::string &builtName);
static void EncodePropertyOrMethodOrSignalName(std::string const& s, std::string &builtName); static void EncodePropertyOrMethodOrSignalName(std::string const& s, std::string &builtName);
static void EncodeStringForInterfaceName(std::string const& s, std::string& encoded); static void EncodeStringForInterfaceName(std::string const& s, std::string& encoded);
static void EncodeStringForServiceName(std::string const& s, std::string &encoded); static std::string EncodeStringForServiceName(std::string const&);
static void EncodeStringForRootServiceName(std::string const& s, std::string &encoded); static std::string EncodeStringForRootServiceName(std::string const&);
static std::string EncodeStringForAppName(std::string const& s); static std::string EncodeStringForAppName(std::string const&);
static std::string TrimChar(std::string const& s, char c); static std::string TrimChar(std::string const& s, char c);
}; };
......
#include "Bridge/ConfigManager.h" #include "ConfigManager.h"
#include "Bridge/IAdapter.h"
#include "AllJoynHelper.h"
#include "IAdapter.h"
#include "Common/Log.h" #include "Common/Log.h"
using namespace bridge; using namespace bridge;
...@@ -124,8 +126,24 @@ ConfigManager::ConnectToAllJoyn() ...@@ -124,8 +126,24 @@ ConfigManager::ConnectToAllJoyn()
QStatus QStatus
ConfigManager::BuildServiceName() ConfigManager::BuildServiceName()
{ {
DSBLOG_NOT_IMPLEMENTED(); m_serviceName.clear();
return ER_NOT_IMPLEMENTED;
std::string tmp = AllJoynHelper::EncodeStringForRootServiceName(m_adapter.GetExposedAdapterPrefix());
if (tmp.empty()) {
return ER_BUS_BAD_BUS_NAME;
}
m_serviceName = tmp + ".DeviceSystemBridge";
tmp = AllJoynHelper::EncodeStringForServiceName(m_adapter.GetAdapterName());
if (tmp.empty()) {
m_serviceName.empty();
return ER_BUS_BAD_BUS_NAME;
}
m_serviceName += ".";
m_serviceName += tmp;
return ER_OK;
} }
bool bool
......
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