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