2 * $Id: local_time_offset_descriptor.cpp,v 1.1 2003-10-17 15:36:37 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/local_time_offset_descriptor.h>
24 LocalTimeOffset::LocalTimeOffset(const uint8_t * const buffer)
26 countryCode.assign((char *)&buffer[0], 3);
27 countryRegionId = (buffer[3] >> 2) & 0x3f;
28 reserved = (buffer[3] >> 1) & 0x01;
29 localTimeOffsetPolarity = buffer[3] & 0x01;
30 localTimeOffset = (buffer[4] << 8) | buffer[5];
31 timeOfChangeMjd = (buffer[6] << 8) | buffer[7];
32 timeOfChangeBcd = (buffer[8] << 16) | (buffer[9] << 8) | buffer[10];
33 nextTimeOffset = (buffer[11] << 8) | buffer[12];
36 std::string LocalTimeOffset::getCountryCode(void) const
41 uint8_t LocalTimeOffset::getCountryRegionId(void) const
43 return countryRegionId;
46 uint8_t LocalTimeOffset::getLocalTimeOffsetPolarity(void) const
48 return localTimeOffsetPolarity;
51 uint16_t LocalTimeOffset::getLocalTimeOffset(void) const
53 return localTimeOffset;
56 uint16_t LocalTimeOffset::getTimeOfChangeMjd(void) const
58 return timeOfChangeMjd;
61 uint32_t LocalTimeOffset::getTimeOfChangeBcd(void) const
63 return timeOfChangeBcd;
66 uint16_t LocalTimeOffset::getNextTimeOffset(void) const
68 return nextTimeOffset;
71 LocalTimeOffsetDescriptor::LocalTimeOffsetDescriptor(const uint8_t * const buffer) : Descriptor(buffer)
73 for (uint16_t i = 0; i < descriptorLength; i += 13)
74 localTimeOffsets.push_back(new LocalTimeOffset(&buffer[i + 2]));
78 LocalTimeOffsetDescriptor::~LocalTimeOffsetDescriptor(void)
80 for (LocalTimeOffsetIterator i = localTimeOffsets.begin(); i != localTimeOffsets.end(); ++i)
84 const LocalTimeOffsetVector *LocalTimeOffsetDescriptor::getLocalTimeOffsets(void) const
86 return &localTimeOffsets;