Skip to content
Snippets Groups Projects
Commit 702ee1f4 authored by Andreas Traczyk's avatar Andreas Traczyk Committed by Andreas Traczyk
Browse files

Add basic functionality for UWP

- adds debug output signal for UWP
- allows UWP app path to passed in during initialization

Change-Id: I7cff8c14a2e710a0784ba9eec5d0237328369e8d
parent 1518c9ff
No related branches found
No related tags found
No related merge requests found
...@@ -26,6 +26,10 @@ SignalHandlerMap& ...@@ -26,6 +26,10 @@ SignalHandlerMap&
getSignalHandlers() getSignalHandlers()
{ {
static SignalHandlerMap handlers = { static SignalHandlerMap handlers = {
#ifdef WIN32_NATIVE
/* UWP Debug */
exported_callback<DRing::Debug::MessageSend>(),
#endif
/* Call */ /* Call */
exported_callback<DRing::CallSignal::StateChange>(), exported_callback<DRing::CallSignal::StateChange>(),
exported_callback<DRing::CallSignal::TransferFailed>(), exported_callback<DRing::CallSignal::TransferFailed>(),
......
...@@ -94,6 +94,16 @@ void acceptEnrollment(const std::string& callID, bool accepted); ...@@ -94,6 +94,16 @@ void acceptEnrollment(const std::string& callID, bool accepted);
/* Instant messaging */ /* Instant messaging */
void sendTextMessage(const std::string& callID, const std::map<std::string, std::string>& messages, const std::string& from, bool isMixed); void sendTextMessage(const std::string& callID, const std::map<std::string, std::string>& messages, const std::string& from, bool isMixed);
#ifdef WIN32_NATIVE
/* Debug for UWP Client */
struct Debug {
struct MessageSend {
constexpr static const char* name = "MessageSend";
using cb_type = void(const std::string&);
};
};
#endif
// Call signal type definitions // Call signal type definitions
struct CallSignal { struct CallSignal {
struct StateChange { struct StateChange {
......
...@@ -46,9 +46,10 @@ const char* version() noexcept; ...@@ -46,9 +46,10 @@ const char* version() noexcept;
* Initialize globals, create underlaying daemon. * Initialize globals, create underlaying daemon.
* *
* @param flags Flags to customize this initialization * @param flags Flags to customize this initialization
* @param app_path Universal Windows Platform Application path
* @returns true if initialization succeed else false. * @returns true if initialization succeed else false.
*/ */
bool init(enum InitFlag flags) noexcept; bool init(enum InitFlag flags, const char* app_path = "") noexcept;
/** /**
* Start asynchronously daemon created by init(). * Start asynchronously daemon created by init().
......
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
#if defined _WIN32 || defined WIN32_NATIVE #if defined _WIN32 || defined WIN32_NATIVE
#include "winsyslog.h" #include "winsyslog.h"
#include "client\ring_signal.h"
#endif #endif
#define BLACK "\033[22;30m" #define BLACK "\033[22;30m"
...@@ -205,6 +206,11 @@ vlogger(const int level, const char *format, va_list ap) ...@@ -205,6 +206,11 @@ vlogger(const int level, const char *format, va_list ap)
std::string ctx(format, sep - format); std::string ctx(format, sep - format);
format = sep + 2; format = sep + 2;
fputs(getHeader(ctx.c_str()).c_str(), stderr); fputs(getHeader(ctx.c_str()).c_str(), stderr);
#ifdef WIN32_NATIVE
char tmp[2048];
vsprintf(tmp, format, ap);
ring::emitSignal<DRing::Debug::MessageSend>(getHeader(ctx.c_str()).c_str() + std::string(tmp));
#endif
#ifndef _WIN32 #ifndef _WIN32
fputs(END_COLOR, stderr); fputs(END_COLOR, stderr);
#else #else
......
...@@ -72,7 +72,11 @@ void strErr(); ...@@ -72,7 +72,11 @@ void strErr();
#define XSTR(X) STR(X) #define XSTR(X) STR(X)
// Line return char in a string // Line return char in a string
#ifdef WIN32_NATIVE
#define ENDL " "
#else
#define ENDL "\n" #define ENDL "\n"
#endif
// Do not remove the "| " in following without modifying vlogger() code // Do not remove the "| " in following without modifying vlogger() code
#ifndef WIN32_NATIVE #ifndef WIN32_NATIVE
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
namespace DRing { namespace DRing {
bool bool
init(enum InitFlag flags) noexcept init(enum InitFlag flags, const char* app_path) noexcept
{ {
::setDebugMode(flags & DRING_FLAG_DEBUG); ::setDebugMode(flags & DRING_FLAG_DEBUG);
::setConsoleLog(flags & DRING_FLAG_CONSOLE_LOG); ::setConsoleLog(flags & DRING_FLAG_CONSOLE_LOG);
...@@ -55,6 +55,9 @@ init(enum InitFlag flags) noexcept ...@@ -55,6 +55,9 @@ init(enum InitFlag flags) noexcept
try { try {
// current implementation use static variable // current implementation use static variable
auto& manager = ring::Manager::instance(); auto& manager = ring::Manager::instance();
#ifdef WIN32_NATIVE
manager.setUWPAppPath(app_path);
#endif
manager.setAutoAnswer(flags & DRING_FLAG_AUTOANSWER); manager.setAutoAnswer(flags & DRING_FLAG_AUTOANSWER);
return true; return true;
} catch (...) { } catch (...) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment