static int steffen_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS],int16_t bits_per_row[BITBUF_ROWS]) { if (bb[0][0]==0x00 && ((bb[1][0]&0x07)==0x07) && bb[1][0]==bb[2][0] && bb[2][0]==bb[3][0]) { fprintf(stdout, "Remote button event:\n"); fprintf(stdout, "model = Steffan Switch Transmitter, %d bits\n",bits_per_row[1]); fprintf(stdout, "code = %d%d%d%d%d\n", (bb[1][0]&0x80)>>7, (bb[1][0]&0x40)>>6, (bb[1][0]&0x20)>>5, (bb[1][0]&0x10)>>4, (bb[1][0]&0x08)>>3); if ((bb[1][2]&0x0f)==0x0e) fprintf(stdout, "button = A\n"); else if ((bb[1][2]&0x0f)==0x0d) fprintf(stdout, "button = B\n"); else if ((bb[1][2]&0x0f)==0x0b) fprintf(stdout, "button = C\n"); else if ((bb[1][2]&0x0f)==0x07) fprintf(stdout, "button = D\n"); else if ((bb[1][2]&0x0f)==0x0f) fprintf(stdout, "button = ALL\n"); else fprintf(stdout, "button = unknown\n"); if ((bb[1][2]&0xf0)==0xf0) { fprintf(stdout, "state = OFF\n"); } else { fprintf(stdout, "state = ON\n"); } if (debug_output) debug_callback(bb, bits_per_row); return 1; }
static bool printNextDebugMessage() { if (!hasPendingDebugMessage()) { return false; } GLint msgLen = 0; glGetIntegerv(GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB, &msgLen); SCP_vector<GLchar> msg; msg.resize(msgLen + 1); // Includes null character, needs to be removed later GLenum source; GLenum type; GLenum severity; GLuint id; GLsizei length; GLuint numFound = glGetDebugMessageLogARB(1, static_cast<GLsizei>(msg.size()), &source, &type, &id, &severity, &length, &msg[0]); if (numFound < 1) { return false; } debug_callback(source, type, id, severity, length, msg.data(), nullptr); return true; }
static int waveman_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS],int16_t bits_per_row[BITBUF_ROWS]) { /* Two bits map to 2 states, 0 1 -> 0 and 1 1 -> 1 */ int i; uint8_t nb[3] = {0}; if (((bb[0][0]&0x55)==0x55) && ((bb[0][1]&0x55)==0x55) && ((bb[0][2]&0x55)==0x55) && ((bb[0][3]&0x55)==0x00)) { for (i=0 ; i<3 ; i++) { nb[i] |= ((bb[0][i]&0xC0)==0xC0) ? 0x00 : 0x01; nb[i] |= ((bb[0][i]&0x30)==0x30) ? 0x00 : 0x02; nb[i] |= ((bb[0][i]&0x0C)==0x0C) ? 0x00 : 0x04; nb[i] |= ((bb[0][i]&0x03)==0x03) ? 0x00 : 0x08; } fprintf(stdout, "Remote button event:\n"); fprintf(stdout, "model = Waveman Switch Transmitter, %d bits\n",bits_per_row[1]); fprintf(stdout, "id = %c\n", 'A'+nb[0]); fprintf(stdout, "channel = %d\n", (nb[1]>>2)+1); fprintf(stdout, "button = %d\n", (nb[1]&3)+1); fprintf(stdout, "state = %s\n", (nb[2]==0xe) ? "on" : "off"); fprintf(stdout, "%02x %02x %02x\n",nb[0],nb[1],nb[2]); if (debug_output) debug_callback(bb, bits_per_row); return 1; } return 0; }