From d505a4af5a1875145bc8a36ef3a605ae6a0d1661 Mon Sep 17 00:00:00 2001 From: "kevin.larke" Date: Thu, 9 Apr 2020 21:07:45 -0400 Subject: [PATCH] cwEuCon.h/cpp : Added initial interface for communicating with an an application or UI. --- cwEuCon.cpp | 24 ++++++++++++++++++++++++ cwEuCon.h | 41 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 64 insertions(+), 1 deletion(-) diff --git a/cwEuCon.cpp b/cwEuCon.cpp index f049ef0..4750dcb 100644 --- a/cwEuCon.cpp +++ b/cwEuCon.cpp @@ -714,6 +714,30 @@ cw::rc_t cw::eucon::exec( handle_t h, unsigned sockTimeOutMs ) } +bool cw::eucon::areMsgsWaiting( handle_t h ) +{ + eucon_t* p = _handleToPtr(h); +} + +cw::rc_t cw::eucon::getMsgs( handle_t h, msgCallback_t cbFunc, void* cbArg ) +{ + rc_t rc = kOkRC; + eucon_t* p = _handleToPtr(h); + + return rc; +} + + +cw::rc_t cw::eucon::sendCtlMsg( handle_t h, unsigned ctlTId, unsigned channel, unsigned ivalue, float fvalue ) +{ + rc_t rc = kOkRC; + eucon_t* p = _handleToPtr(h); + + return rc; +} + + + namespace cw { diff --git a/cwEuCon.h b/cwEuCon.h index 8d93bac..6ffde46 100644 --- a/cwEuCon.h +++ b/cwEuCon.h @@ -13,7 +13,7 @@ namespace cw }; typedef handle handle_t; - + typedef struct args_str { unsigned recvBufByteN; // Socket receive buffer size @@ -25,9 +25,48 @@ namespace cw unsigned maxFaderBankN; // maximum number of fader banks to support } args_t; + // Create the EuCon simulation manager. rc_t create( handle_t& hRef, const args_t& a ); + + // Destroy the EuCon simulation manager. rc_t destroy( handle_t& hRef ); + + // Update the manager. This function polls the network socket + // for incoming information from the FaderBankArray. rc_t exec( handle_t h, unsigned sockTimeOutMs ); + + // Are messages waiting + bool areMsgsWaiting( handle_t h ); + + enum + { + kFaderValueTId, + kMuteValueTId, + kTouchValueTId + }; + + typedef struct msg_str + { + unsigned msgTId; + unsigned channel; + union + { + int ivalue; + float fvalue; + } u; + + } msg_t; + + typedef void (*msgCallback_t)( void* cbArg, const msg_t* msg ); + + // Switches the internal double buffer and calls back with the parsed messages. + rc_t getMsgs( handle_t h, msgCallback_t cbFunc, void* cbArg ); + + + // Send a message to a physical control + rc_t sendCtlMsg( handle_t h, unsigned ctlTId, unsigned channel, unsigned ivalue, float fvalue ); + + rc_t test(); } }