From cb458168e74cf792615c6c253338709a773f9c3b Mon Sep 17 00:00:00 2001 From: "kevin.larke" Date: Thu, 16 Apr 2020 09:51:38 -0400 Subject: [PATCH 1/2] cwEuCon.h/cpp : Updated comments and code formatting. --- cwEuCon.cpp | 17 +++++++++-------- cwEuCon.h | 29 +++++++++++++++++++++-------- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/cwEuCon.cpp b/cwEuCon.cpp index 4750dcb..5b3c26a 100644 --- a/cwEuCon.cpp +++ b/cwEuCon.cpp @@ -311,7 +311,8 @@ namespace cw }; struct eucon_str; - + + // FBank object typedef struct fbank_str { struct eucon_str* eucon; @@ -324,14 +325,14 @@ namespace cw uint32_t remoteAddr; } fbank_t; + // EuCon manager object typedef struct eucon_str { - sock::handle_t sockMgrH; // socket mgr handle - fbank_t* fbankL; // List of fader banks - unsigned maxFaderBankN; // maximum number of fader banks - unsigned sockTimeOutMs; // socket time out - unsigned faderTcpPort; // Fader TCP port TODO: we shouuld be getting this from the MDNS SRV record - + sock::handle_t sockMgrH; // socket mgr handle + fbank_t* fbankL; // List of fader banks + unsigned maxFaderBankN; // maximum number of fader banks + unsigned sockTimeOutMs; // socket time out + unsigned faderTcpPort; // Fader TCP port TODO: we shouuld be getting this from the MDNS SRV record } eucon_t; inline eucon_t* _handleToPtr( handle_t h ) @@ -728,7 +729,7 @@ cw::rc_t cw::eucon::getMsgs( handle_t h, msgCallback_t cbFunc, void* cbArg ) } -cw::rc_t cw::eucon::sendCtlMsg( handle_t h, unsigned ctlTId, unsigned channel, unsigned ivalue, float fvalue ) +cw::rc_t cw::eucon::sendMsg( handle_t h, unsigned flags, unsigned channel, unsigned ivalue, float fvalue ) { rc_t rc = kOkRC; eucon_t* p = _handleToPtr(h); diff --git a/cwEuCon.h b/cwEuCon.h index 6ffde46..332f2a0 100644 --- a/cwEuCon.h +++ b/cwEuCon.h @@ -35,19 +35,31 @@ namespace cw // for incoming information from the FaderBankArray. rc_t exec( handle_t h, unsigned sockTimeOutMs ); - // Are messages waiting + // Are messages from the physical control or from + // from the EuCon controller waiting to be read + // by the client application. bool areMsgsWaiting( handle_t h ); + // msg flags enum { - kFaderValueTId, - kMuteValueTId, - kTouchValueTId + kWriteValueFl = 0, + kReadValueFl = 1 }; + + // msg tid + enum + { + kFaderValueTId = 8, // set/get a fader value + kMuteValueTId, // set/get a mute value + kTouchValueTId, // set/get a touch value + kSendStateTId // get the state of a channel + }; + typedef struct msg_str { - unsigned msgTId; + unsigned flags; unsigned channel; union { @@ -59,12 +71,13 @@ namespace cw typedef void (*msgCallback_t)( void* cbArg, const msg_t* msg ); - // Switches the internal double buffer and calls back with the parsed messages. + // Callback with messages for the client application. 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 ); + // Send a message to the EuCon manager or to a physical control. + // Note that flags is formed by | + rc_t sendMsg( handle_t h, unsigned flags, unsigned channel, unsigned ivalue, float fvalue ); rc_t test(); From 97617284334c2f060f8c3bbc3333b0f13bca7c94 Mon Sep 17 00:00:00 2001 From: "kevin.larke" Date: Thu, 16 Apr 2020 11:05:38 -0400 Subject: [PATCH 2/2] cwObject.h/cpp : Enabled 'bool' variables via getv() --- cwObject.cpp | 1 + cwObject.h | 1 + 2 files changed, 2 insertions(+) diff --git a/cwObject.cpp b/cwObject.cpp index 454c95b..48a3a21 100644 --- a/cwObject.cpp +++ b/cwObject.cpp @@ -480,6 +480,7 @@ cw::rc_t cw::object_t::value( int64_t& v ) const { return type->value(this,kInt cw::rc_t cw::object_t::value( uint64_t& v ) const { return type->value(this,kUInt64TId,&v); } cw::rc_t cw::object_t::value( float& v ) const { return type->value(this,kFloatTId,&v); } cw::rc_t cw::object_t::value( double& v ) const { return type->value(this,kDoubleTId,&v); } +cw::rc_t cw::object_t::value( bool& v ) const { return type->value(this,kBoolTId,&v); } cw::rc_t cw::object_t::value( char*& v ) const { return type->value(this,kStringTId,&v); } cw::rc_t cw::object_t::value( const char*& v ) const { return type->value(this,kCStringTId,&v); } diff --git a/cwObject.h b/cwObject.h index 25b1542..41eab29 100644 --- a/cwObject.h +++ b/cwObject.h @@ -126,6 +126,7 @@ namespace cw rc_t value( uint64_t& v ) const; rc_t value( float& v ) const; rc_t value( double& v ) const; + rc_t value( bool& v ) const; rc_t value( char*& v ) const; rc_t value( const char*& v ) const;