/*--------------------------------------------------------------------------- * Add the set the last part of hte device name to the final bytes of the * device address. Useful when mane demo devices are located in the same room. *-------------------------------------------------------------------------*/ void updateNameWithAddressInfo(void) { //uint8 status; uint8 numberString[4]; uint8 address[6]; uint8 value; //status = GAPRole_GetParameter(GAPROLE_BD_ADDR, address); GAPRole_GetParameter(GAPROLE_BD_ADDR, address); value = (address[1] & 0xF0) >> 4; numberString[0] = getAscii(value); value = address[1] & 0x0F; numberString[1] = getAscii(value); value = (address[0] & 0xF0) >> 4; numberString[2] = getAscii(value); value = address[0] & 0x0F; numberString[3] = getAscii(value); // Replace "0000" part of "OLP425-0000" osal_memcpy(&attDeviceName[7], numberString, 4); osal_memcpy(&deviceName[9], numberString, 4); osal_memcpy(&attDeviceNameNew[7], numberString, 4); osal_memcpy(&deviceNameNew[9], numberString, 4); // status = GAPRole_SetParameter( GAPROLE_SCAN_RSP_DATA, sizeof ( deviceName ), deviceName ); // status = GGS_SetParameter( GGS_DEVICE_NAME_ATT, GAP_DEVICE_NAME_LEN - 1, attDeviceName ); GAPRole_SetParameter( GAPROLE_SCAN_RSP_DATA, sizeof ( deviceName ), deviceName ); GGS_SetParameter( GGS_DEVICE_NAME_ATT, GAP_DEVICE_NAME_LEN - 1, attDeviceName ); }
void TxtReaderCoreUtf16::readDocument(ZLInputStream &stream) { const size_t BUFSIZE = 2048; char *buffer = new char[BUFSIZE]; std::string str; size_t length; do { length = stream.read(buffer, BUFSIZE); char *start = buffer; const char *end = buffer + length; for (char *ptr = start; ptr < end; ptr += 2) { const char chr = getAscii(ptr); if (chr == '\n' || chr == '\r') { bool skipNewLine = false; if (chr == '\r' && ptr + 2 != end && getAscii(ptr + 2) == '\n') { skipNewLine = true; setAscii(ptr, '\n'); } if (start != ptr) { str.erase(); myReader.myConverter->convert(str, start, ptr + 2); myReader.characterDataHandler(str); } if (skipNewLine) { ptr += 2; } start = ptr + 2; myReader.newLineHandler(); } else if (chr != 0 && isspace(chr)) { if (chr != '\t') { setAscii(ptr, ' '); } } } if (start != end) { str.erase(); myReader.myConverter->convert(str, start, end); myReader.characterDataHandler(str); } } while (length == BUFSIZE); delete[] buffer; }
void ListView::setValues(int codepage) { _codepage = codepage; for (int i = 0 ; i < 256 ; i++) { LVITEM item; item.mask = LVIF_TEXT; TCHAR num[8]; generic_sprintf(num, TEXT("%d"), i); item.pszText = num; item.iItem = i; item.iSubItem = 0; ListView_InsertItem(_hSelf, &item); generic_string s = getAscii((unsigned char)i); ListView_SetItemText(_hSelf, i, 1, (LPTSTR)s.c_str()); } }
void Puzzle::printPrettyPuzzle() { //prints out the puzzle array, all //pretty and formatted cout << " =======================" << endl; for (int i = 0; i < 9; i++) { cout << "|"; for (int j = 0; j < 9; j++) { cout << getAscii(j) << puzzle[i][j].getAnswer(); } cout << " |" << endl << getAsciiLine(i); } cout << " =======================" << endl << endl; // cin.get(); //debug }
void ListView::setValues(int codepage) { _codepage = codepage; for (int i = 0 ; i < 256 ; ++i) { LVITEM item; item.mask = LVIF_TEXT; TCHAR dec[8]; TCHAR hex[8]; generic_sprintf(dec, TEXT("%d"), i); generic_sprintf(hex, TEXT("%02X"), i); item.pszText = dec; item.iItem = i; item.iSubItem = 0; ListView_InsertItem(_hSelf, &item); ListView_SetItemText(_hSelf, i, 1, hex); generic_string s = getAscii(static_cast<unsigned char>(i)); ListView_SetItemText(_hSelf, i, 2, const_cast<LPTSTR>(s.c_str())); } }