static void x10ParseCode(void) { int x = 0; int y = 0; for(x=1;x<x10->rawlen-1;x+=2) { x10->binary[y++] = x10->code[x]; } char id[3]; int l = x10letters[binToDecRev(x10->binary, 0, 3)]; int s = x10->binary[18]; int i = 1; int c1 = (binToDec(x10->binary, 0, 7)+binToDec(x10->binary, 8, 15)); int c2 = (binToDec(x10->binary, 16, 23)+binToDec(x10->binary, 24, 31)); if(x10->binary[5] == 1) { i += 8; } if(x10->binary[17] == 1) { i += 4; } i += binToDec(x10->binary, 19, 20); if(c1 == 255 && c2 == 255) { sprintf(id, "%c%d", l, i); x10CreateMessage(id, s); } }
void sartanoParseBinary(void) { int unit = binToDec(sartano.binary, 0, 4); int state = sartano.binary[10]; int check = sartano.binary[11]; int id = binToDec(sartano.binary, 5, 9); if(check != state) sartanoCreateMessage(id, unit, state); }
int main() { int btd; for (int i = 1; i < 11; i++) { cout << decToBin(i) << "\n"; } // btd =01; //1 // cout << binToDec(btd) << "\n"; btd = 1010; //2 cout << binToDec(btd) << "\n"; /* btd = 0011; //3 cout << binToDec(btd) << "\n"; btd = 0100; //4 cout << binToDec(btd) << "\n"; btd = 0101; //5 cout << binToDec(btd) << "\n"; btd = 0110; // cout << binToDec(btd) << "\n"; */ }
int main() { setlocale(LC_ALL, "Russian"); int dec1 = 0; int dec2 = 0; int decSum = 0; printf("¬ведите 2 числа: "); scanf("%d %d", &dec1, &dec2); bool bin1[sizeof(int) * 8] = {0}; bool bin2[sizeof(int) * 8] = {0}; bool binSumMas[sizeof(int) * 8] = {0}; decToBin(dec1, bin1, sizeof(int) * 8); decToBin(dec2, bin2, sizeof(int) * 8); sum(bin1, bin2, sizeof(int) * 8, binSumMas); decSum = binToDec(binSumMas, sizeof(int) * 8); printf("ѕеревод в двоичную систему\n%d = ", dec1); printMas(bin1, sizeof(int) * 8); printf("%d = ", dec2); printMas(bin2, sizeof(int) * 8); printf("—умма в двоичной системе: "); printMas(binSumMas, sizeof(int) * 8); printf("—умма в дестичной системе: %d\n", decSum); return 0; }
static void parseCode(void) { int binary[RAW_LENGTH/4], x = 0, i = 0; for(x=0;x<pollin->rawlen-2;x+=4) { if(pollin->raw[x+3] > (int)((double)AVG_PULSE_LENGTH*((double)PULSE_MULTIPLIER/2))) { binary[i++] = 1; } else { binary[i++] = 0; } } int systemcode = binToDec(binary, 0, 4); int unitcode = binToDec(binary, 5, 9); int state = binary[11]; createMessage(systemcode, unitcode, state); }
int main() { cout << "Please enter the corresponding number with your choice.\n" << "1: Decimal to Binary\n" << "2: Binary to Decimal" << endl; int user_in; int start = 0; cin >> user_in; switch (user_in) { case 1: cout << "Input a number to be converted to binary."<< endl; cin >> user_in; cout << user_in << " converted in to binary is: " << decToBin(user_in) << endl; break; case 2: cout << "Enter the binary number to be converted to decimal." << endl; cin >> user_in; cout << user_in << " converted in to decimal is: " << binToDec(user_in, start) << endl; break; } return 0; }
/*LEAbit changes signed binary numbers into decimals. It is passed an array of length 3 containing an operand, sign-extends it to 16 bit, and if the sign bit is 1, flips all digits and adds 1. The resulting binary string is translated to a digit, and returned. */ int LEAbit(char binaryNumber[]){ int isNegative = binaryNumber[0]; int decimal = 0; char signExt[6] = ""; int i; for(i = 0; i < 2; i++){ if(binaryNumber[0] == '0') signExt[i] = '0'; else signExt[i] = '1'; } signExt[2] = binaryNumber[0]; signExt[3] = binaryNumber[1]; signExt[4] = binaryNumber[2]; if(binaryNumber[0] == '0') binToDec(binaryNumber); else{ i = 0; while(signExt[i]){ if(signExt[i] == '1') signExt[i] = '0'; else signExt[i] = '1'; i++; } if(signExt[4] == '0') signExt[4] = '1'; else if(signExt[3] == '0') signExt[3] = '1'; else if(signExt[2] == '0') signExt[2] = '1'; else if(signExt[1] == '0') signExt[1] = '1'; else if(signExt[0] == '0') signExt[0] = '1'; else for(i = 0; i < 5; i++){ signExt[i] = '0'; } } int currentBit = 16; for(i = 0; i < 5; i++){ if(signExt[i] == '1') decimal += currentBit; currentBit = (currentBit / 2); } if(isNegative == '1') decimal = decimal * -1; return decimal; }
static void parseCode(void) { int binary[RAW_LENGTH/4], x = 0, i = 0; int len = (int)((double)AVG_PULSE_LENGTH*((double)PULSE_MULTIPLIER/2)); for(x=0;x<arctech_screen_old->rawlen-2;x+=4) { if(arctech_screen_old->raw[x+3] > len) { binary[i++] = 0; } else { binary[i++] = 1; } } int unit = binToDec(binary, 0, 3); int state = binary[11]; int id = binToDec(binary, 4, 8); createMessage(id, unit, state); }
static void rev3ParseBinary(void) { int x = 0; /* Convert the one's and zero's into binary */ for(x=0; x<rev3_switch->rawlen; x+=4) { if(rev3_switch->code[x+3] == 1) { rev3_switch->binary[x/4]=1; } else { rev3_switch->binary[x/4]=0; } } int unit = binToDec(rev3_switch->binary, 6, 9); int state = rev3_switch->binary[11]; int id = binToDec(rev3_switch->binary, 0, 5); rev3CreateMessage(id, unit, state); }
static void parseCode(void) { int i = 0, x = 0, binary[RAW_LENGTH/4]; for(i=0; i<pilight_firmware_v2->rawlen; i+=4) { if(pilight_firmware_v2->raw[i+3] < 100) { pilight_firmware_v2->raw[i+3]*=10; } if(pilight_firmware_v2->raw[i+3] > AVG_PULSE_LENGTH*(PULSE_MULTIPLIER/2)) { binary[x++] = 1; } else { binary[x++] = 0; } } int version = binToDec(binary, 0, 15); int high = binToDec(binary, 16, 31); int low = binToDec(binary, 32, 47); createMessage(version, high, low); }
// I wrote this portion of the code myself. char * processJFormat (char string[]) // Returns the assembly language string associated with the 32 byte command. { static char returnString[BUFSIZ]; int opCode = binToDec(string, 0, 5); int address = binToDec(string, 6, 31); if ( opCode == 2 ) { sprintf(returnString, "j %d \n", address); } else { sprintf(returnString, "jal %d \n", address); } return returnString; }
static void rc101ParseCode(void) { int i = 0, x = 0; for(i=0;i<rc101->rawlen; i+=2) { rc101->binary[x++] = rc101->code[i]; } int id = binToDec(rc101->binary, 0, 19); int state = rc101->binary[20]; int unit = 7-binToDec(rc101->binary, 21, 23); int all = 0; if(unit == 7 && state == 1) { all = 1; state = 0; } if(unit == 6 && state == 0) { all = 1; state = 1; } rc101CreateMessage(id, state, unit, all); }
void impulsParseCode(void) { int x = 0; int systemcode = binToDec(impuls->binary, 0, 4); int programcode = binToDec(impuls->binary, 5, 9); int check = impuls->binary[10]; int state = impuls->binary[11]; /* Convert the one's and zero's into binary */ for(x=0; x<(int)(double)impuls->rawlen; x+=4) { if(impuls->code[x+3] == 1 || impuls->code[x+0] == 1) { impuls->binary[x/4]=1; } else { impuls->binary[x/4]=0; } } if(check != state) { impulsCreateMessage(systemcode, programcode, state); } }
static void parseCode(void) { int x = 0, i = 0, binary[RAW_LENGTH/4]; /* Convert the one's and zero's into binary */ for(x=0;x<rsl366->rawlen-2;x+=4) { if(rsl366->raw[x+3] > (int)((double)AVG_PULSE_LENGTH*((double)PULSE_MULTIPLIER/2)) || rsl366->raw[x+0] > (int)((double)AVG_PULSE_LENGTH*((double)PULSE_MULTIPLIER/2))) { binary[i++]=1; } else { binary[i++]=0; } } int systemcode = binToDec(binary, 0, 4); int programcode = binToDec(binary, 5, 9); // There seems to be no check and binary[10] is always a low int state = binary[11]^1; createMessage(systemcode, programcode, state); }
unsigned int binToDec(string binary, unsigned int i = 0) { int sscript = 0; if (i < binary.length()) { if (binary[i] == '1') { sscript = pow(2, i); } return (sscript + binToDec(binary, i++); } }
static void parseCode(void) { int x = 0, binary[RAW_LENGTH/4]; /* Convert the one's and zero's into binary */ for(x=0;x<impuls->rawlen-2;x+=4) { if(impuls->raw[x+3] > (int)((double)AVG_PULSE_LENGTH*((double)PULSE_MULTIPLIER/2)) || impuls->raw[x+0] > (int)((double)AVG_PULSE_LENGTH*((double)PULSE_MULTIPLIER/2))) { binary[x/4]=1; } else { binary[x/4]=0; } } int systemcode = binToDec(binary, 0, 4); int programcode = binToDec(binary, 5, 9); int check = binary[10]; int state = binary[11]; if(check != state) { createMessage(systemcode, programcode, state); } }
static void parseCode(void) { int binary[RAW_LENGTH/4], x = 0; if(elro_800_switch->rawlen>RAW_LENGTH) { logprintf(LOG_ERR, "elro_800_switch: parsecode - invalid parameter passed %d", elro_800_switch->rawlen); return; } for(x=0;x<elro_800_switch->rawlen-2;x+=4) { if(elro_800_switch->raw[x+3] > (int)((double)AVG_PULSE_LENGTH*((double)PULSE_MULTIPLIER/2))) { binary[x/4] = 1; } else { binary[x/4] = 0; } } int systemcode = binToDec(binary, 0, 4); int unitcode = binToDec(binary, 5, 9); int check = binary[10]; int state = binary[11]; // second part of systemcode based on Med for(x=0;x<=16;x+=4) { if(elro_800_switch->raw[x+0] > (int)((double)AVG_PULSE_LENGTH*((double)PULSE_MULTIPLIER/2))) { binary[x/4] = 1; } else { binary[x/4] = 0; } } int systemcode2 = binToDec(binary, 0, 4); systemcode |= (systemcode2<<5); if(check != state) { createMessage(systemcode, unitcode, state); } }
static void ehomeParseCode(void) { int i = 0; for(i=0; i<ehome->rawlen; i+=4) { if(ehome->code[i+3] == 1) { ehome->binary[i/4]=1; } else { ehome->binary[i/4]=0; } } int id = binToDec(ehome->binary, 1, 3); int state = ehome->binary[0]; ehomeCreateMessage(id, state); }
static void parseCode(void) { int i = 0, x = 0, binary[RAW_LENGTH/4]; for(i=0;i<pilight_firmware_v3->rawlen;i+=4) { if(pilight_firmware_v3->raw[i+3] < 100) { pilight_firmware_v3->raw[i+3]*=10; } if(pilight_firmware_v3->raw[i+3] > AVG_PULSE_LENGTH*(PULSE_MULTIPLIER/2)) { binary[x++] = 1; } else { binary[x++] = 0; } } int version = binToDec(binary, 0, 15); int high = binToDec(binary, 16, 31); int low = binToDec(binary, 32, 47); int chk = binToDec(binary, 48, 51); int lpf = low; int hpf = high; int ver = version; while(hpf > 10) { hpf /= 10; } while(lpf > 10) { lpf /= 10; } while(ver > 10) { ver /= 10; } if((((ver&0xf)+(lpf&0xf)+(hpf&0xf))&0xf) == chk) { createMessage(version, high, low); } }
/* FIXME YOU NEED TO GET A BIT STRING FROM THE INDEXES AND DO A BINTODEC CONVERSION AND USE THAT INDEX */ int getNeighborsCount(Generations* g, int cell_pos) { char bitString[4]; int n_index; if(cell_pos<1){ bitString[2] = '0'; bitString[1] = g->current[cell_pos]; bitString[0] = g->current[cell_pos+1]; bitString[3] = '\0'; }else if(cell_pos<g->width-1){ bitString[2] = g->current[cell_pos-1]; bitString[1] = g->current[cell_pos]; bitString[0] = g->current[cell_pos+1]; bitString[3] = '\0'; }else{ bitString[2] = g->current[cell_pos-1]; bitString[1] = g->current[cell_pos]; bitString[0] = '0'; bitString[3] = '\0'; } /*rev(bitString);*/ n_index = binToDec(bitString); return n_index; }
void alectoParseCode(void) { int i = 0, x = 0, a = 0xf; int temperature; int negative; int humidity; int battery; int id; for(i=1;i<alecto->rawLength-1;i+=2) { alecto->binary[x++] = alecto->code[i]; } for(i=0;i<x-4;i+=4) { a-=binToDec(alecto->binary, i, i+3); } if(binToDec(alecto->binary, 32, 35) == (a&0xf)) { id = binToDec(alecto->binary, 0, 7); if(alecto->binary[11] == 1) battery = 1; else battery = 0; temperature = binToDec(alecto->binary, 12, 22); if(alecto->binary[23] == 1) negative=1; else negative=0; humidity = ((binToDec(alecto->binary, 28, 31)*10)+binToDec(alecto->binary, 24, 27)); alecto->message = json_mkobject(); json_append_member(alecto->message, "id", json_mknumber(id)); json_append_member(alecto->message, "battery", json_mknumber(battery)); if(negative==1) json_append_member(alecto->message, "temperature", json_mknumber(temperature)); else json_append_member(alecto->message, "temperature", json_mknumber(temperature/-1)); json_append_member(alecto->message, "humidity", json_mknumber(humidity)); } }
// I wrote this portion of the code myself. char * processRFormat (char string[]) // Returns the assembly language string associated with the 32 byte command. { static char returnString[BUFSIZ]; char * destReg = getRegName(binToDec(string, 6, 10)); char * srcReg1 = getRegName(binToDec(string, 11, 15)); char * srcReg2 = getRegName(binToDec(string, 16, 20)); int shftAmnt = binToDec(string, 21, 25); int functCode = binToDec(string, 26, 31); if ( functCode == 0 ) { sprintf(returnString, "sll %s, %s, %d \n", srcReg1, srcReg2, shftAmnt); } else if ( functCode == 2 ) { sprintf(returnString, "sll %s, %s, %d \n", srcReg1, srcReg2, shftAmnt); } else if ( functCode == 8 ) { sprintf(returnString, "jr %s \n", srcReg1); } else if ( functCode == 32 ) { sprintf(returnString, "add %s, %s, %s \n", destReg, srcReg1, srcReg2); } else if ( functCode == 33 ) { sprintf(returnString, "addu %s, %s, %s \n", destReg, srcReg1, srcReg2); } else if ( functCode == 34 ) { sprintf(returnString, "sub %s, %s, %s \n", destReg, srcReg1, srcReg2); } else if ( functCode == 35 ) { sprintf(returnString, "subu %s, %s, %s \n", destReg, srcReg1, srcReg2); } else if ( functCode == 36 ) { sprintf(returnString, "and %s, %s, %s \n", destReg, srcReg1, srcReg2); } else if ( functCode == 37 ) { sprintf(returnString, "or %s, %s, %s \n", destReg, srcReg1, srcReg2); } else if ( functCode == 39 ) { sprintf(returnString, "nor %s, %s, %s \n", destReg, srcReg1, srcReg2); } else if ( functCode == 42 ) { sprintf(returnString, "slt %s, %s, %s \n", destReg, srcReg1, srcReg2); } else if ( functCode == 43 ) { sprintf(returnString, "sltu %s, %s, %s \n", destReg, srcReg1, srcReg2); } else { sprintf(returnString, "Unrecognizable functcode.\n"); } return returnString; }
/*getOps() finds the opcode of each instruction passed as a parameter as newCommand[]. Once the opcode is found, it calls opcodeToInstruction() with the opcode as a parameter, which identifies and prints the instruction. Then the function finds the operands and and destination register, and prints them. */ int getOps(char newCommand[], char *address){ char tempArray[100] = ""; char opcode[5] = ""; char operand1[4] = ""; char operand2[17] = ""; char destination[4] = ""; char nBit[2] = ""; char zBit[2] = ""; char pBit[2] = ""; strcpy(tempArray, newCommand); memcpy(opcode, tempArray, 4); if(strcmp(opcode, "0000") == 0){ printf("br"); tempArray[0] = tempArray[4]; memcpy(nBit, tempArray, 1); if(nBit[0] == '1') printf("n"); tempArray[0] = tempArray[5]; memcpy(zBit, tempArray, 1); if(zBit[0] == '1') printf("z"); tempArray[0] = tempArray[6]; memcpy(pBit, tempArray, '1'); if(pBit[0] == '1') printf("p"); printf(" 0x%s\n", address); return 0; } if(strcmp(opcode, "1100") == 0){ tempArray[0] = tempArray[7]; tempArray[1] = tempArray[8]; tempArray[2] = tempArray[9]; memcpy(operand1, tempArray, 3); } else{ tempArray[0] = tempArray[4]; tempArray[1] = tempArray[5]; tempArray[2] = tempArray[6]; memcpy(destination, tempArray, 3); tempArray[0] = tempArray[7]; tempArray[1] = tempArray[8]; tempArray[2] = tempArray[9]; memcpy(operand1, tempArray, 3); tempArray[0] = tempArray[13]; tempArray[1] = tempArray[14]; tempArray[2] = tempArray[15]; memcpy(operand2, tempArray, 3); } if(tempArray[10] == '0'){ if(strcmp(opcode, "1100") == 0){ opcodeToInstruction(opcode); printf(" r%d\n", binToDec(operand1)); } else{ opcodeToInstruction(opcode); printf(" r%d,r%d,r%d\n", binToDec(destination), binToDec(operand1), binToDec(operand2)); } } else{ opcodeToInstruction(opcode); printf(" r%d,r%d,%d\n", binToDec(destination), binToDec(operand1), LEAbit(operand2)); } return 0; }
int main(int argc, char *argv[]) { int i; int digitCount = 0; int inputLength; if(argc != 4) /*If no/too few input arguments are given, OR there's more than 3 arguments passed to the program:*/ { fprintf(stderr,"Error: Invalid number of arguments passed.\n"); /*Standard error is printed and help function is run.*/ help(); } else { if(strcmp(argv[1],"-b") != 0 && strcmp(argv[1],"-d") != 0 && strcmp(argv[1],"-h") != 0 && strcmp(argv[1],"-o") != 0 && strcmp(argv[3],"-b") != 0 && strcmp(argv[3],"-d") != 0 && strcmp(argv[3],"-h") != 0 && strcmp(argv[3],"-o") != 0) /*Checks that both the input and output arguments are valid ones.*/ { fprintf(stderr,"Error: Invalid input or output type argument given.\n"); help(); } else { if(strcmp(argv[1],"-b") == 0) /*If the input value is -b for binary:*/ { inputLength = strlen(argv[2]); for(i = 0; i != inputLength; i++) /*Checks the valid input of 1s and 0s are given.*/ { if (argv[2][i] != '0' && argv[2][i] != '1' && argv[2][i] != '.') { fprintf(stderr,"Error: Binary values can only consist of 1\'s or 0\'s.\n"); help(); } if(argv[2][i] != '.') /*Counts the number of digits to ensure the input length is not more than 8 (excluding the decimal point)*/ digitCount++; } if(digitCount > 8) { fprintf(stderr,"Error: Maximum number of digits exceeded.\n"); help(); } if(strcmp(argv[3],"-b") == 0) /*If user wants to go from binary to binary, it prints the input string.*/ printf("%s\n",argv[2]); if(strcmp(argv[3],"-d") == 0) printf("%G\n",binToDec(argv[2])); /*If the user wants to go from binary to decimal, it executes the correct function and prints type double with the proper number of decimal places.*/ if(strcmp(argv[3],"-h") == 0) printf("%s\n",binToHex(argv[2])); if(strcmp(argv[3],"-o") == 0) printf("%s\n",binToOct(argv[2])); } if(strcmp(argv[1],"-d") == 0) /*If the input type is decimal, does the same checks as if the input type was binary but instead checks that each digit is a valid base 10 number.*/ { inputLength = strlen(argv[2]); for(i = 0; i != inputLength; i++) { if (argv[2][i] != '0' && argv[2][i] != '1' && argv[2][i] != '2' && argv[2][i] != '3' && argv[2][i] != '4' && argv[2][i] != '5' && argv[2][i] != '6' && argv[2][i] != '7' && argv[2][i] != '8' && argv[2][i] != '9' && argv[2][i] != '.') { fprintf(stderr,"Error: Decimal values can only consist of 0-9.\n"); help(); } if(argv[2][i] != '.') digitCount++; } if(digitCount > 8) { fprintf(stderr,"Error: Maximum number of digits exceeded.\n"); help(); } else { if(strcmp(argv[3],"-b") == 0) printf("%s\n",dectoBin(argv[2])); if(strcmp(argv[3],"-d") == 0) printf("%s\n",argv[2]); if(strcmp(argv[3],"-h") == 0) printf("%s\n",binToHex(dectoBin(argv[2]))); if(strcmp(argv[3],"-o") == 0) printf("%s\n",binToOct(dectoBin(argv[2]))); } } if(strcmp(argv[1],"-h") == 0) /*See above comments. Performs the same checks but for hex values.*/ { inputLength = strlen(argv[2]); for(i = 0; i != inputLength; i++) { if (argv[2][i] != '0' && argv[2][i] != '1' && argv[2][i] != '2' && argv[2][i] != '3' && argv[2][i] != '4' && argv[2][i] != '5' && argv[2][i] != '6' && argv[2][i] != '7' && argv[2][i] != '8' && argv[2][i] != '9' && argv[2][i] != 'a' && argv[2][i] != 'A' && argv[2][i] != 'b' && argv[2][i] != 'B' && argv[2][i] != 'c' && argv[2][i] != 'C' && argv[2][i] != 'd' && argv[2][i] != 'D' && argv[2][i] != 'e' && argv[2][i] != 'E' && argv[2][i] != 'f' && argv[2][i] != 'F' && argv[2][i] != '.') { fprintf(stderr,"Error: Hex values can only consist of 0-9 & A-F.\n"); help(); } if(argv[2][i] != '.') digitCount++; } if(digitCount > 4) { fprintf(stderr,"Error: Maximum number of digits exceeded.\n"); help(); } else { if(strcmp(argv[3],"-b") == 0) printf("%s\n",hextoBin(argv[2])); if(strcmp(argv[3],"-d") == 0) printf("%G\n",binToDec(hextoBin(argv[2]))); if(strcmp(argv[3],"-h") == 0) printf("%s\n",argv[2]); if(strcmp(argv[3],"-o") == 0) printf("%s\n",binToOct(hextoBin(argv[2]))); } } if(strcmp(argv[1],"-o") == 0) /*See above comments. Does the same checks but for octal numbers.*/ { inputLength = strlen(argv[2]); for(i = 0; i != inputLength; i++) { if (argv[2][i] != '0' && argv[2][i] != '1' && argv[2][i] != '2' && argv[2][i] != '3' && argv[2][i] != '4' && argv[2][i] != '5' && argv[2][i] != '6' && argv[2][i] != '7' && argv[2][i] != '.') { fprintf(stderr,"Error: Octal values can only consist of 0-7.\n"); help(); } if(argv[2][i] != '.') digitCount++; } if(digitCount > 8) { fprintf(stderr,"Error: Maximum number of digits exceeded.\n"); help(); } else { if(strcmp(argv[3],"-b") == 0) printf("%s\n",octtoBin(argv[2])); if(strcmp(argv[3],"-d") == 0) printf("%G\n",binToDec(octtoBin(argv[2]))); if(strcmp(argv[3],"-h") == 0) printf("%s\n",binToHex(octtoBin(argv[2]))); if(strcmp(argv[3],"-o") == 0) printf("%s\n",argv[2]); } } } } return 0; /*In order to meet C standards, the main function must return an int. 0 indicates successful program execution.*/ }
void pilightFirmwareV2ParseBinary(void) { int version = binToDec(pilight_firmware_v2->binary, 0, 15); int high = binToDec(pilight_firmware_v2->binary, 16, 31); int low = binToDec(pilight_firmware_v2->binary, 32, 47); pilightFirmwareV2CreateMessage(version, high, low); }
void arctechSrOldParseBinary(void) { int unit = binToDec(arctech_screen_old->binary, 0, 3); int state = arctech_screen_old->binary[11]; int id = binToDec(arctech_screen_old->binary, 4, 8); arctechSrOldCreateMessage(id, unit, state); }
static void pollinParseBinary(void) { int systemcode = binToDec(pollin->binary, 0, 4); int unitcode = binToDec(pollin->binary, 5, 9); int state = pollin->binary[11]; pollinCreateMessage(systemcode, unitcode, state); }
static void selectremoteParseBinary(void) { int id = 7-binToDec(selectremote->binary, 1, 3); int state = selectremote->binary[8]; selectremoteCreateMessage(id, state); }
void pilightFirmwareParseBinary(void) { int id = binToDec(pilight_firmware->binary, 0, 15); int high = binToDec(pilight_firmware->binary, 16, 31); int low = binToDec(pilight_firmware->binary, 32, 47); pilightFirmwareCreateMessage(id, high, low); }
static void elroHEParseBinary(void) { int systemcode = binToDec(elro_he->binary, 0, 4); int unitcode = binToDec(elro_he->binary, 5, 9); int state = elro_he->binary[11]; elroHECreateMessage(systemcode, unitcode, state); }