This commit is contained in:
kevin 2020-04-16 11:12:18 -04:00
commit f8971f90b1
4 changed files with 32 additions and 16 deletions

View File

@ -312,6 +312,7 @@ 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,6 +325,7 @@ 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
@ -331,7 +333,6 @@ namespace cw
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 )
@ -729,7 +730,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();

View File

@ -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( 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( 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( 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( 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); } cw::rc_t cw::object_t::value( const char*& v ) const { return type->value(this,kCStringTId,&v); }

View File

@ -126,6 +126,7 @@ namespace cw
rc_t value( uint64_t& v ) const; rc_t value( uint64_t& v ) const;
rc_t value( float& v ) const; rc_t value( float& v ) const;
rc_t value( double& v ) const; rc_t value( double& v ) const;
rc_t value( bool& v ) const;
rc_t value( char*& v ) const; rc_t value( char*& v ) const;
rc_t value( const char*& v ) const; rc_t value( const char*& v ) const;