2 * $Id: telephone_descriptor.cpp,v 1.1 2003-10-17 15:36:38 tmbinc Exp $
4 * (C) 2002-2003 Andreas Oberritter <obi@saftware.de>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include <lib/dvb_si/telephone_descriptor.h>
24 TelephoneDescriptor::TelephoneDescriptor(const uint8_t * const buffer) : Descriptor(buffer)
26 reserved = (buffer[2] >> 6) & 0x03;
27 foreignAvailability = (buffer[2] >> 5) & 0x01;
28 connectionType = buffer[2] & 0x1f;
29 reserved2 = (buffer[3] >> 7) & 0x01;
30 countryPrefixLength = (buffer[3] >> 5) & 0x03;
31 internationalAreaCodeLength = (buffer[3] >> 2) & 0x07;
32 operatorCodeLength = buffer[3] & 0x03;
33 reserved3 = (buffer[4] >> 7) & 0x01;
34 nationalAreaCodeLength = (buffer[4] >> 4) & 0x07;
35 coreNumberLength = buffer[4] & 0x0f;
38 countryPrefix.assign((char *)&buffer[offset], countryPrefixLength);
39 offset += countryPrefixLength;
40 internationalAreaCode.assign((char *)&buffer[offset], internationalAreaCodeLength);
41 offset += internationalAreaCodeLength;
42 operatorCode.assign((char *)&buffer[offset], operatorCodeLength);
43 offset += operatorCodeLength;
44 nationalAreaCode.assign((char *)&buffer[offset], nationalAreaCodeLength);
45 offset += nationalAreaCodeLength;
46 coreNumber.assign((char *)&buffer[offset], coreNumberLength);
49 uint8_t TelephoneDescriptor::getForeignAvailability(void) const
51 return foreignAvailability;
54 uint8_t TelephoneDescriptor::getConnectionType(void) const
56 return connectionType;
59 std::string TelephoneDescriptor::getCountryPrefix(void) const
64 std::string TelephoneDescriptor::getInternationalAreaCode(void) const
66 return internationalAreaCode;
69 std::string TelephoneDescriptor::getOperatorCode(void) const
74 std::string TelephoneDescriptor::getNationalAreaCode(void) const
76 return nationalAreaCode;
79 std::string TelephoneDescriptor::getCoreNumber(void) const