cwEuCon.h/cpp : Updated comments and code formatting.

This commit is contained in:
kevin.larke 2020-04-16 09:51:38 -04:00
parent 1ecaca7c07
commit cb458168e7
2 changed files with 30 additions and 16 deletions

View File

@ -311,7 +311,8 @@ namespace cw
}; };
struct eucon_str; struct eucon_str;
// FBank object
typedef struct fbank_str typedef struct fbank_str
{ {
struct eucon_str* eucon; struct eucon_str* eucon;
@ -324,14 +325,14 @@ namespace cw
uint32_t remoteAddr; uint32_t remoteAddr;
} fbank_t; } fbank_t;
// EuCon manager object
typedef struct eucon_str typedef struct eucon_str
{ {
sock::handle_t sockMgrH; // socket mgr handle sock::handle_t sockMgrH; // socket mgr handle
fbank_t* fbankL; // List of fader banks fbank_t* fbankL; // List of fader banks
unsigned maxFaderBankN; // maximum number of fader banks unsigned maxFaderBankN; // maximum number of fader banks
unsigned sockTimeOutMs; // socket time out unsigned sockTimeOutMs; // socket time out
unsigned faderTcpPort; // Fader TCP port TODO: we shouuld be getting this from the MDNS SRV record unsigned faderTcpPort; // Fader TCP port TODO: we shouuld be getting this from the MDNS SRV record
} eucon_t; } eucon_t;
inline eucon_t* _handleToPtr( handle_t h ) 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; rc_t rc = kOkRC;
eucon_t* p = _handleToPtr(h); eucon_t* p = _handleToPtr(h);

View File

@ -35,19 +35,31 @@ namespace cw
// for incoming information from the FaderBankArray. // for incoming information from the FaderBankArray.
rc_t exec( handle_t h, unsigned sockTimeOutMs ); 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 ); bool areMsgsWaiting( handle_t h );
// msg flags
enum enum
{ {
kFaderValueTId, kWriteValueFl = 0,
kMuteValueTId, kReadValueFl = 1
kTouchValueTId
}; };
// 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 typedef struct msg_str
{ {
unsigned msgTId; unsigned flags;
unsigned channel; unsigned channel;
union union
{ {
@ -59,12 +71,13 @@ namespace cw
typedef void (*msgCallback_t)( void* cbArg, const msg_t* msg ); 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 ); rc_t getMsgs( handle_t h, msgCallback_t cbFunc, void* cbArg );
// Send a message to a physical control // Send a message to the EuCon manager or to a physical control.
rc_t sendCtlMsg( handle_t h, unsigned ctlTId, unsigned channel, unsigned ivalue, float fvalue ); // Note that flags is formed by <msgTId> | <msgFlags>
rc_t sendMsg( handle_t h, unsigned flags, unsigned channel, unsigned ivalue, float fvalue );
rc_t test(); rc_t test();