4
Fork 0

Added passing of Talker Alias

This commit is contained in:
Artem Prilutskiy 2016-12-07 14:44:04 +03:00
parent ebc4aa16bc
commit 1c8eaa89e7
6 changed files with 47 additions and 1 deletions

View file

@ -117,6 +117,7 @@ int main(int argc, const char* argv[])
if (number == 0)
number = unknown;
proxy.setTalkerID(number);
proxy.setTalkerAlias(call);
syslog(LOG_INFO, "*** Found call-sign: %s (ID: %d)", call, number);
pcre_free_substring(call);

View file

@ -17,6 +17,7 @@
// From PatchCord.h
#define VALUE_CORD_OUTGOING_SOURCE_ID 1
#define VALUE_CORD_INCOMING_SOURCE_ID 4
#define VALUE_CORD_TALKER_ALIAS 7
PatchCordProxy::PatchCordProxy(uint32_t network, uint32_t link)
{
@ -45,6 +46,26 @@ uint32_t PatchCordProxy::getTalkerID()
return getSpecificValue(VALUE_CORD_INCOMING_SOURCE_ID);
}
void PatchCordProxy::setTalkerAlias(const char* value)
{
size_t length = strlen(value);
const uint32_t* data = (const uint32_t*)value;
size_t index = VALUE_CORD_TALKER_ALIAS;
size_t count =
(length / sizeof(uint32_t)) +
((length % sizeof(uint32_t)) > 0);
getContextBanner();
while (count > 0)
{
setSpecificValue(index, *data);
count --;
index ++;
data ++;
}
}
void PatchCordProxy::getContextBanner()
{
DBusMessage* message = dbus_message_new_method_call(

View file

@ -14,6 +14,7 @@ class PatchCordProxy
~PatchCordProxy();
void setTalkerID(uint32_t value);
void setTalkerAlias(const char* value);
uint32_t getTalkerID();
private: