4
Fork 0

Changes for fixed API

This commit is contained in:
R3ABM Artem 2016-04-05 10:10:54 +03:00
parent 3fd17d12c6
commit 83efcf40d7
6 changed files with 18 additions and 142 deletions

View file

@ -1,4 +1,4 @@
// Copyright 2015 by Artem Prilutskiy
// Copyright 2015-2016 by Artem Prilutskiy
#include "PatchCordProxy.h"
#include <stdlib.h>
@ -7,9 +7,9 @@
#include <syslog.h>
#include <stdio.h>
#define INTERFACE_NAME "me.burnaway.BrandMeister"
#define SERVICE_NAME INTERFACE_NAME
#define SERVICE_NAME "me.burnaway.BrandMeister"
#define OBJECT_PATH "/me/burnaway/BrandMeister"
#define INTERFACE_NAME "me.burnaway.BrandMeister"
// From AutoPatch.cpp
#define AUTOPATCH_LINK_NAME "AutoPatch"
@ -22,7 +22,7 @@ PatchCordProxy::PatchCordProxy(uint32_t network, uint32_t link)
{
banner = NULL;
number = link;
asprintf(&path, OBJECT_PATH "/%d", network);
asprintf(&name, SERVICE_NAME ".network-%d", network);
connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
}
@ -30,7 +30,7 @@ PatchCordProxy::~PatchCordProxy()
{
dbus_connection_unref(connection);
free(banner);
free(path);
free(name);
}
void PatchCordProxy::setTalkerID(uint32_t value)
@ -48,8 +48,7 @@ uint32_t PatchCordProxy::getTalkerID()
void PatchCordProxy::getContextBanner()
{
DBusMessage* message = dbus_message_new_method_call(
SERVICE_NAME, path,
INTERFACE_NAME, "getContextList");
name, OBJECT_PATH, INTERFACE_NAME, "getContextList");
const char* name = AUTOPATCH_LINK_NAME;
@ -84,8 +83,7 @@ void PatchCordProxy::getContextBanner()
void PatchCordProxy::setVendorSpecificValue(uint32_t key, uint32_t value)
{
DBusMessage* message = dbus_message_new_method_call(
SERVICE_NAME, path,
INTERFACE_NAME, "setVendorSpecificValue");
name, OBJECT_PATH, INTERFACE_NAME, "setVendorSpecificValue");
dbus_message_append_args(message,
DBUS_TYPE_STRING, &banner,
@ -111,8 +109,7 @@ void PatchCordProxy::setVendorSpecificValue(uint32_t key, uint32_t value)
uint32_t PatchCordProxy::getVendorSpecificValue(uint32_t key)
{
DBusMessage* message = dbus_message_new_method_call(
SERVICE_NAME, path,
INTERFACE_NAME, "getContextData");
name, OBJECT_PATH, INTERFACE_NAME, "getContextData");
dbus_message_append_args(message,
DBUS_TYPE_STRING, &banner,

View file

@ -19,7 +19,7 @@ class PatchCordProxy
private:
DBusConnection* connection;
char* path;
char* name;
uint32_t number;
char* banner;