本文整理汇总了C++中OSCMessage::hasError方法的典型用法代码示例。如果您正苦于以下问题:C++ OSCMessage::hasError方法的具体用法?C++ OSCMessage::hasError怎么用?C++ OSCMessage::hasError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSCMessage
的用法示例。
在下文中一共展示了OSCMessage::hasError方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hasError
bool OSCBundle::hasError(){
bool retError = error != OSC_OK;
//test each of the data
for (int i = 0; i < numMessages; i++){
OSCMessage * msg = getOSCMessage(i);
retError |= msg->hasError();
}
return retError;
}
示例2: OSCMessage
OSCMessage & OSCBundle::add(OSCMessage & _msg){
OSCMessage * msg = new OSCMessage(_msg);
if (!msg->hasError()){
//realloc the array to fit the message
OSCMessage ** messageMem = (OSCMessage **) realloc(messages, sizeof(OSCMessage *) * (numMessages + 1));
if (messageMem != NULL){
messages = messageMem;
messages[numMessages] = msg;
numMessages++;
} else {
error = ALLOCFAILED;
}
}
return *msg;
}
示例3: main
int main(int argc, char* argv[]) {
uint32_t seconds = 0;
char udpPacketIn[256];
//uint8_t osc_packet_in[256];
uint8_t i = 0;
int len = 0;
int page = 0;
Timer screenFpsTimer, screenLineTimer, knobPollTimer, pingTimer, upTime;
screenFpsTimer.reset();
knobPollTimer.reset();
screenLineTimer.reset();
pingTimer.reset();
upTime.reset();
// set locale so sorting happens in right order
//std::setlocale(LC_ALL, "en_US.UTF-8");
// for setting real time scheduling
/*struct sched_param par;
par.sched_priority = 10;
printf("settin priority to: %d\n", 10);
if (sched_setscheduler(0,SCHED_FIFO,&par) < 0){
printf("failed to set rt scheduling\n");
}*/
udpSock.setDestination(4000, "localhost");
OSCMessage msgIn;
ui.buildMenu();
ui.drawPatchList();
// send ready to wake up MCU
// MCU is ignoring stuff over serial port until this message comes through
// don't empty the message because it gets sent out periodically incase MCU resets
OSCMessage rdyMsg("/ready");
rdyMsg.add(1);
rdyMsg.send(dump);
// send it a few times just in case
for(i = 0; i<4; i++) {
slip.sendMessage(dump.buffer, dump.length, serial);
usleep(20000); // wait 20 ms
}
//playFirst();
quit = 0;
// full udp -> serial -> serial -> udp
for (;;){
// receive udp, send to serial
len = udpSock.readBuffer(udpPacketIn, 256, 0);
if (len > 0){
msgIn.empty();
for (i = 0; i < len; i++){
msgIn.fill(udpPacketIn[i]);
}
if(!msgIn.hasError()){
msgIn.dispatch("/oled/vumeter", vuMeter, 0);
msgIn.dispatch("/oled/line/1", setPatchScreenLine1, 0);
msgIn.dispatch("/oled/line/2", setPatchScreenLine2, 0);
msgIn.dispatch("/oled/line/3", setPatchScreenLine3, 0);
msgIn.dispatch("/oled/line/4", setPatchScreenLine4, 0);
msgIn.dispatch("/oled/line/5", setPatchScreenLine5, 0);
msgIn.dispatch("/oled/aux/line/1", setAuxScreenLine1, 0);
msgIn.dispatch("/oled/aux/line/2", setAuxScreenLine2, 0);
msgIn.dispatch("/oled/aux/line/3", setAuxScreenLine3, 0);
msgIn.dispatch("/oled/aux/line/4", setAuxScreenLine4, 0);
msgIn.dispatch("/oled/aux/line/5", setAuxScreenLine5, 0);
msgIn.dispatch("/oled/aux/clear", auxScreenClear, 0);
msgIn.dispatch("/ready", sendReady, 0);
msgIn.dispatch("/shutdown", sendShutdown, 0);
msgIn.dispatch("/led", setLED, 0);
msgIn.dispatch("/oled/setscreen", setScreen, 0);
msgIn.dispatch("/reload", reload, 0);
msgIn.dispatch("/quitmother", quitMother, 0);
msgIn.dispatch("/screenshot", screenShot, 0);
msgIn.dispatch("/pgmchg", programChange, 0);
msgIn.dispatch("/getPatchName", getPatchName, 0);
}
else {
printf("bad message\n");
}
msgIn.empty();
}
// receive serial, send udp
if(slip.recvMessage(serial)) {
udpSock.writeBuffer(slip.decodedBuf, slip.decodedLength);
// check if we need to do something with this message
msgIn.empty();
msgIn.fill(slip.decodedBuf, slip.decodedLength);
msgIn.dispatch("/enc", encoderInput, 0);
msgIn.dispatch("/encbut", encoderButton, 0);
msgIn.empty();
//.........这里部分代码省略.........
示例4: main
int main(int argc, char* argv[]) {
uint32_t seconds = 0;
char udpPacketIn[256];
//uint8_t osc_packet_in[256];
uint8_t i = 0;
int len = 0;
UdpSocket udpSock(4001);
udpSock.setDestination(4000, "localhost");
Serial serial;
SLIPEncodedSerial slip;
SimpleWriter dump;
OSCMessage msgIn;
printf("cool\n");
// make an osc object
// the message wants an OSC address as first argument
OSCMessage msg("/sys/renumber");
// msg.add(888);
// this just dumps it into the simple writer dump
msg.send(dump);
printf("\n msg is %d bytes\n", dump.length);
// print it out
for (i = 0; i < dump.length; i++){
printf("%x ", dump.buffer[i]);
}
// UDP send
udpSock.writeBuffer(dump.buffer, dump.length);
// serial send
slip.sendMessage(dump.buffer, dump.length, serial);
printf("\ndone, now gonna receive\n");
// full udp -> serial -> serial -> udp
for (;;){
// receive udp, send to serial
len = udpSock.readBuffer(udpPacketIn, 256, 0);
if (len > 0){
for (i = 0; i < len; i++){
msgIn.fill(udpPacketIn[i]);
}
if(!msgIn.hasError()){
msgIn.dispatch("/thing/test", gotone, 0);
// send it along
msgIn.send(dump);
slip.sendMessage(dump.buffer, dump.length, serial);
}
else {
printf("bad message");
}
msgIn.empty();
}
// receive serial, send udp
if(slip.recvMessage(serial)) {
udpSock.writeBuffer(slip.decodedBuf, slip.decodedLength);
}
// sleep for 1ms
usleep(1000);
} // for;;
}