2 * $Id: cell_list_descriptor.cpp,v 1.1 2003-10-17 15:36:37 tmbinc Exp $
4 * (C) 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.
23 #include <lib/dvb_si/cell_list_descriptor.h>
25 Subcell::Subcell(const uint8_t * const buffer)
27 cellIdExtension = buffer[0];
28 subcellLatitude = (buffer[1] << 8) | buffer[2];
29 subcellLongitude = (buffer[3] << 8) | buffer[4];
30 subcellExtendOfLatitude = (buffer[5] << 4) | ((buffer[6] >> 4) & 0x0f);
31 subcellExtendOfLongitude = ((buffer[6] & 0x0f) << 8) | buffer[7];
34 uint8_t Subcell::getCellIdExtension(void) const
36 return cellIdExtension;
39 uint16_t Subcell::getSubcellLatitude(void) const
41 return subcellLatitude;
44 uint16_t Subcell::getSubcellLongtitude(void) const
46 return subcellLongitude;
49 uint16_t Subcell::getSubcellExtendOfLatitude(void) const
51 return subcellExtendOfLatitude;
54 uint16_t Subcell::getSubcellExtendOfLongtitude(void) const
56 return subcellExtendOfLongitude;
59 Cell::Cell(const uint8_t * const buffer)
61 cellId = (buffer[0] << 8) | buffer[1];
62 cellLatitude = (buffer[2] << 8) | buffer[3];
63 cellLongtitude = (buffer[4] << 8) | buffer[5];
64 cellExtendOfLatitude = (buffer[6] << 4) | ((buffer[7] >> 4) & 0x0f);
65 cellExtendOfLongtitude = ((buffer[7] & 0x0f) << 8) | buffer[8];
66 subcellInfoLoopLength = buffer[9];
68 for (uint16_t i = 0; i < subcellInfoLoopLength; i += 8)
69 subcells.push_back(new Subcell(&buffer[i + 10]));
74 for (SubcellIterator i = subcells.begin(); i != subcells.end(); ++i)
78 uint16_t Cell::getCellId(void) const
83 uint16_t Cell::getCellLatitude(void) const
88 uint16_t Cell::getCellLongtitude(void) const
90 return cellLongtitude;
93 uint16_t Cell::getCellExtendOfLatitude(void) const
95 return cellExtendOfLatitude;
98 uint16_t Cell::getCellExtendOfLongtitude(void) const
100 return cellExtendOfLongtitude;
103 const SubcellVector *Cell::getSubcells(void) const
108 CellListDescriptor::CellListDescriptor(const uint8_t * const buffer) : Descriptor(buffer)
110 for (uint16_t i = 0; i < descriptorLength; i += buffer[i + 11] + 10)
111 cells.push_back(new Cell(&buffer[i + 2]));
114 CellListDescriptor::~CellListDescriptor(void)
116 for (CellIterator i = cells.begin(); i != cells.end(); ++i)
120 const CellVector *CellListDescriptor::getCells(void) const