Commit c515fdd5 authored by Jacob Gladish's avatar Jacob Gladish
Browse files

Merge pull request #1 from brendanlong/warning-fixes

Warning fixes
parents 3dfaaa98 8983e903
*.o
*.swp
moc-adapter
......@@ -94,7 +94,7 @@ QStatus AllJoynAbout::GetDeviceId(std::string& deviceId)
return st;
}
QStatus AllJoynAbout::ReadDeviceId(std::string& deviceId)
QStatus AllJoynAbout::ReadDeviceId(std::string&)
{
// TODO read from config
return ER_FAIL;
......
......@@ -8,8 +8,6 @@ namespace
{
DSB_DECLARE_LOGNAME(DeviceSystemBridge);
shared_ptr<Bridge::DeviceSystemBridge> g_Instance;
int32_t const kWaitTimeoutForAdapterOperation = 20000; //ms
std::string const kDeviceArrivalSignal = "Device_Arrival";
std::string const kDeviceArriaveDeviceHandle = "Device_Handle";
......@@ -25,11 +23,13 @@ namespace
Bridge::DeviceSystemBridge::DeviceSystemBridge(shared_ptr<IAdapter> const& adapter)
: m_alljoynInitialized(false)
, m_adapter(adapter)
, m_adapterSignalListener(new AdapterSignalListener(*this))
{
}
Bridge::DeviceSystemBridge::~DeviceSystemBridge()
{
m_adapterSignalListener->Shutdown();
Shutdown();
m_adapter.reset();
}
......@@ -58,11 +58,6 @@ Leave:
{
Shutdown();
}
else
{
g_Instance = shared_from_this();
m_adapterSignaListener = shared_ptr<AdapterSignalListener>(new AdapterSignalListener(shared_from_this()));
}
return st;
}
......@@ -117,8 +112,6 @@ QStatus Bridge::DeviceSystemBridge::Shutdown()
m_alljoynInitialized = false;
}
g_Instance.reset();
return st;
}
......@@ -162,7 +155,7 @@ Leave:
return ret == 0 ? ER_OK : ER_FAIL;
}
void Bridge::DeviceSystemBridge::OnAdapterSignal(IAdapterSignal const& signal, void* argp)
void Bridge::DeviceSystemBridge::OnAdapterSignal(IAdapterSignal const& signal, void*)
{
// TODO
shared_ptr<IAdapterDevice> adapterDevice;
......@@ -201,15 +194,13 @@ QStatus Bridge::DeviceSystemBridge::RegisterAdapterSignalHandlers(bool isRegiste
{
QStatus st = ER_OK;
shared_ptr<IAdapterSignalListener> listener = dynamic_pointer_cast<IAdapterSignalListener>(g_Instance);
if (isRegister)
{
AdapterSignalVector signals = m_adapter->GetSignals();
for (AdapterSignalVector::const_iterator itr = signals.begin(); itr != signals.end(); ++itr)
{
Bridge::IAdapter::RegistrationHandle handle;
int ret = m_adapter->RegisterSignalListener((*itr)->GetName(), listener, NULL, handle);
int ret = m_adapter->RegisterSignalListener((*itr)->GetName(), m_adapterSignalListener, NULL, handle);
if (ret != 0)
{
DSBLOG_WARN("failed to register signal listener on adapter: 0x%x", st);
......
......@@ -54,25 +54,36 @@ namespace Bridge
class AdapterSignalListener : public IAdapterSignalListener
{
public:
AdapterSignalListener(shared_ptr<DeviceSystemBridge> const& parent)
: m_parent(parent) { }
AdapterSignalListener(DeviceSystemBridge& parent)
: m_parent(parent)
, m_shuttingDown(false)
{
}
virtual void AdapterSignalHandler(IAdapterSignal const& signal, void* argp)
{
shared_ptr<DeviceSystemBridge> dsb = m_parent.lock();
if (dsb)
dsb->OnAdapterSignal(signal, argp);
if (m_shuttingDown)
{
return;
}
m_parent.OnAdapterSignal(signal, argp);
}
void Shutdown()
{
m_shuttingDown = true;
}
private:
weak_ptr<DeviceSystemBridge> m_parent;
DeviceSystemBridge& m_parent;
bool m_shuttingDown;
};
private:
bool m_alljoynInitialized;
shared_ptr<IAdapter> m_adapter;
BridgeDeviceList m_deviceList;
shared_ptr<AdapterSignalListener> m_adapterSignaListener;
shared_ptr<AdapterSignalListener> m_adapterSignalListener;
std::vector<IAdapter::RegistrationHandle> m_registeredSignalListeners;
};
}
......
......@@ -136,7 +136,7 @@ QStatus Bridge::BridgeConfig::FromFile(std::string const& fileName)
xmlFreeDoc(m_doc);
m_doc = doc;
return ER_OK;
return st;
}
QStatus Bridge::BridgeConfig::ToFile(std::string const& fileName)
......
......@@ -6,7 +6,7 @@ QStatus Bridge::BridgeDevice::Shutdown()
return st;
}
QStatus Bridge::BridgeDevice::Initialize(shared_ptr<IAdapterDevice> const& dev)
QStatus Bridge::BridgeDevice::Initialize(shared_ptr<IAdapterDevice> const&)
{
QStatus st = ER_OK;
return st;
......
......@@ -14,7 +14,7 @@ namespace Common
uuid_generate_random(uuid);
#ifdef __linux__
char* s;
char s[37];
#else
uuid_string_t s;
#endif
......
......@@ -16,18 +16,16 @@ LIBXML_INC=/usr/include/libxml2
#ALLJOYN_INSTALL_DIR=/Users/jgladi200/Work/alljoyn/alljoyn-15.04.00-src/build/darwin/x86/debug/dist/cpp
ALLJOYN_INSTALL_DIR=/home/gladish/work/alljoyn-15.09.00-src/build/linux/x86_64/debug/dist/cpp/
CXXFLAGS=-D QCC_OS_GROUP_POSIX -Wall -Wextra -g -std=c++0x -I. -I$(ALLJOYN_INSTALL_DIR)/inc -I$(LIBXML_INC)
CXXFLAGS=-D QCC_OS_GROUP_POSIX -Wall -Wextra -Wno-missing-field-initializers -Wno-deprecated-declarations -g -std=c++0x -I. -I$(ALLJOYN_INSTALL_DIR)/inc -I$(LIBXML_INC)
LDFLAGS=-L $(ALLJOYN_INSTALL_DIR)/lib -lalljoyn -lcrypto -lxml2 -pthread -luuid
DEV_PROVIDER_OBJS=$(patsubst %.cpp, %.o,$(SRCS))
DEV_PROVIDER_OBJS=$(patsubst %.cpp, %.o, $(SRCS))
OBJS=$(DEV_PROVIDER_OBJS)
all: moc-adapter
all: moc-adapter
clean:
$(RM) MockAdapter core DeviceProviders/*.o Bridge/*.o Common/*.o Adapters/MockAdapter/*.o
$(RM) moc-adapter *.o DeviceProviders/*.o Bridge/*.o Common/*.o Adapters/MockAdapter/*.o
moc-adapter: $(OBJS)
$(CXX) -o $@ $^ $(LDFLAGS)
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