bool CZapitClient::receive_channel_list(BouquetChannelList& channels, const bool utf_encoded) { CZapitMessages::responseGeneralInteger responseInteger; responseGetBouquetChannels response; channels.clear(); if (CBasicClient::receive_data((char* )&responseInteger, sizeof(responseInteger))) { channels.reserve(responseInteger.number); while (responseInteger.number-- > 0) { if (!CBasicClient::receive_data((char*)&response, sizeof(responseGetBouquetChannels))) return false; response.nr++; if (!utf_encoded) { strncpy(response.name, ZapitTools::UTF8_to_Latin1(response.name).c_str(), 30); response.name[29] = '\0'; } channels.push_back(response); } } return true; }
bool CZapitClient::receive_channel_list(BouquetChannelList& channels, const bool utf_encoded) { CZapitMessages::responseGeneralInteger responseInteger; responseGetBouquetChannels response; channels.clear(); if (CBasicClient::receive_data((char* )&responseInteger, sizeof(responseInteger))) { channels.reserve(responseInteger.number); while (responseInteger.number-- > 0) { if (!CBasicClient::receive_data((char*)&response, sizeof(responseGetBouquetChannels))) return false; response.nr++; if (!utf_encoded) { char buffer[CHANNEL_NAME_SIZE + 1]; buffer[CHANNEL_NAME_SIZE] = (char) 0x00; strncpy(buffer, response.name, CHANNEL_NAME_SIZE); strncpy(response.name, ZapitTools::UTF8_to_Latin1(buffer).c_str(), CHANNEL_NAME_SIZE); } channels.push_back(response); } } return true; }
/* gets all channels */ void CZapitClient::getChannels( BouquetChannelList& channels, channelsMode mode, channelsOrder order) { CZapitMessages::commandGetChannels msg; msg.mode = mode; msg.order = order; send(CZapitMessages::CMD_GET_CHANNELS, (char*)&msg, sizeof(msg)); responseGetBouquetChannels response; while (CBasicClient::receive_data((char*)&response, sizeof(responseGetBouquetChannels))) { response.nr++; channels.push_back(response); } close_connection(); }
/* bouquets are numbered starting at 0 */ void CZapitClient::getBouquetChannels(const unsigned int bouquet, BouquetChannelList& channels, channelsMode mode) { CZapitMessages::commandGetBouquetChannels msg; msg.bouquet = bouquet; msg.mode = mode; send(CZapitMessages::CMD_GET_BOUQUET_CHANNELS, (char*)&msg, sizeof(msg)); responseGetBouquetChannels response; while (CBasicClient::receive_data((char*)&response, sizeof(responseGetBouquetChannels))) { response.nr++; channels.push_back(response); } close_connection(); }