cwEuCon.cpp : Send state changes back to FDR.

This commit is contained in:
kevin.larke 2020-05-17 06:49:03 -04:00
parent 222e058579
commit c4b0b0dba3

View File

@ -315,6 +315,11 @@ namespace cw
struct eucon_str;
typedef struct
{
bool muteFl;
} ch_t;
// FBank object
typedef struct fbank_str
{
@ -327,6 +332,8 @@ namespace cw
time::spec_t nextSendHbTs;
struct fbank_str* link;
uint32_t remoteAddr;
ch_t* chA;
unsigned chN;
} fbank_t;
// EuCon manager object
@ -458,8 +465,11 @@ namespace cw
fb->sockUserId = kBaseSockUserId + fbIndex;
fb->protoState = kSendHandshake_0_Id;
fb->link = p->fbankL;
fb->chN = 8;
fb->chA = mem::allocZ<ch_t>(fb->chN);
p->fbankL = fb;
return fb;
}
@ -510,7 +520,7 @@ namespace cw
char type = 'U';
uint16_t numb = 0;
uint16_t id = 0;
uint16_t ch = 0;
uint16_t chIdx = 0;
unsigned incr = 8;
@ -523,7 +533,7 @@ namespace cw
else
{
uint16_t* v = (uint16_t*)(buf+bi);
ch = ntohs(v[0]);
chIdx = ntohs(v[0]);
id = ntohs(v[1]);
numb = ntohs(v[3]);
@ -538,7 +548,14 @@ namespace cw
break;
case kMuteEuconId:
{
type = 'M';
fb->chA[chIdx].muteFl = !fb->chA[chIdx].muteFl;
if(_send_app_msg(fb, chIdx, kMuteEuconId, !fb->chA[chIdx].muteFl ) != kOkRC )
cwLogError(kOpFailRC,"Send mute msg failed.");
}
break;
case kPingEuconId:
@ -552,13 +569,10 @@ namespace cw
}
}
if( type != 'H' )
printf("%i %i : %c (0x%x) %i (0x%x)\n",fb->fbIndex, ch, type,id,numb,numb);
printf("%i %i : %c (0x%x) %i (0x%x)\n",fb->fbIndex, chIdx, type,id,numb,numb);
bi += incr;
}
}
void _tcpCallback( void* arg, sock::cbOpId_t cbOpId, unsigned userId, unsigned connId, const void* data, unsigned dataByteCnt, const struct sockaddr_in* fromAddr )
@ -744,7 +758,6 @@ namespace cw
}
}
}
}
@ -813,7 +826,6 @@ cw::rc_t cw::eucon::destroy( handle_t& hRef )
hRef.clear();
return rc;
}
cw::rc_t cw::eucon::exec( handle_t h, unsigned sockTimeOutMs )