2020-02-12 18:42:22 +00:00
|
|
|
#ifndef cwEuConHost_h
|
|
|
|
#define cwEuConHost_h
|
|
|
|
|
|
|
|
namespace cw
|
|
|
|
{
|
2020-04-07 21:40:08 +00:00
|
|
|
namespace eucon
|
2020-02-12 18:42:22 +00:00
|
|
|
{
|
2020-04-07 21:40:08 +00:00
|
|
|
enum
|
2020-02-12 18:42:22 +00:00
|
|
|
{
|
2020-04-07 21:40:08 +00:00
|
|
|
kUdpSockUserId=1,
|
|
|
|
kTcpSockUserId=2,
|
|
|
|
kBaseSockUserId=3
|
|
|
|
};
|
2020-04-03 14:36:10 +00:00
|
|
|
|
2020-04-07 21:40:08 +00:00
|
|
|
typedef handle<struct eucon_str> handle_t;
|
2020-04-10 01:07:45 +00:00
|
|
|
|
2020-04-07 21:40:08 +00:00
|
|
|
typedef struct args_str
|
|
|
|
{
|
|
|
|
unsigned recvBufByteN; // Socket receive buffer size
|
|
|
|
const char* mdnsIP; // MDNS IP (always: "224.0.0.251")
|
|
|
|
sock::portNumber_t mdnsPort; // MDNS port (always 5353)
|
|
|
|
unsigned sockTimeOutMs; // socket poll time out in milliseconds (also determines the cwEuCon update rate)
|
|
|
|
sock::portNumber_t faderTcpPort; // Fader TCP port (e.g. 49168)
|
|
|
|
unsigned maxSockN; // maximum number of socket to allow in the socket manager
|
|
|
|
unsigned maxFaderBankN; // maximum number of fader banks to support
|
2020-04-17 15:16:52 +00:00
|
|
|
unsigned heartBeatPeriodMs; // time between heart-beat messages from/to the fader banks
|
2020-04-07 21:40:08 +00:00
|
|
|
} args_t;
|
2020-04-03 14:36:10 +00:00
|
|
|
|
2020-04-10 01:07:45 +00:00
|
|
|
// Create the EuCon simulation manager.
|
2020-04-07 21:40:08 +00:00
|
|
|
rc_t create( handle_t& hRef, const args_t& a );
|
2020-04-10 01:07:45 +00:00
|
|
|
|
|
|
|
// Destroy the EuCon simulation manager.
|
2020-04-07 21:40:08 +00:00
|
|
|
rc_t destroy( handle_t& hRef );
|
2020-04-10 01:07:45 +00:00
|
|
|
|
|
|
|
// Update the manager. This function polls the network socket
|
|
|
|
// for incoming information from the FaderBankArray.
|
2020-04-07 21:40:08 +00:00
|
|
|
rc_t exec( handle_t h, unsigned sockTimeOutMs );
|
2020-04-10 01:07:45 +00:00
|
|
|
|
2020-04-16 13:51:38 +00:00
|
|
|
// Are messages from the physical control or from
|
|
|
|
// from the EuCon controller waiting to be read
|
|
|
|
// by the client application.
|
2020-04-10 01:07:45 +00:00
|
|
|
bool areMsgsWaiting( handle_t h );
|
|
|
|
|
2020-04-16 13:51:38 +00:00
|
|
|
// msg flags
|
2020-04-10 01:07:45 +00:00
|
|
|
enum
|
|
|
|
{
|
2020-04-16 13:51:38 +00:00
|
|
|
kWriteValueFl = 0,
|
|
|
|
kReadValueFl = 1
|
2020-04-10 01:07:45 +00:00
|
|
|
};
|
2020-04-16 13:51:38 +00:00
|
|
|
|
|
|
|
// 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
|
|
|
|
};
|
|
|
|
|
2020-04-10 01:07:45 +00:00
|
|
|
|
|
|
|
typedef struct msg_str
|
|
|
|
{
|
2020-04-16 13:51:38 +00:00
|
|
|
unsigned flags;
|
2020-04-10 01:07:45 +00:00
|
|
|
unsigned channel;
|
|
|
|
union
|
|
|
|
{
|
|
|
|
int ivalue;
|
|
|
|
float fvalue;
|
|
|
|
} u;
|
|
|
|
|
|
|
|
} msg_t;
|
|
|
|
|
|
|
|
typedef void (*msgCallback_t)( void* cbArg, const msg_t* msg );
|
|
|
|
|
2020-04-16 13:51:38 +00:00
|
|
|
// Callback with messages for the client application.
|
2020-04-10 01:07:45 +00:00
|
|
|
rc_t getMsgs( handle_t h, msgCallback_t cbFunc, void* cbArg );
|
|
|
|
|
|
|
|
|
2020-04-16 13:51:38 +00:00
|
|
|
// Send a message to the EuCon manager or to a physical control.
|
|
|
|
// Note that flags is formed by <msgTId> | <msgFlags>
|
|
|
|
rc_t sendMsg( handle_t h, unsigned flags, unsigned channel, unsigned ivalue, float fvalue );
|
2020-04-10 01:07:45 +00:00
|
|
|
|
|
|
|
|
2020-04-07 21:40:08 +00:00
|
|
|
rc_t test();
|
2020-02-12 18:42:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|