pax_global_header00006660000000000000000000000064131615341300014507gustar00rootroot0000000000000052 comment=4bb3acd1ad05453152dcd70d28d3bc7c5f2ff78f gr-gsm-0.41.2/000077500000000000000000000000001316153413000127675ustar00rootroot00000000000000gr-gsm-0.41.2/.gitignore000066400000000000000000000001251316153413000147550ustar00rootroot00000000000000build *.o *.log *~ *.pyc *.pyo .unittests build/ debian/tmp/ debian/files .directory gr-gsm-0.41.2/.gitmodules000066400000000000000000000002651316153413000151470ustar00rootroot00000000000000[submodule "test_data"] path = test_data url = https://github.com/ptrkrysik/test_data.git [submodule "examples"] path = examples url = https://github.com/ptrkrysik/examples.git gr-gsm-0.41.2/.travis.yml000066400000000000000000000011061316153413000150760ustar00rootroot00000000000000sudo: required language: ruby env: #- DOCKERFILE=tests/dockerfiles/Debian_Jessie.docker IMGNAME=debjess-grgsm #- DOCKERFILE=tests/dockerfiles/Ubuntu_15_04.docker IMGNAME=ubu15.04-grgsm #- DOCKERFILE=tests/dockerfiles/Debian_testing.docker IMGNAME=debtest-grgsm - DOCKERFILE=tests/dockerfiles/Ubuntu_16_04.docker IMGNAME=ubu16.04-grgsm services: - docker before_install: - cat $DOCKERFILE > Dockerfile ; docker build -t $IMGNAME . script: - docker run -it --rm $IMGNAME sh -c 'cd /src/build;make test' - docker run -it --rm $IMGNAME /src/tests/scripts/decode.sh gr-gsm-0.41.2/CMakeLists.txt000066400000000000000000000207521316153413000155350ustar00rootroot00000000000000# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. ######################################################################## # Project setup ######################################################################## cmake_minimum_required(VERSION 2.6) project(gr-gsm CXX C) enable_testing() #set(CMAKE_BUILD_TYPE "Debug") #select the release build type by default to get optimization flags if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") message(STATUS "Build type not specified: defaulting to release.") endif(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "") list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) ######################################################################## # Set version variables ( ######################################################################## # Set the version information here set(VERSION_INFO_MAJOR_VERSION 0) set(VERSION_INFO_API_COMPAT 41) set(VERSION_INFO_MINOR_VERSION 2) set(VERSION_INFO_MAINT_VERSION 0) include(GrVersion) #setup version info ######################################################################## # Compiler specific setup ######################################################################## if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) #http://gcc.gnu.org/wiki/Visibility add_definitions(-fvisibility=hidden) endif() ######################################################################## # Find boost ######################################################################## if(UNIX AND EXISTS "/usr/lib64") list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix endif(UNIX AND EXISTS "/usr/lib64") set(Boost_ADDITIONAL_VERSIONS "1.35.0" "1.35" "1.36.0" "1.36" "1.37.0" "1.37" "1.38.0" "1.38" "1.39.0" "1.39" "1.40.0" "1.40" "1.41.0" "1.41" "1.42.0" "1.42" "1.43.0" "1.43" "1.44.0" "1.44" "1.45.0" "1.45" "1.46.0" "1.46" "1.47.0" "1.47" "1.48.0" "1.48" "1.49.0" "1.49" "1.50.0" "1.50" "1.51.0" "1.51" "1.52.0" "1.52" "1.53.0" "1.53" "1.54.0" "1.54" "1.55.0" "1.55" "1.56.0" "1.56" "1.57.0" "1.57" "1.58.0" "1.58" "1.59.0" "1.59" "1.60.0" "1.60" "1.61.0" "1.61" "1.62.0" "1.62" "1.63.0" "1.63" "1.64.0" "1.64" "1.65.0" "1.65" "1.66.0" "1.66" "1.67.0" "1.67" "1.68.0" "1.68" "1.69.0" "1.69" ) find_package(Boost "1.35" COMPONENTS filesystem system thread) if(NOT Boost_FOUND) message(FATAL_ERROR "Boost required to compile gr-gsm") endif() find_package(SWIG) if(SWIG_FOUND) # Minimum SWIG version required is 1.3.31 set(SWIG_VERSION_CHECK FALSE) if("${SWIG_VERSION}" VERSION_GREATER "1.3.30") set(SWIG_VERSION_CHECK TRUE) endif() else() message(FATAL_ERROR "SWIG required to compile gr-gsm") endif(SWIG_FOUND) ######################################################################## # Install directories ######################################################################## include(GrPlatform) #define LIB_SUFFIX set(GR_RUNTIME_DIR bin) set(GR_LIBRARY_DIR lib${LIB_SUFFIX}) set(GR_INCLUDE_DIR include/grgsm) set(GR_INCLUDE_DIR include/grgsm/misc_utils) set(GR_INCLUDE_DIR include/grgsm/receiver) set(GR_INCLUDE_DIR include/grgsm/demapping) set(GR_INCLUDE_DIR include/grgsm/decoding) set(GR_DATA_DIR share) set(GR_PKG_DATA_DIR ${GR_DATA_DIR}/${CMAKE_PROJECT_NAME}) set(GR_DOC_DIR ${GR_DATA_DIR}/doc) set(GR_PKG_DOC_DIR ${GR_DOC_DIR}/${CMAKE_PROJECT_NAME}) set(GR_CONF_DIR etc) set(GR_PKG_CONF_DIR ${GR_CONF_DIR}/${CMAKE_PROJECT_NAME}/conf.d) set(GR_LIBEXEC_DIR libexec) set(GR_PKG_LIBEXEC_DIR ${GR_LIBEXEC_DIR}/${CMAKE_PROJECT_NAME}) set(GRC_BLOCKS_DIR ${GR_PKG_DATA_DIR}/grc/blocks) ######################################################################## # Find gnuradio build dependencies ######################################################################## set(GR_REQUIRED_COMPONENTS RUNTIME FILTER PMT) find_package(Gnuradio) find_package(Volk) find_package(CppUnit) find_package(Doxygen) find_package(Libosmocore) #find_package(Libosmocoding) find_package(Libosmocodec) if(NOT GNURADIO_RUNTIME_FOUND) message(FATAL_ERROR "GnuRadio Runtime required to compile gr-gsm") endif() if(NOT VOLK_FOUND) message(FATAL_ERROR "Volk library required to compile gr-gsm") endif() if(NOT CPPUNIT_FOUND) message(FATAL_ERROR "CppUnit required to compile gr-gsm") endif() if(NOT LIBOSMOCORE_FOUND) message(FATAL_ERROR "Libosmocore required to compile gr-gsm") endif() if(NOT LIBOSMOCODEC_FOUND) message(FATAL_ERROR "Libosmocodec required to compile gr-gsm") endif() #if(NOT LIBOSMOCODING_FOUND) # message(FATAL_ERROR "Libosmocoding required to compile gr-gsm") #endif() ######################################################################## # Setup doxygen option ######################################################################## if(DOXYGEN_FOUND) option(ENABLE_DOXYGEN "Build docs using Doxygen" ON) else(DOXYGEN_FOUND) option(ENABLE_DOXYGEN "Build docs using Doxygen" OFF) endif(DOXYGEN_FOUND) ######################################################################## # Setup the include and linker paths ######################################################################## include_directories( ${CMAKE_SOURCE_DIR}/lib ${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/lib ${CMAKE_BINARY_DIR}/include ${Boost_INCLUDE_DIRS} ${CPPUNIT_INCLUDE_DIRS} ${GNURADIO_ALL_INCLUDE_DIRS} ${LIBOSMOCORE_INCLUDE_DIR} ) link_directories( ${Boost_LIBRARY_DIRS} ${CPPUNIT_LIBRARY_DIRS} ${GNURADIO_ALL_LIBRARY_DIRS} ) # Set component parameters set(GR_GSM_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE INTERNAL "" FORCE) set(GR_GSM_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/swig CACHE INTERNAL "" FORCE) ######################################################################## # On Apple only, set install name and use rpath correctly, if not already set ######################################################################## if(APPLE) if(NOT CMAKE_INSTALL_NAME_DIR) set(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/${GR_LIBRARY_DIR} CACHE PATH "Library Install Name Destination Directory" FORCE) endif(NOT CMAKE_INSTALL_NAME_DIR) if(NOT CMAKE_INSTALL_RPATH) set(cmakE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${GR_LIBRARY_DIR} CACHE PATH "Library Install RPath" FORCE) endif(NOT CMAKE_INSTALL_RPATH) if(NOT CMAKE_BUILD_WITH_INSTALL_RPATH) set(CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE BOOL "Do Build Using Library Install RPath" FORCE) endif(NOT CMAKE_BUILD_WITH_INSTALL_RPATH) endif(APPLE) ######################################################################## # Create uninstall target ######################################################################## configure_file( ${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake @ONLY) add_custom_target(uninstall ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake ) ######################################################################## # Add subdirectories ######################################################################## add_subdirectory(include/grgsm) add_subdirectory(lib) add_subdirectory(swig) add_subdirectory(python) add_subdirectory(grc) add_subdirectory(apps) add_subdirectory(docs) ######################################################################## # Install cmake search helper for this library ######################################################################## install(FILES cmake/Modules/gr-gsmConfig.cmake DESTINATION lib${LIB_SUFFIX}/cmake/grgsm ) ######################################################################## # Print summary ######################################################################## message(STATUS "Using install prefix: ${CMAKE_INSTALL_PREFIX}") message(STATUS "Building for version: ${VERSION} / ${LIBVER}") gr-gsm-0.41.2/COPYING000066400000000000000000002155001316153413000140250ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software. A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public. The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version. An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU Affero General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Remote Network Interaction; Use with the GNU General Public License. Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements. You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see . ========================================================================= This marks the end of the AGPLv3 text. The following text is appended to the same file for convience but constituting a distinct document, not part of the actual AGPL text and not part of an attempt to create a deriviative work based on the AGPLv3 text. ========================================================================= ADDITIONAL TERMS TO THE AGPLv3 LICENSE FOR OPENBTS Permissive Terms Supplementing the License 1. Remote Interaction Through IP Networks. OpenBTS includes an implementation of the GSM network cellular air interface, as well as other interfaces to IP networks. The interaction of cellular handsets with the OpenBTS software is considered "remote network interaction" for the purposes of the Affero General Public License and cellular users are subject to the source code access requirements of Section 13 of AGPLv3 ("Remote Network Interaction; Use with the GNU General Public License"). Remote interactions through interfaces other than the GSM air interface are, at your option, exempted from the requirements of Section 13 ("Remote Network Interaction; Use with the GNU General Public License"). This exemption of interfaces other than the GSM air interface from the requirements of Section 13 is an additional permission granted to you. 2. GSM "A5" cipher stream generation libraries Notwithstanding any other provision of this License, you have permission to link the Program with GSM "A5" cipher-stream generation libraries provided under any license that allows redistribution of those libraries in binary form, provided that the function of any such library is limited to the generation of cipher-steam bits. Non-Permissive Terms Supplementing The License 1. Trademarks. "OpenBTS" is a trademark of Range Networks, Inc., registered with the US Patent and Trademark Office. Your use of OpenBTS software under a GPL license does not include the right to use the OpenBTS trademark in commerce. This additional non-permissive term is consistent with Section 7 of the AGPLv3 license. END OF ADDITIONAL TERMS How to comply with Section 13 of the AGPLv3 license. The recommended method for compliance with Section 13 of the AGPLv3 license is to deliver a text message to each handset that attaches to the OpenBTS cellular network. At a minimum, that text message should include the string "OpenBTS AGPLv3" and a URL that can be used to access the OpenBTS source code. This message need not be delivered to handsets that are denied registration with the network, since those handsets have been denied service. In OpenBTS 2.6, such text messages can be delivered with the "Welcome Message" feature. See the OpenBTS.config.example file for more information on the use of this feature for AGPLv3 compliance. gr-gsm-0.41.2/LICENSE000066400000000000000000000013261316153413000137760ustar00rootroot00000000000000@file @author Piotr Krysik @section LICENSE Gr-gsm is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. Gr-gsm is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with gr-gsm; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Boston, MA 02110-1301, USA. gr-gsm-0.41.2/README.md000066400000000000000000000061621316153413000142530ustar00rootroot00000000000000The gr-gsm project ================== The *gr-gsm* project is based on the *gsm-receiver* written by Piotr Krysik (also the main author of *gr-gsm*) for the *Airprobe* project. The aim is to provide set of tools for receiving information transmitted by GSM equipment/devices. Installation and usage ====================== Please see project's wiki https://github.com/ptrkrysik/gr-gsm/wiki for information on [installation](https://github.com/ptrkrysik/gr-gsm/wiki/Installation) and [usage](https://github.com/ptrkrysik/gr-gsm/wiki/Usage) of gr-gsm. Mailing list ============ Current gr-gsm project's mailing list address is following: gr-gsm@googlegroups.com Mailing list is a place for general discussions, questions about the usage and installation. In case of problem with installation please try to provide full information that will help reproducing it. Minimum information should contain: - operating system with version, - kind of installation (how gr-gsm and its dependencies were installed: with pybombs, from distibution's repository, compiled manually) - version of gnuradio (it can be obtained with: gnuradio-companion --version) - error messages (in case of pybombs installation they can be obtained after switching it to verbous mode with -v option). To join the group with any e-mail addres (google account is not required) use this link: https://groups.google.com/forum/#!forum/gr-gsm/join Development =========== New features are accepted through github's pull requests. When creating pull request try to make it adress one topic (addition of a feature x, correction of bug y). If you wish to develop something for gr-gsm but don't know exactly what, then look for issues with label "Enhancement". Select one that you feel you are able to complete. After that claim it by commenting in the comment section of the issue. If there is any additional information about gr-gsm needed by you to make completing the task easier - just ask. Videos ====== Short presentation of *Airprobe*'like application of *gr-gsm*: https://www.youtube.com/watch?v=Eofnb7zr8QE Credits ======= *Piotr Krysik* \ - main author and project maintainer *Roman Khassraf* \ - blocks for demultiplexing and decoding of voice channels, decryption block supporting all ciphers used in GSM, blocks for storing and reading GSM bursts, project planning and user support *Pieter Robyns* \ - block reversing channel hopping Thanks ====== This work is built upon the efforts made by many people to gather knowledge of GSM. First very significant effort of public research into GSM and its security vulnerabilities was The Hacker's Choice GSM SCANNER PROJECT. One of the results of this project was creation of a software GSM receiver by *Tvoid* - *gsm-tvoid* - which was was the most important predecessor of *gr-gsm* and of *gsm-receiver* from the *Airprobe* project. *Gr-gsm* wouldn't be also possible without help and inspiration by Harald Welte, Dieter Spaar and Sylvain Munaut. Special thanks to Pawel Koszut who generously lent his USRP1 to the author of *gr-gsm* (Piotr Krysik) in 2007-2010. gr-gsm-0.41.2/TESTING.md000066400000000000000000000023421316153413000144270ustar00rootroot00000000000000# Testing gr-gsm ## CI Testing CI testing currently consists of attempting to build gr-gsm as described in the .docker files located under gr-gsm/tests/dockerfiles using travis-ci.org. If the build is successful, travis-ci will attempt to decode the test file located under gr-gsm/test_data and compare the results to this file: gr-gsm/tests/fixtures/grgsm_decode_test1_expected. See the gr-gsm/tests/scripts/decode.sh file for details. ## Integration testing Integration testing with use of the grgsm_scanner application: * Make sure that your RTL SDR dongle is plugged into the system and if you're running on Mac, you need to have the dongle accessible to the VirtualBox VM that's running Docker. * cd gr-gsm/tests/scripts * scanner.sh This will copy the entire contents of the currently checked out branch of gr-gsm to a temp folder, and attempt to build the docker images according to the definitions in the .docker files located under gr-gsm/dockerfiles. Once the images are created, the script instantiates a container for testing the rtlsdr scanner on each band, against each Docker image built. This can take quite a while. If you're running on Mac, consider using the ```caffeinate``` command to keep your machine from sleeping. gr-gsm-0.41.2/apps/000077500000000000000000000000001316153413000137325ustar00rootroot00000000000000gr-gsm-0.41.2/apps/CMakeLists.txt000066400000000000000000000020101316153413000164630ustar00rootroot00000000000000# Copyright 2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. include(GrPython) add_subdirectory(helpers) add_subdirectory(apps_data) GR_PYTHON_INSTALL( PROGRAMS grgsm_livemon grgsm_livemon_headless grgsm_scanner grgsm_decode DESTINATION bin ) install( PROGRAMS DESTINATION bin ) gr-gsm-0.41.2/apps/README000066400000000000000000000040001316153413000146040ustar00rootroot00000000000000This directory contains programs based on gr-gsm: * grgsm_decode (old name: airprobe_decode.py) - program for decoding C0 channel which is most close in terms of functionality to the old gsm-receiver from Airprobe project, with ability to decode signalling channels and traffic channels with speech (analysis of the data can be performed in Wireshark, decoded sound is stored to an audio file), * grgsm_livemon (old name: airprobe_rtlsdr.py) - interactive monitor of a single C0 channel with analysis performed by Wireshark (command to run wireshark: sudo wireshark -k -f udp -Y gsmtap -i lo), * grgsm_scanner (old name: airprobe_rtlsdr_scanner.py) - an application that scans GSM bands and prints information about base transceiver stations transmitting in the area. There are following helper programs for grgsm_decode program: * grgsm_capture (old name: airprobe_rtlsdr_capture.py) - program for capturing GSM signal to a file that can be later processed by grgsm_decode, * grgsm_channelize (old name: gsm_channelize.py) - splits wideband capture file into multiple files - each contain single GSM channel. * grgsm_livemon_headless - command line version of grgsm_livemon. It is created by changing grgsm_livemon.grc like this: - Change Options block->Generate Options from 'QT GUI' to 'No GUI'. - Set Options block->Run Options to 'Run to Completion'. - Remove the blocks 'QT GUI Range' (gain_slider, fc_slider, ppm_slider) and the 'QT GUI Frequency Sink'. - Change all occurances of _slider to in the XML file. After these changes are done, build the grgsm_livemon_headless python code using the grcc compiler. gr-gsm-0.41.2/apps/apps_data/000077500000000000000000000000001316153413000156665ustar00rootroot00000000000000gr-gsm-0.41.2/apps/apps_data/CMakeLists.txt000066400000000000000000000026261316153413000204340ustar00rootroot00000000000000# Copyright 2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. set(grgsm_freedesktop_path ${GR_PKG_DATA_DIR}/gr-gsm/freedesktop) install( FILES grgsm-livemon.desktop DESTINATION ${grgsm_freedesktop_path} COMPONENT "gr-gsm" ) find_program(HAVE_XDG_UTILS xdg-desktop-menu) if(UNIX AND HAVE_XDG_UTILS) set(SRCDIR ${CMAKE_INSTALL_PREFIX}/${grgsm_freedesktop_path}) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/grgsm_setup_freedesktop.in ${CMAKE_CURRENT_BINARY_DIR}/grgsm_setup_freedesktop @ONLY) install( PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/grgsm_setup_freedesktop DESTINATION ${GR_PKG_LIBEXEC_DIR} COMPONENT "gr-gsm" ) endif(UNIX AND HAVE_XDG_UTILS) gr-gsm-0.41.2/apps/apps_data/grgsm-livemon.desktop000066400000000000000000000005041316153413000220460ustar00rootroot00000000000000[Desktop Entry] Type=Application Version=1.0 Name=GNU Radio GSM live monitor GenericName=GSM channel monitor Comment=Interactive monitor of a single GSM C0 channel for analysis with network sniffers like Wireshark Exec=grgsm_livemon Terminal=false #Icon= Categories=Network;HamRadio;Development; Keywords=SDR;Radio;HAM;GSM; gr-gsm-0.41.2/apps/apps_data/grgsm_setup_freedesktop.in000066400000000000000000000027601316153413000231550ustar00rootroot00000000000000#!/bin/bash # # Copyright 2008-2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # ################################################## # setup grc on a freedesktop platform # $1 should be install or uninstall # $2 is the optional path to the files # when $2 is unspecified, the path is: # @SRCDIR@ ################################################## if [ -n "$2" ]; then SRCDIR="$2" else SRCDIR="@SRCDIR@" fi case "$1" in 'install') echo "Begin freedesktop install..." echo "Install menu items" xdg-desktop-menu install ${SRCDIR}/*.desktop echo "Done!" echo "" ;; 'uninstall') echo "Begin freedesktop uninstall..." echo "Uninstall menu items" xdg-desktop-menu uninstall `ls ${SRCDIR}/*.desktop | xargs -n1 basename` echo "Done!" echo "" ;; *) echo "Usage: $0 [install|uninstall]" ;; esac gr-gsm-0.41.2/apps/grgsm_decode000077500000000000000000000426511316153413000163120ustar00rootroot00000000000000#!/usr/bin/env python # -*- coding: utf-8 -*- # @file # @author (C) 2015 by Roman Khassraf # @section LICENSE # # Gr-gsm is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Gr-gsm is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with gr-gsm; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # # from gnuradio import blocks from gnuradio import eng_notation from gnuradio import gr from gnuradio.eng_option import eng_option from optparse import OptionParser, OptionGroup import collections import grgsm import pmt import socket class grgsm_decoder(gr.top_block): def __init__(self, timeslot=0, subslot=None, chan_mode='BCCH', burst_file=None, cfile=None, fc=None, samp_rate=2e6, a5=1, a5_kc=None, speech_file=None, speech_codec=None, enable_voice_boundary_detection=False, verbose=False, print_bursts=False, ppm=0): gr.top_block.__init__(self, "Gr-gsm Decode") ################################################## # Parameters ################################################## self.timeslot = timeslot self.subslot = subslot self.chan_mode = chan_mode self.burst_file = burst_file self.cfile = cfile self.fc = fc self.samp_rate = samp_rate self.a5 = a5 self.kc = a5_kc if len(a5_kc) < 8: self.kc = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] self.speech_file = speech_file self.speech_codec = speech_codec self.verbose = verbose self.print_bursts = print_bursts self.enable_voice_boundary_detection = enable_voice_boundary_detection ################################################## # Blocks ################################################## if self.burst_file: self.burst_file_source = grgsm.burst_file_source(burst_file) elif self.cfile: self.file_source = blocks.file_source(gr.sizeof_gr_complex*1, self.cfile, False) self.receiver = grgsm.receiver(4, ([0]), ([])) if self.fc is not None: self.input_adapter = grgsm.gsm_input(ppm=ppm, osr=4, fc=self.fc, samp_rate_in=samp_rate) self.offset_control = grgsm.clock_offset_control(self.fc, self.samp_rate) else: self.input_adapter = grgsm.gsm_input(ppm=ppm, osr=4, samp_rate_in=samp_rate) self.dummy_burst_filter = grgsm.dummy_burst_filter() self.timeslot_filter = grgsm.burst_timeslot_filter(self.timeslot) self.subslot_filter = None if self.chan_mode == 'BCCH_SDCCH4' and self.subslot is not None: self.subslot_filter = grgsm.burst_sdcch_subslot_filter(grgsm.SS_FILTER_SDCCH4, self.subslot) elif self.chan_mode == 'SDCCH8' and self.subslot is not None: self.subslot_filter = grgsm.burst_sdcch_subslot_filter(grgsm.SS_FILTER_SDCCH8, self.subslot) if self.chan_mode == 'BCCH': self.bcch_demapper = grgsm.gsm_bcch_ccch_demapper(self.timeslot) elif self.chan_mode == 'BCCH_SDCCH4': self.bcch_sdcch4_demapper = grgsm.gsm_bcch_ccch_sdcch4_demapper(self.timeslot) elif self.chan_mode == 'SDCCH8': self.sdcch8_demapper = grgsm.gsm_sdcch8_demapper(self.timeslot) elif self.chan_mode == 'TCHF': self.tch_f_demapper = grgsm.tch_f_chans_demapper(self.timeslot) self.tch_f_decoder = grgsm.tch_f_decoder(speech_codec, enable_voice_boundary_detection) self.tch_f_pdu_to_tagged_stream = blocks.pdu_to_tagged_stream(blocks.byte_t, "packet_len") self.tch_f_file_sink = blocks.file_sink(gr.sizeof_char*1, speech_file, False) if self.kc != [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]: self.decryption = grgsm.decryption(self.kc, self.a5) self.cch_decoder_decrypted = grgsm.control_channels_decoder() if self.chan_mode == 'TCHF': self.decryption_tch_sacch = grgsm.decryption(self.kc, self.a5) self.cch_decoder = grgsm.control_channels_decoder() self.socket_pdu_server = blocks.socket_pdu("UDP_SERVER", "127.0.0.1", "4729", 10000) #added in order to avoid generating ICMP messages self.socket_pdu = blocks.socket_pdu("UDP_CLIENT", "127.0.0.1", "4729", 10000) if self.verbose: self.message_printer = grgsm.message_printer(pmt.intern(""), True, True, False) if self.print_bursts: self.bursts_printer = grgsm.bursts_printer(pmt.intern(""), True, True, True, True) ################################################## # Asynch Message Connections ################################################## if self.burst_file: self.msg_connect(self.burst_file_source, "out", self.dummy_burst_filter, "in") elif self.cfile: self.connect((self.file_source, 0), (self.input_adapter, 0)) self.connect((self.input_adapter, 0), (self.receiver, 0)) if self.fc is not None: self.msg_connect(self.offset_control, "ctrl", self.input_adapter, "ctrl_in") self.msg_connect(self.receiver, "measurements", self.offset_control, "measurements") self.msg_connect(self.receiver, "C0", self.dummy_burst_filter, "in") self.msg_connect(self.dummy_burst_filter, "out", self.timeslot_filter, "in") if self.print_bursts: self.msg_connect(self.timeslot_filter, "out", self.bursts_printer, 'bursts') if (self.chan_mode == 'BCCH_SDCCH4' or self.chan_mode == 'SDCCH8') and self.subslot_filter is not None: self.msg_connect(self.timeslot_filter, "out", self.subslot_filter, "in") if self.chan_mode == 'BCCH': if self.subslot_filter is not None: self.msg_connect(self.subslot_filter, "out", self.bcch_demapper, "bursts") else: self.msg_connect(self.timeslot_filter, "out", self.bcch_demapper, "bursts") self.msg_connect(self.bcch_demapper, "bursts", self.cch_decoder, "bursts") self.msg_connect(self.cch_decoder, "msgs", self.socket_pdu, "pdus") if self.verbose: self.msg_connect(self.cch_decoder, "msgs", self.message_printer, "msgs") elif self.chan_mode == 'BCCH_SDCCH4': if self.subslot_filter is not None: self.msg_connect(self.subslot_filter, "out", self.bcch_sdcch4_demapper, "bursts") else: self.msg_connect(self.timeslot_filter, "out", self.bcch_sdcch4_demapper, "bursts") if self.kc != [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]: self.msg_connect(self.bcch_sdcch4_demapper, "bursts", self.decryption, "bursts") self.msg_connect(self.decryption, "bursts", self.cch_decoder_decrypted, "bursts") self.msg_connect(self.cch_decoder_decrypted, "msgs", self.socket_pdu, "pdus") if self.verbose: self.msg_connect(self.cch_decoder_decrypted, "msgs", self.message_printer, "msgs") self.msg_connect(self.bcch_sdcch4_demapper, "bursts", self.cch_decoder, "bursts") self.msg_connect(self.cch_decoder, "msgs", self.socket_pdu, "pdus") if self.verbose: self.msg_connect(self.cch_decoder, "msgs", self.message_printer, "msgs") elif self.chan_mode == 'SDCCH8': if self.subslot_filter is not None: self.msg_connect(self.subslot_filter, "out", self.sdcch8_demapper, "bursts") else: self.msg_connect(self.timeslot_filter, "out", self.sdcch8_demapper, "bursts") if self.kc != [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]: self.msg_connect(self.sdcch8_demapper, "bursts", self.decryption, "bursts") self.msg_connect(self.decryption, "bursts", self.cch_decoder_decrypted, "bursts") self.msg_connect(self.cch_decoder_decrypted, "msgs", self.socket_pdu, "pdus") if self.verbose: self.msg_connect(self.cch_decoder_decrypted, "msgs", self.message_printer, "msgs") self.msg_connect(self.sdcch8_demapper, "bursts", self.cch_decoder, "bursts") self.msg_connect(self.cch_decoder, "msgs", self.socket_pdu, "pdus") if self.verbose: self.msg_connect(self.cch_decoder, "msgs", self.message_printer, "msgs") elif self.chan_mode == 'TCHF': self.msg_connect(self.timeslot_filter, "out", self.tch_f_demapper, "bursts") if self.kc != [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]: self.msg_connect(self.tch_f_demapper, "acch_bursts", self.decryption_tch_sacch, "bursts") self.msg_connect(self.tch_f_demapper, "tch_bursts", self.decryption, "bursts") self.msg_connect(self.decryption_tch_sacch, "bursts", self.cch_decoder, "bursts") self.msg_connect(self.decryption, "bursts", self.tch_f_decoder, "bursts") else: self.msg_connect(self.tch_f_demapper, "acch_bursts", self.cch_decoder, "bursts") self.msg_connect(self.tch_f_demapper, "tch_bursts", self.tch_f_decoder, "bursts") self.msg_connect(self.tch_f_decoder, "msgs", self.socket_pdu, "pdus") self.msg_connect(self.cch_decoder, "msgs", self.socket_pdu, "pdus") self.msg_connect(self.tch_f_decoder, "voice", self.tch_f_pdu_to_tagged_stream, "pdus") self.connect((self.tch_f_pdu_to_tagged_stream, 0), (self.tch_f_file_sink, 0)) if self.verbose: self.msg_connect(self.tch_f_decoder, "msgs", self.message_printer, "msgs") self.msg_connect(self.cch_decoder, "msgs", self.message_printer, "msgs") if __name__ == '__main__': # List of channel configurations channel_modes = ['BCCH', 'BCCH_SDCCH4', 'SDCCH8', 'TCHF'] # mapping options to grgsm's enums tch_codecs = collections.OrderedDict([ ('FR', grgsm.TCH_FS), ('EFR', grgsm.TCH_EFR), ('AMR12.2', grgsm.TCH_AFS12_2), ('AMR10.2', grgsm.TCH_AFS10_2), ('AMR7.95', grgsm.TCH_AFS7_95), ('AMR7.4', grgsm.TCH_AFS7_4), ('AMR6.7', grgsm.TCH_AFS6_7), ('AMR5.9', grgsm.TCH_AFS5_9), ('AMR5.15', grgsm.TCH_AFS5_15), ('AMR4.75', grgsm.TCH_AFS4_75) ]) kc = [] parser = OptionParser(option_class=eng_option, usage="%prog: [options]") def kc_callback(option, opt_str, value, parser): """ Callback function that parses Kc """ # format 0x12,0x34,0x56,0x78,0x90,0xAB,0xCD,0xEF if ',' in value: value_str = value.split(',') for s in value_str: val = int(s, 16) if val < 0 or val > 255: parser.error("Invalid Kc % s\n" % s) kc.append(val) if len(kc) != 8: parser.error("Invalid Kc length") # format: 1234567890ABCDEF elif len(value) == 16: for i in range(8): s = value[2*i: 2*i + 2] val = int(s, 16) if val < 0 or val > 255: parser.error("Invalid Kc % s\n" % s) kc.append(val) else: parser.error("Invalid Kc format") # define options parser.add_option("-m", "--mode", dest="chan_mode", default='BCCH', type='choice', choices=channel_modes, help="Channel mode. Valid options are 'BCCH' (Non-combined C0), " "'BCCH_SDCCH4'(Combined C0), 'SDCCH8' (Stand-alone control channel) " "and 'TCHF' (Traffic Channel, Full rate) ") parser.add_option("-t", "--timeslot", dest="timeslot", type="intx", default=0, help="Timeslot to decode [default=%default]") parser.add_option("-u", "--subslot", dest="subslot", type="intx", help="Subslot to decode. Use in combination with channel type BCCH_SDCCH4 and SDCCH8") parser.add_option("-b", "--burst-file", dest="burst_file", help="Input file (bursts)") parser.add_option("-c", "--cfile", dest="cfile", help="Input file (cfile)") parser.add_option("-v", "--verbose", action="store_true", help="If set, the decoded messages (with frame number and count) are printed to stdout") parser.add_option("-p", "--print-bursts", action="store_true", help="If set, the raw bursts (with frame number and count) are printed to stdout") # group cfile options together cfile_options = OptionGroup( parser, 'Cfile Options', 'Options for decoding cfile input.', ) cfile_options.add_option("-f", "--fc", dest="fc", type="eng_float", help="Frequency of cfile capture") cfile_options.add_option("-a", "--arfcn", dest="arfcn", type="intx", help="Set ARFCN instead of frequency (for PCS1900 add 0x8000 (2**15) to the ARFCN number).") cfile_options.add_option("-s", "--samp-rate", dest="samp_rate", type="eng_float", default=eng_notation.num_to_str(1e6), help="Sample rate of cfile capture [default=%default]") cfile_options.add_option("--ppm", dest="ppm", type="float", default=0, help="Set frequency offset correction [default=%default]") parser.add_option_group(cfile_options) # group decryption options decryption_options = OptionGroup( parser, 'Decryption Options', 'Options for setting the A5 decryption parameters.', ) decryption_options.add_option("-e", "--a5", dest="a5", type="intx", default=1, help="A5 version [default=%default]. A5 versions 1 - 3 supported") decryption_options.add_option("-k", "--kc", action="callback", callback=kc_callback, type="string", help="A5 session key Kc. Valid formats are " "'0x12,0x34,0x56,0x78,0x90,0xAB,0xCD,0xEF' and '1234567890ABCDEF'") parser.add_option_group(decryption_options) # group TCH options tch_options = OptionGroup( parser, 'TCH Options', 'Options for setting Traffic channel decoding parameters.', ) tch_options.add_option("-d", "--speech-codec", dest="speech_codec", default='FR', type='choice', choices=tch_codecs.keys(), help="TCH-F speech codec [default=%default]. " "Valid options are " + ", ".join(tch_codecs.keys())) tch_options.add_option("-o", "--output-tch", dest="speech_output_file", default="/tmp/speech.au.gsm", help="TCH/F speech output file [default=%default].") tch_options.add_option("--voice-boundary", dest="enable_voice_boundary_detection", action="store_true", default=False, help="Enable voice boundary detection for traffic channels. This can help reduce noice in the output.") parser.add_option_group(tch_options) # parse (options, args) = parser.parse_args() # some verifications if (options.cfile is None and options.burst_file is None) or \ (options.cfile is not None and options.burst_file is not None): parser.error("Please provide a cfile or a burst file (but not both) as input\n") if options.timeslot < 0 or options.timeslot > 7: parser.error("Invalid timeslot. Must be a in range 0-7\n") if options.subslot is not None and (options.subslot < 0 or options.subslot > 7): parser.error("Invalid subslot. Must be a in range 0-7\n") if options.a5 < 0 or options.a5 > 3: parser.error("Invalid A5 version\n") if options.cfile and (options.fc is None and options.arfcn is None): print("You haven't provided a frequency or an ARFCN - working without automatic frequency offset correction.\n") # handle frequency / arfcn input arfcn = None fc = None if options.arfcn: if not grgsm.arfcn.is_valid_arfcn(options.arfcn): parser.error("ARFCN is not valid\n") else: arfcn = options.arfcn fc = grgsm.arfcn.arfcn2downlink(arfcn) elif options.fc: fc = options.fc arfcn = grgsm.arfcn.downlink2arfcn(options.fc) # instanciate decoder tb = grgsm_decoder(timeslot=options.timeslot, subslot=options.subslot, chan_mode=options.chan_mode, burst_file=options.burst_file, cfile=options.cfile, fc=fc, samp_rate=options.samp_rate, a5=options.a5, a5_kc=kc, speech_file=options.speech_output_file, speech_codec=tch_codecs.get(options.speech_codec), enable_voice_boundary_detection=options.enable_voice_boundary_detection, verbose=options.verbose, print_bursts=options.print_bursts, ppm=options.ppm) # run tb.start() tb.wait() gr-gsm-0.41.2/apps/grgsm_livemon000077500000000000000000000357201316153413000165370ustar00rootroot00000000000000#!/usr/bin/env python2 # -*- coding: utf-8 -*- # @file # @author (C) 2014-2016 by Piotr Krysik # @section LICENSE # # Gr-gsm is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Gr-gsm is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with gr-gsm; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # # ################################################## # GNU Radio Python Flow Graph # Title: Gr-gsm Livemon # Author: Piotr Krysik # Description: Interactive monitor of a single C0 channel with analysis performed by Wireshark (command to run wireshark: sudo wireshark -k -f udp -Y gsmtap -i lo) # Generated: Sun Aug 27 08:34:42 2017 ################################################## if __name__ == '__main__': import ctypes import sys if sys.platform.startswith('linux'): try: x11 = ctypes.cdll.LoadLibrary('libX11.so') x11.XInitThreads() except: print "Warning: failed to XInitThreads()" from PyQt4 import Qt from gnuradio import blocks from gnuradio import eng_notation from gnuradio import gr from gnuradio import qtgui from gnuradio.eng_option import eng_option from gnuradio.filter import firdes from gnuradio.qtgui import Range, RangeWidget from math import pi from optparse import OptionParser import grgsm import osmosdr import pmt import sip import sys import time class grgsm_livemon(gr.top_block, Qt.QWidget): def __init__(self, args="", collector="localhost", collectorport="4729", fc=941.8e6, gain=30, osr=4, ppm=0, samp_rate=2000000.052982, serverport="4729", shiftoff=400e3): gr.top_block.__init__(self, "Gr-gsm Livemon") Qt.QWidget.__init__(self) self.setWindowTitle("Gr-gsm Livemon") try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "grgsm_livemon") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.args = args self.collector = collector self.collectorport = collectorport self.fc = fc self.gain = gain self.osr = osr self.ppm = ppm self.samp_rate = samp_rate self.serverport = serverport self.shiftoff = shiftoff ################################################## # Variables ################################################## self.ppm_slider = ppm_slider = ppm self.g_slider = g_slider = gain self.fc_slider = fc_slider = fc ################################################## # Blocks ################################################## self._ppm_slider_range = Range(-150, 150, 0.1, ppm, 100) self._ppm_slider_win = RangeWidget(self._ppm_slider_range, self.set_ppm_slider, "PPM Offset", "counter", float) self.top_layout.addWidget(self._ppm_slider_win) self._g_slider_range = Range(0, 50, 0.5, gain, 100) self._g_slider_win = RangeWidget(self._g_slider_range, self.set_g_slider, "Gain", "counter", float) self.top_layout.addWidget(self._g_slider_win) self._fc_slider_range = Range(800e6, 1990e6, 2e5, fc, 100) self._fc_slider_win = RangeWidget(self._fc_slider_range, self.set_fc_slider, "Frequency", "counter_slider", float) self.top_layout.addWidget(self._fc_slider_win) self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + args ) self.rtlsdr_source_0.set_sample_rate(samp_rate) self.rtlsdr_source_0.set_center_freq(fc_slider-shiftoff, 0) self.rtlsdr_source_0.set_freq_corr(ppm_slider, 0) self.rtlsdr_source_0.set_dc_offset_mode(2, 0) self.rtlsdr_source_0.set_iq_balance_mode(2, 0) self.rtlsdr_source_0.set_gain_mode(False, 0) self.rtlsdr_source_0.set_gain(g_slider, 0) self.rtlsdr_source_0.set_if_gain(20, 0) self.rtlsdr_source_0.set_bb_gain(20, 0) self.rtlsdr_source_0.set_antenna("", 0) self.rtlsdr_source_0.set_bandwidth(250e3+abs(shiftoff), 0) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype fc_slider, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(False) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_freq_sink_x_0_win) self.gsm_sdcch8_demapper_0 = grgsm.gsm_sdcch8_demapper( timeslot_nr=1, ) self.gsm_receiver_0 = grgsm.receiver(4, ([0]), ([]), False) self.gsm_message_printer_1 = grgsm.message_printer(pmt.intern(""), False, False, False) self.gsm_input_0 = grgsm.gsm_input( ppm=ppm-int(ppm), osr=4, fc=fc, samp_rate_in=samp_rate, ) self.gsm_decryption_0 = grgsm.decryption(([]), 1) self.gsm_control_channels_decoder_0_0 = grgsm.control_channels_decoder() self.gsm_control_channels_decoder_0 = grgsm.control_channels_decoder() self.gsm_clock_offset_control_0 = grgsm.clock_offset_control(fc-shiftoff, samp_rate, osr) self.gsm_bcch_ccch_demapper_0 = grgsm.gsm_bcch_ccch_demapper( timeslot_nr=0, ) self.blocks_socket_pdu_0_1 = blocks.socket_pdu("UDP_CLIENT", collector, collectorport, 1500, False) self.blocks_socket_pdu_0_0 = blocks.socket_pdu("UDP_SERVER", "127.0.0.1", serverport, 10000, False) self.blocks_rotator_cc_0 = blocks.rotator_cc(-2*pi*shiftoff/samp_rate) ################################################## # Connections ################################################## self.msg_connect((self.blocks_socket_pdu_0_0, 'pdus'), (self.gsm_message_printer_1, 'msgs')) self.msg_connect((self.gsm_bcch_ccch_demapper_0, 'bursts'), (self.gsm_control_channels_decoder_0, 'bursts')) self.msg_connect((self.gsm_clock_offset_control_0, 'ctrl'), (self.gsm_input_0, 'ctrl_in')) self.msg_connect((self.gsm_control_channels_decoder_0, 'msgs'), (self.blocks_socket_pdu_0_1, 'pdus')) self.msg_connect((self.gsm_control_channels_decoder_0_0, 'msgs'), (self.blocks_socket_pdu_0_1, 'pdus')) self.msg_connect((self.gsm_decryption_0, 'bursts'), (self.gsm_control_channels_decoder_0_0, 'bursts')) self.msg_connect((self.gsm_receiver_0, 'C0'), (self.gsm_bcch_ccch_demapper_0, 'bursts')) self.msg_connect((self.gsm_receiver_0, 'measurements'), (self.gsm_clock_offset_control_0, 'measurements')) self.msg_connect((self.gsm_receiver_0, 'C0'), (self.gsm_sdcch8_demapper_0, 'bursts')) self.msg_connect((self.gsm_sdcch8_demapper_0, 'bursts'), (self.gsm_decryption_0, 'bursts')) self.connect((self.blocks_rotator_cc_0, 0), (self.gsm_input_0, 0)) self.connect((self.blocks_rotator_cc_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.gsm_input_0, 0), (self.gsm_receiver_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.blocks_rotator_cc_0, 0)) def closeEvent(self, event): self.settings = Qt.QSettings("GNU Radio", "grgsm_livemon") self.settings.setValue("geometry", self.saveGeometry()) event.accept() def get_args(self): return self.args def set_args(self, args): self.args = args def get_collector(self): return self.collector def set_collector(self, collector): self.collector = collector def get_collectorport(self): return self.collectorport def set_collectorport(self, collectorport): self.collectorport = collectorport def get_fc(self): return self.fc def set_fc(self, fc): self.fc = fc self.set_fc_slider(self.fc) self.gsm_input_0.set_fc(self.fc) def get_gain(self): return self.gain def set_gain(self, gain): self.gain = gain self.set_g_slider(self.gain) def get_osr(self): return self.osr def set_osr(self, osr): self.osr = osr def get_ppm(self): return self.ppm def set_ppm(self, ppm): self.ppm = ppm self.set_ppm_slider(self.ppm) self.gsm_input_0.set_ppm(self.ppm-int(self.ppm)) def get_samp_rate(self): return self.samp_rate def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.blocks_rotator_cc_0.set_phase_inc(-2*pi*self.shiftoff/self.samp_rate) self.gsm_input_0.set_samp_rate_in(self.samp_rate) self.qtgui_freq_sink_x_0.set_frequency_range(self.fc_slider, self.samp_rate) self.rtlsdr_source_0.set_sample_rate(self.samp_rate) def get_serverport(self): return self.serverport def set_serverport(self, serverport): self.serverport = serverport def get_shiftoff(self): return self.shiftoff def set_shiftoff(self, shiftoff): self.shiftoff = shiftoff self.blocks_rotator_cc_0.set_phase_inc(-2*pi*self.shiftoff/self.samp_rate) self.rtlsdr_source_0.set_center_freq(self.fc_slider-self.shiftoff, 0) self.rtlsdr_source_0.set_bandwidth(250e3+abs(self.shiftoff), 0) def get_ppm_slider(self): return self.ppm_slider def set_ppm_slider(self, ppm_slider): self.ppm_slider = ppm_slider self.rtlsdr_source_0.set_freq_corr(self.ppm_slider, 0) def get_g_slider(self): return self.g_slider def set_g_slider(self, g_slider): self.g_slider = g_slider self.rtlsdr_source_0.set_gain(self.g_slider, 0) def get_fc_slider(self): return self.fc_slider def set_fc_slider(self, fc_slider): self.fc_slider = fc_slider self.qtgui_freq_sink_x_0.set_frequency_range(self.fc_slider, self.samp_rate) self.rtlsdr_source_0.set_center_freq(self.fc_slider-self.shiftoff, 0) def argument_parser(): parser = OptionParser(option_class=eng_option, usage="%prog: [options]") parser.add_option( "", "--args", dest="args", type="string", default="", help="Set Device Arguments [default=%default]") parser.add_option( "", "--collector", dest="collector", type="string", default="localhost", help="Set IP or DNS name of collector point [default=%default]") parser.add_option( "", "--collectorport", dest="collectorport", type="string", default="4729", help="Set UDP port number of collector [default=%default]") parser.add_option( "-f", "--fc", dest="fc", type="eng_float", default=eng_notation.num_to_str(941.8e6), help="Set GSM channel's central frequency [default=%default]") parser.add_option( "-g", "--gain", dest="gain", type="eng_float", default=eng_notation.num_to_str(30), help="Set gain [default=%default]") parser.add_option( "", "--osr", dest="osr", type="intx", default=4, help="Set OverSampling Ratio [default=%default]") parser.add_option( "-p", "--ppm", dest="ppm", type="eng_float", default=eng_notation.num_to_str(0), help="Set ppm [default=%default]") parser.add_option( "-s", "--samp-rate", dest="samp_rate", type="eng_float", default=eng_notation.num_to_str(2000000.052982), help="Set samp_rate [default=%default]") parser.add_option( "", "--serverport", dest="serverport", type="string", default="4729", help="Set UDP server listening port [default=%default]") parser.add_option( "-o", "--shiftoff", dest="shiftoff", type="eng_float", default=eng_notation.num_to_str(400e3), help="Set Frequency Shiftoff [default=%default]") return parser def main(top_block_cls=grgsm_livemon, options=None): if options is None: options, _ = argument_parser().parse_args() from distutils.version import StrictVersion if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"): style = gr.prefs().get_string('qtgui', 'style', 'raster') Qt.QApplication.setGraphicsSystem(style) qapp = Qt.QApplication(sys.argv) tb = top_block_cls(args=options.args, collector=options.collector, collectorport=options.collectorport, fc=options.fc, gain=options.gain, osr=options.osr, ppm=options.ppm, samp_rate=options.samp_rate, serverport=options.serverport, shiftoff=options.shiftoff) tb.start() tb.show() def quitting(): tb.stop() tb.wait() qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting) qapp.exec_() if __name__ == '__main__': main() gr-gsm-0.41.2/apps/grgsm_livemon.grc000066400000000000000000001657701316153413000173170ustar00rootroot00000000000000 Sat Dec 13 10:49:59 2014 options author Piotr Krysik window_size 2280, 1024 category Custom comment description Interactive monitor of a single C0 channel with analysis performed by Wireshark (command to run wireshark: sudo wireshark -k -f udp -Y gsmtap -i lo) _enabled True _coordinate (16, 11) _rotation 0 generate_options qt_gui hier_block_src_path .: id grgsm_livemon max_nouts 0 qt_qss_theme realtime_scheduling run_command {python} -u {filename} run_options prompt run True thread_safe_setters title Gr-gsm Livemon variable_qtgui_range comment value fc _enabled True _coordinate (304, 11) gui_hint _rotation 0 id fc_slider label Frequency min_len 100 orient Qt.Horizontal start 800e6 step 2e5 stop 1990e6 rangeType float widget counter_slider variable_qtgui_range comment value gain _enabled True _coordinate (192, 11) gui_hint _rotation 0 id gain_slider label Gain min_len 100 orient Qt.Horizontal start 0 step 0.5 stop 50 rangeType float widget counter variable_qtgui_range comment value ppm _enabled True _coordinate (440, 11) gui_hint _rotation 0 id ppm_slider label PPM Offset min_len 100 orient Qt.Horizontal start -150 step 0.1 stop 150 rangeType float widget counter parameter alias comment _enabled True _coordinate (872, 11) _rotation 0 id args label Device Arguments short_id type string value "" blocks_rotator_cc alias comment affinity _enabled True _coordinate (256, 300) _rotation 0 id blocks_rotator_cc_0 maxoutbuf 0 minoutbuf 0 phase_inc -2*pi*shiftoff/samp_rate blocks_socket_pdu alias comment affinity _enabled True _coordinate (1632, 295) _rotation 0 host 127.0.0.1 id blocks_socket_pdu_0_0 mtu 10000 maxoutbuf 0 minoutbuf 0 port serverport tcp_no_delay False type "UDP_SERVER" blocks_socket_pdu alias comment affinity _enabled True _coordinate (1504, 295) _rotation 0 host collector id blocks_socket_pdu_0_1 mtu 1500 maxoutbuf 0 minoutbuf 0 port collectorport tcp_no_delay False type "UDP_CLIENT" parameter alias comment _enabled True _coordinate (1240, 7) _rotation 0 id collector label IP or DNS name of collector point short_id type string value localhost parameter alias comment _enabled True _coordinate (1240, 95) _rotation 0 id collectorport label UDP port number of collector short_id type string value 4729 parameter alias comment _enabled True _coordinate (624, 11) _rotation 0 id fc label GSM channel's central frequency short_id f type eng_float value 941.8e6 parameter alias comment _enabled True _coordinate (552, 11) _rotation 0 id gain label gain short_id g type eng_float value 30 gsm_bcch_ccch_demapper alias comment affinity _enabled True _coordinate (896, 284) _rotation 0 id gsm_bcch_ccch_demapper_0 maxoutbuf 0 minoutbuf 0 timeslot_nr 0 gsm_clock_offset_control alias comment affinity _enabled True _coordinate (552, 411) _rotation 180 id gsm_clock_offset_control_0 maxoutbuf 0 minoutbuf 0 osr osr fc fc-shiftoff samp_rate samp_rate gsm_control_channels_decoder alias comment affinity _enabled True _coordinate (1264, 289) _rotation 0 id gsm_control_channels_decoder_0 maxoutbuf 0 minoutbuf 0 gsm_control_channels_decoder alias comment affinity _enabled 1 _coordinate (1264, 345) _rotation 0 id gsm_control_channels_decoder_0_0 maxoutbuf 0 minoutbuf 0 gsm_decryption a5_version 1 alias comment affinity _enabled 1 _coordinate (1104, 333) _rotation 0 id gsm_decryption_0 k_c [] maxoutbuf 0 minoutbuf 0 gsm_input alias comment affinity _enabled True _coordinate (488, 305) _rotation 0 id gsm_input_0 maxoutbuf 0 minoutbuf 0 osr 4 fc fc ppm ppm-int(ppm) samp_rate_in samp_rate gsm_message_printer alias comment affinity _enabled True _coordinate (1776, 302) _rotation 0 id gsm_message_printer_1 prepend_frame_count False prepend_fnr False prepend_string "" print_gsmtap_header False gsm_receiver alias cell_allocation [0] comment affinity _enabled True _coordinate (672, 289) _rotation 0 id gsm_receiver_0 maxoutbuf 0 minoutbuf 0 num_streams 1 osr 4 tseq_nums [] gsm_sdcch8_demapper alias comment affinity _enabled True _coordinate (896, 340) _rotation 0 id gsm_sdcch8_demapper_0 maxoutbuf 0 minoutbuf 0 timeslot_nr 1 import alias comment _enabled True _coordinate (1016, 11) _rotation 0 id import_0 import from math import pi parameter alias comment _enabled True _coordinate (1088, 7) _rotation 0 id osr label OverSampling Ratio short_id type intx value 4 parameter alias comment _enabled True _coordinate (712, 11) _rotation 0 id ppm label ppm short_id p type eng_float value 0 qtgui_freq_sink_x autoscale False average 1.0 bw samp_rate alias fc fc_slider comment ctrlpanel False affinity _enabled True fftsize 1024 _coordinate (488, 187) gui_hint _rotation 0 grid False id qtgui_freq_sink_x_0 legend True alpha1 1.0 color1 "blue" label1 width1 1 alpha10 1.0 color10 "dark blue" label10 width10 1 alpha2 1.0 color2 "red" label2 width2 1 alpha3 1.0 color3 "green" label3 width3 1 alpha4 1.0 color4 "black" label4 width4 1 alpha5 1.0 color5 "cyan" label5 width5 1 alpha6 1.0 color6 "magenta" label6 width6 1 alpha7 1.0 color7 "yellow" label7 width7 1 alpha8 1.0 color8 "dark red" label8 width8 1 alpha9 1.0 color9 "dark green" label9 width9 1 maxoutbuf 0 minoutbuf 0 name "" nconnections 1 showports True freqhalf True tr_chan 0 tr_level 0.0 tr_mode qtgui.TRIG_MODE_FREE tr_tag "" type complex update_time 0.10 wintype firdes.WIN_BLACKMAN_hARRIS ymax 10 ymin -140 rtlsdr_source alias ant0 bb_gain0 20 bw0 250e3+abs(shiftoff) dc_offset_mode0 2 corr0 ppm_slider freq0 fc_slider-shiftoff gain_mode0 False if_gain0 20 iq_balance_mode0 2 gain0 gain_slider ant10 bb_gain10 20 bw10 0 dc_offset_mode10 0 corr10 0 freq10 100e6 gain_mode10 False if_gain10 20 iq_balance_mode10 0 gain10 10 ant11 bb_gain11 20 bw11 0 dc_offset_mode11 0 corr11 0 freq11 100e6 gain_mode11 False if_gain11 20 iq_balance_mode11 0 gain11 10 ant12 bb_gain12 20 bw12 0 dc_offset_mode12 0 corr12 0 freq12 100e6 gain_mode12 False if_gain12 20 iq_balance_mode12 0 gain12 10 ant13 bb_gain13 20 bw13 0 dc_offset_mode13 0 corr13 0 freq13 100e6 gain_mode13 False if_gain13 20 iq_balance_mode13 0 gain13 10 ant14 bb_gain14 20 bw14 0 dc_offset_mode14 0 corr14 0 freq14 100e6 gain_mode14 False if_gain14 20 iq_balance_mode14 0 gain14 10 ant15 bb_gain15 20 bw15 0 dc_offset_mode15 0 corr15 0 freq15 100e6 gain_mode15 False if_gain15 20 iq_balance_mode15 0 gain15 10 ant16 bb_gain16 20 bw16 0 dc_offset_mode16 0 corr16 0 freq16 100e6 gain_mode16 False if_gain16 20 iq_balance_mode16 0 gain16 10 ant17 bb_gain17 20 bw17 0 dc_offset_mode17 0 corr17 0 freq17 100e6 gain_mode17 False if_gain17 20 iq_balance_mode17 0 gain17 10 ant18 bb_gain18 20 bw18 0 dc_offset_mode18 0 corr18 0 freq18 100e6 gain_mode18 False if_gain18 20 iq_balance_mode18 0 gain18 10 ant19 bb_gain19 20 bw19 0 dc_offset_mode19 0 corr19 0 freq19 100e6 gain_mode19 False if_gain19 20 iq_balance_mode19 0 gain19 10 ant1 bb_gain1 20 bw1 0 dc_offset_mode1 0 corr1 0 freq1 100e6 gain_mode1 True if_gain1 20 iq_balance_mode1 0 gain1 10 ant20 bb_gain20 20 bw20 0 dc_offset_mode20 0 corr20 0 freq20 100e6 gain_mode20 False if_gain20 20 iq_balance_mode20 0 gain20 10 ant21 bb_gain21 20 bw21 0 dc_offset_mode21 0 corr21 0 freq21 100e6 gain_mode21 False if_gain21 20 iq_balance_mode21 0 gain21 10 ant22 bb_gain22 20 bw22 0 dc_offset_mode22 0 corr22 0 freq22 100e6 gain_mode22 False if_gain22 20 iq_balance_mode22 0 gain22 10 ant23 bb_gain23 20 bw23 0 dc_offset_mode23 0 corr23 0 freq23 100e6 gain_mode23 False if_gain23 20 iq_balance_mode23 0 gain23 10 ant24 bb_gain24 20 bw24 0 dc_offset_mode24 0 corr24 0 freq24 100e6 gain_mode24 False if_gain24 20 iq_balance_mode24 0 gain24 10 ant25 bb_gain25 20 bw25 0 dc_offset_mode25 0 corr25 0 freq25 100e6 gain_mode25 False if_gain25 20 iq_balance_mode25 0 gain25 10 ant26 bb_gain26 20 bw26 0 dc_offset_mode26 0 corr26 0 freq26 100e6 gain_mode26 False if_gain26 20 iq_balance_mode26 0 gain26 10 ant27 bb_gain27 20 bw27 0 dc_offset_mode27 0 corr27 0 freq27 100e6 gain_mode27 False if_gain27 20 iq_balance_mode27 0 gain27 10 ant28 bb_gain28 20 bw28 0 dc_offset_mode28 0 corr28 0 freq28 100e6 gain_mode28 False if_gain28 20 iq_balance_mode28 0 gain28 10 ant29 bb_gain29 20 bw29 0 dc_offset_mode29 0 corr29 0 freq29 100e6 gain_mode29 False if_gain29 20 iq_balance_mode29 0 gain29 10 ant2 bb_gain2 20 bw2 0 dc_offset_mode2 0 corr2 0 freq2 100e6 gain_mode2 True if_gain2 20 iq_balance_mode2 0 gain2 10 ant30 bb_gain30 20 bw30 0 dc_offset_mode30 0 corr30 0 freq30 100e6 gain_mode30 False if_gain30 20 iq_balance_mode30 0 gain30 10 ant31 bb_gain31 20 bw31 0 dc_offset_mode31 0 corr31 0 freq31 100e6 gain_mode31 False if_gain31 20 iq_balance_mode31 0 gain31 10 ant3 bb_gain3 20 bw3 0 dc_offset_mode3 0 corr3 0 freq3 100e6 gain_mode3 True if_gain3 20 iq_balance_mode3 0 gain3 10 ant4 bb_gain4 20 bw4 0 dc_offset_mode4 0 corr4 0 freq4 100e6 gain_mode4 True if_gain4 20 iq_balance_mode4 0 gain4 10 ant5 bb_gain5 20 bw5 0 dc_offset_mode5 0 corr5 0 freq5 100e6 gain_mode5 False if_gain5 20 iq_balance_mode5 0 gain5 10 ant6 bb_gain6 20 bw6 0 dc_offset_mode6 0 corr6 0 freq6 100e6 gain_mode6 False if_gain6 20 iq_balance_mode6 0 gain6 10 ant7 bb_gain7 20 bw7 0 dc_offset_mode7 0 corr7 0 freq7 100e6 gain_mode7 False if_gain7 20 iq_balance_mode7 0 gain7 10 ant8 bb_gain8 20 bw8 0 dc_offset_mode8 0 corr8 0 freq8 100e6 gain_mode8 False if_gain8 20 iq_balance_mode8 0 gain8 10 ant9 bb_gain9 20 bw9 0 dc_offset_mode9 0 corr9 0 freq9 100e6 gain_mode9 False if_gain9 20 iq_balance_mode9 0 gain9 10 comment affinity args args _enabled True _coordinate (8, 237) _rotation 0 id rtlsdr_source_0 maxoutbuf 0 clock_source0 time_source0 clock_source1 time_source1 clock_source2 time_source2 clock_source3 time_source3 clock_source4 time_source4 clock_source5 time_source5 clock_source6 time_source6 clock_source7 time_source7 minoutbuf 0 nchan 1 num_mboards 1 type fc32 sample_rate samp_rate sync parameter alias comment _enabled True _coordinate (16, 115) _rotation 0 id samp_rate label samp_rate short_id s type eng_float value 2000000.052982 parameter alias comment _enabled True _coordinate (1400, 7) _rotation 0 id serverport label UDP server listening port short_id type string value 4729 parameter alias comment _enabled True _coordinate (784, 11) _rotation 0 id shiftoff label Frequency Shiftoff short_id o type eng_float value 400e3 blocks_rotator_cc_0 gsm_input_0 0 0 blocks_rotator_cc_0 qtgui_freq_sink_x_0 0 0 blocks_socket_pdu_0_0 gsm_message_printer_1 pdus msgs gsm_bcch_ccch_demapper_0 gsm_control_channels_decoder_0 bursts bursts gsm_clock_offset_control_0 gsm_input_0 ctrl ctrl_in gsm_control_channels_decoder_0 blocks_socket_pdu_0_1 msgs pdus gsm_control_channels_decoder_0_0 blocks_socket_pdu_0_1 msgs pdus gsm_decryption_0 gsm_control_channels_decoder_0_0 bursts bursts gsm_input_0 gsm_receiver_0 0 0 gsm_receiver_0 gsm_bcch_ccch_demapper_0 C0 bursts gsm_receiver_0 gsm_sdcch8_demapper_0 C0 bursts gsm_receiver_0 gsm_clock_offset_control_0 measurements measurements gsm_sdcch8_demapper_0 gsm_decryption_0 bursts bursts rtlsdr_source_0 blocks_rotator_cc_0 0 0 gr-gsm-0.41.2/apps/grgsm_livemon_headless000066400000000000000000000246001316153413000203770ustar00rootroot00000000000000#!/usr/bin/env python2 # -*- coding: utf-8 -*- # @file # @author (C) 2017 by Piotr Krysik # @section LICENSE # # Gr-gsm is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Gr-gsm is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with gr-gsm; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # # ################################################## # GNU Radio Python Flow Graph # Title: Gr-gsm Livemon # Author: Piotr Krysik # Description: Interactive monitor of a single C0 channel with analysis performed by Wireshark (command to run wireshark: sudo wireshark -k -f udp -Y gsmtap -i lo) # Generated: Wed Sep 6 16:27:23 2017 ################################################## from gnuradio import blocks from gnuradio import eng_notation from gnuradio import gr from gnuradio.eng_option import eng_option from gnuradio.filter import firdes from grgsm import arfcn from math import pi from optparse import OptionParser import grgsm import osmosdr import pmt import time class grgsm_livemon_headless(gr.top_block): def __init__(self, args="", collector="localhost", collectorport="4729", gain=30, osr=4, ppm=0, rec_len=1000000, samp_rate=2000000.052982, serverport="4729", shiftoff=400e3, fc=957e6): gr.top_block.__init__(self, "Gr-gsm Livemon") ################################################## # Parameters ################################################## self.args = args self.collector = collector self.collectorport = collectorport self.gain = gain self.osr = osr self.ppm = ppm self.rec_len = rec_len self.samp_rate = samp_rate self.serverport = serverport self.shiftoff = shiftoff self.fc = fc ################################################## # Blocks ################################################## self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + args ) self.rtlsdr_source_0.set_sample_rate(samp_rate) self.rtlsdr_source_0.set_center_freq(fc-shiftoff, 0) self.rtlsdr_source_0.set_freq_corr(ppm, 0) self.rtlsdr_source_0.set_dc_offset_mode(2, 0) self.rtlsdr_source_0.set_iq_balance_mode(2, 0) self.rtlsdr_source_0.set_gain_mode(False, 0) self.rtlsdr_source_0.set_gain(gain, 0) self.rtlsdr_source_0.set_if_gain(20, 0) self.rtlsdr_source_0.set_bb_gain(20, 0) self.rtlsdr_source_0.set_antenna("", 0) self.rtlsdr_source_0.set_bandwidth(250e3+abs(shiftoff), 0) self.gsm_sdcch8_demapper_0 = grgsm.gsm_sdcch8_demapper( timeslot_nr=1, ) self.gsm_receiver_0 = grgsm.receiver(4, ([arfcn.downlink2arfcn(fc)]), ([]), False) self.gsm_message_printer_1 = grgsm.message_printer(pmt.intern(""), False, False, False) self.gsm_input_0 = grgsm.gsm_input( ppm=ppm-int(ppm), osr=4, fc=fc, samp_rate_in=samp_rate, ) self.gsm_decryption_0 = grgsm.decryption(([]), 1) self.gsm_control_channels_decoder_0_0 = grgsm.control_channels_decoder() self.gsm_control_channels_decoder_0 = grgsm.control_channels_decoder() self.gsm_clock_offset_control_0 = grgsm.clock_offset_control(fc-shiftoff, samp_rate, osr) self.gsm_bcch_ccch_sdcch4_demapper_0 = grgsm.gsm_bcch_ccch_sdcch4_demapper( timeslot_nr=0, ) self.blocks_socket_pdu_0_1 = blocks.socket_pdu("UDP_CLIENT", collector, collectorport, 1500, False) self.blocks_socket_pdu_0_0 = blocks.socket_pdu("UDP_SERVER", "127.0.0.1", serverport, 10000, False) self.blocks_rotator_cc_0 = blocks.rotator_cc(-2*pi*shiftoff/samp_rate) self.blocks_head_0 = blocks.head(gr.sizeof_gr_complex*1, int(rec_len*samp_rate)) ################################################## # Connections ################################################## self.msg_connect((self.blocks_socket_pdu_0_0, 'pdus'), (self.gsm_message_printer_1, 'msgs')) self.msg_connect((self.gsm_bcch_ccch_sdcch4_demapper_0, 'bursts'), (self.gsm_control_channels_decoder_0, 'bursts')) self.msg_connect((self.gsm_clock_offset_control_0, 'ctrl'), (self.gsm_input_0, 'ctrl_in')) self.msg_connect((self.gsm_control_channels_decoder_0, 'msgs'), (self.blocks_socket_pdu_0_1, 'pdus')) self.msg_connect((self.gsm_control_channels_decoder_0_0, 'msgs'), (self.blocks_socket_pdu_0_1, 'pdus')) self.msg_connect((self.gsm_decryption_0, 'bursts'), (self.gsm_control_channels_decoder_0_0, 'bursts')) self.msg_connect((self.gsm_receiver_0, 'C0'), (self.gsm_bcch_ccch_sdcch4_demapper_0, 'bursts')) self.msg_connect((self.gsm_receiver_0, 'measurements'), (self.gsm_clock_offset_control_0, 'measurements')) self.msg_connect((self.gsm_receiver_0, 'C0'), (self.gsm_sdcch8_demapper_0, 'bursts')) self.msg_connect((self.gsm_sdcch8_demapper_0, 'bursts'), (self.gsm_decryption_0, 'bursts')) self.connect((self.blocks_head_0, 0), (self.blocks_rotator_cc_0, 0)) self.connect((self.blocks_rotator_cc_0, 0), (self.gsm_input_0, 0)) self.connect((self.gsm_input_0, 0), (self.gsm_receiver_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.blocks_head_0, 0)) def get_args(self): return self.args def set_args(self, args): self.args = args def get_collector(self): return self.collector def set_collector(self, collector): self.collector = collector def get_collectorport(self): return self.collectorport def set_collectorport(self, collectorport): self.collectorport = collectorport def get_gain(self): return self.gain def set_gain(self, gain): self.gain = gain self.rtlsdr_source_0.set_gain(self.gain, 0) def get_osr(self): return self.osr def set_osr(self, osr): self.osr = osr def get_ppm(self): return self.ppm def set_ppm(self, ppm): self.ppm = ppm self.gsm_input_0.set_ppm(self.ppm-int(self.ppm)) self.rtlsdr_source_0.set_freq_corr(self.ppm, 0) def get_rec_len(self): return self.rec_len def set_rec_len(self, rec_len): self.rec_len = rec_len self.blocks_head_0.set_length(int(self.rec_len*self.samp_rate)) def get_samp_rate(self): return self.samp_rate def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.blocks_head_0.set_length(int(self.rec_len*self.samp_rate)) self.blocks_rotator_cc_0.set_phase_inc(-2*pi*self.shiftoff/self.samp_rate) self.gsm_input_0.set_samp_rate_in(self.samp_rate) self.rtlsdr_source_0.set_sample_rate(self.samp_rate) def get_serverport(self): return self.serverport def set_serverport(self, serverport): self.serverport = serverport def get_shiftoff(self): return self.shiftoff def set_shiftoff(self, shiftoff): self.shiftoff = shiftoff self.blocks_rotator_cc_0.set_phase_inc(-2*pi*self.shiftoff/self.samp_rate) self.rtlsdr_source_0.set_center_freq(self.fc-self.shiftoff, 0) self.rtlsdr_source_0.set_bandwidth(250e3+abs(self.shiftoff), 0) def get_fc(self): return self.fc def set_fc(self, fc): self.fc = fc self.gsm_input_0.set_fc(self.fc) self.rtlsdr_source_0.set_center_freq(self.fc-self.shiftoff, 0) def argument_parser(): parser = OptionParser(option_class=eng_option, usage="%prog: [options]") parser.add_option( "", "--args", dest="args", type="string", default="", help="Set Device Arguments [default=%default]") parser.add_option( "", "--collector", dest="collector", type="string", default="localhost", help="Set IP or DNS name of collector point [default=%default]") parser.add_option( "", "--collectorport", dest="collectorport", type="string", default="4729", help="Set UDP port number of collector [default=%default]") parser.add_option( "-g", "--gain", dest="gain", type="eng_float", default=eng_notation.num_to_str(30), help="Set RF Gain [default=%default]") parser.add_option( "", "--osr", dest="osr", type="intx", default=4, help="Set OverSampling Ratio [default=%default]") parser.add_option( "-p", "--ppm", dest="ppm", type="eng_float", default=eng_notation.num_to_str(0), help="Set Clock frequency offset in ppms (1/1e6 parts) [default=%default]") parser.add_option( "-T", "--rec-len", dest="rec_len", type="eng_float", default=eng_notation.num_to_str(1000000), help="Set Recording length in seconds [default=%default]") parser.add_option( "-s", "--samp-rate", dest="samp_rate", type="eng_float", default=eng_notation.num_to_str(2000000.052982), help="Set samp_rate [default=%default]") parser.add_option( "", "--serverport", dest="serverport", type="string", default="4729", help="Set UDP server listening port [default=%default]") parser.add_option( "-o", "--shiftoff", dest="shiftoff", type="eng_float", default=eng_notation.num_to_str(400e3), help="Set Frequency Shiftoff [default=%default]") parser.add_option( "-f", "--fc", dest="fc", type="eng_float", default=eng_notation.num_to_str(957e6), help="Set GSM channel's central frequency [default=%default]") return parser def main(top_block_cls=grgsm_livemon_headless, options=None): if options is None: options, _ = argument_parser().parse_args() tb = top_block_cls(args=options.args, collector=options.collector, collectorport=options.collectorport, gain=options.gain, osr=options.osr, ppm=options.ppm, rec_len=options.rec_len, samp_rate=options.samp_rate, serverport=options.serverport, shiftoff=options.shiftoff, fc=options.fc) tb.start() tb.wait() if __name__ == '__main__': main() gr-gsm-0.41.2/apps/grgsm_livemon_headless.grc000066400000000000000000001511241316153413000211530ustar00rootroot00000000000000 Sat Dec 13 10:49:59 2014 options author Piotr Krysik window_size 2280, 1024 category Custom comment description Interactive monitor of a single C0 channel with analysis performed by Wireshark (command to run wireshark: sudo wireshark -k -f udp -Y gsmtap -i lo) _enabled True _coordinate (16, 11) _rotation 0 generate_options no_gui hier_block_src_path .: id grgsm_livemon_headless max_nouts 0 qt_qss_theme realtime_scheduling run_command {python} -u {filename} run_options run run True thread_safe_setters title Gr-gsm Livemon parameter alias comment _enabled True _coordinate (752, 7) _rotation 0 id args label Device Arguments short_id type string value "" blocks_head alias comment affinity _enabled True _coordinate (256, 300) _rotation 0 id blocks_head_0 maxoutbuf 0 minoutbuf 0 num_items int(rec_len*samp_rate) type complex vlen 1 blocks_rotator_cc alias comment affinity _enabled True _coordinate (416, 300) _rotation 0 id blocks_rotator_cc_0 maxoutbuf 0 minoutbuf 0 phase_inc -2*pi*shiftoff/samp_rate blocks_socket_pdu alias comment affinity _enabled True _coordinate (1736, 295) _rotation 0 host 127.0.0.1 id blocks_socket_pdu_0_0 mtu 10000 maxoutbuf 0 minoutbuf 0 port serverport tcp_no_delay False type "UDP_SERVER" blocks_socket_pdu alias comment affinity _enabled True _coordinate (1608, 295) _rotation 0 host collector id blocks_socket_pdu_0_1 mtu 1500 maxoutbuf 0 minoutbuf 0 port collectorport tcp_no_delay False type "UDP_CLIENT" parameter alias comment _enabled True _coordinate (1048, 7) _rotation 0 id collector label IP or DNS name of collector point short_id type string value localhost parameter alias comment _enabled True _coordinate (1208, 7) _rotation 0 id collectorport label UDP port number of collector short_id type string value 4729 parameter alias comment _enabled True _coordinate (584, 8) _rotation 0 id fc label GSM channel's central frequency short_id f type eng_float value 957e6 parameter alias comment _enabled True _coordinate (480, 8) _rotation 0 id gain label RF Gain short_id g type eng_float value 30 gsm_bcch_ccch_sdcch4_demapper alias comment affinity _enabled True _coordinate (1016, 284) _rotation 0 id gsm_bcch_ccch_sdcch4_demapper_0 maxoutbuf 0 minoutbuf 0 timeslot_nr 0 gsm_clock_offset_control alias comment affinity _enabled True _coordinate (688, 414) _rotation 180 id gsm_clock_offset_control_0 maxoutbuf 0 minoutbuf 0 osr osr fc fc-shiftoff samp_rate samp_rate gsm_control_channels_decoder alias comment affinity _enabled True _coordinate (1368, 289) _rotation 0 id gsm_control_channels_decoder_0 maxoutbuf 0 minoutbuf 0 gsm_control_channels_decoder alias comment affinity _enabled 1 _coordinate (1368, 345) _rotation 0 id gsm_control_channels_decoder_0_0 maxoutbuf 0 minoutbuf 0 gsm_decryption a5_version 1 alias comment affinity _enabled 1 _coordinate (1208, 333) _rotation 0 id gsm_decryption_0 k_c [] maxoutbuf 0 minoutbuf 0 gsm_input alias comment affinity _enabled True _coordinate (624, 305) _rotation 0 id gsm_input_0 maxoutbuf 0 minoutbuf 0 osr 4 fc fc ppm ppm-int(ppm) samp_rate_in samp_rate gsm_message_printer alias comment affinity _enabled True _coordinate (1880, 302) _rotation 0 id gsm_message_printer_1 prepend_frame_count False prepend_fnr False prepend_string "" print_gsmtap_header False gsm_receiver alias cell_allocation [arfcn.downlink2arfcn(fc)] comment affinity _enabled True _coordinate (808, 289) _rotation 0 id gsm_receiver_0 maxoutbuf 0 minoutbuf 0 num_streams 1 osr 4 tseq_nums [] gsm_sdcch8_demapper alias comment affinity _enabled True _coordinate (1016, 340) _rotation 0 id gsm_sdcch8_demapper_0 maxoutbuf 0 minoutbuf 0 timeslot_nr 1 import alias comment _enabled True _coordinate (200, 12) _rotation 0 id import_0 import from math import pi import alias comment _enabled True _coordinate (200, 60) _rotation 0 id import_1 import from grgsm import arfcn parameter alias comment _enabled True _coordinate (896, 7) _rotation 0 id osr label OverSampling Ratio short_id type intx value 4 parameter alias comment _enabled True _coordinate (312, 112) _rotation 0 id ppm label Clock frequency offset in ppms (1/1e6 parts) short_id p type eng_float value 0 parameter alias comment _enabled True _coordinate (312, 8) _rotation 0 id rec_len label Recording length in seconds short_id T type eng_float value 1000000 rtlsdr_source alias ant0 bb_gain0 20 bw0 250e3+abs(shiftoff) dc_offset_mode0 2 corr0 ppm freq0 fc-shiftoff gain_mode0 False if_gain0 20 iq_balance_mode0 2 gain0 gain ant10 bb_gain10 20 bw10 0 dc_offset_mode10 0 corr10 0 freq10 100e6 gain_mode10 False if_gain10 20 iq_balance_mode10 0 gain10 10 ant11 bb_gain11 20 bw11 0 dc_offset_mode11 0 corr11 0 freq11 100e6 gain_mode11 False if_gain11 20 iq_balance_mode11 0 gain11 10 ant12 bb_gain12 20 bw12 0 dc_offset_mode12 0 corr12 0 freq12 100e6 gain_mode12 False if_gain12 20 iq_balance_mode12 0 gain12 10 ant13 bb_gain13 20 bw13 0 dc_offset_mode13 0 corr13 0 freq13 100e6 gain_mode13 False if_gain13 20 iq_balance_mode13 0 gain13 10 ant14 bb_gain14 20 bw14 0 dc_offset_mode14 0 corr14 0 freq14 100e6 gain_mode14 False if_gain14 20 iq_balance_mode14 0 gain14 10 ant15 bb_gain15 20 bw15 0 dc_offset_mode15 0 corr15 0 freq15 100e6 gain_mode15 False if_gain15 20 iq_balance_mode15 0 gain15 10 ant16 bb_gain16 20 bw16 0 dc_offset_mode16 0 corr16 0 freq16 100e6 gain_mode16 False if_gain16 20 iq_balance_mode16 0 gain16 10 ant17 bb_gain17 20 bw17 0 dc_offset_mode17 0 corr17 0 freq17 100e6 gain_mode17 False if_gain17 20 iq_balance_mode17 0 gain17 10 ant18 bb_gain18 20 bw18 0 dc_offset_mode18 0 corr18 0 freq18 100e6 gain_mode18 False if_gain18 20 iq_balance_mode18 0 gain18 10 ant19 bb_gain19 20 bw19 0 dc_offset_mode19 0 corr19 0 freq19 100e6 gain_mode19 False if_gain19 20 iq_balance_mode19 0 gain19 10 ant1 bb_gain1 20 bw1 0 dc_offset_mode1 0 corr1 0 freq1 100e6 gain_mode1 True if_gain1 20 iq_balance_mode1 0 gain1 10 ant20 bb_gain20 20 bw20 0 dc_offset_mode20 0 corr20 0 freq20 100e6 gain_mode20 False if_gain20 20 iq_balance_mode20 0 gain20 10 ant21 bb_gain21 20 bw21 0 dc_offset_mode21 0 corr21 0 freq21 100e6 gain_mode21 False if_gain21 20 iq_balance_mode21 0 gain21 10 ant22 bb_gain22 20 bw22 0 dc_offset_mode22 0 corr22 0 freq22 100e6 gain_mode22 False if_gain22 20 iq_balance_mode22 0 gain22 10 ant23 bb_gain23 20 bw23 0 dc_offset_mode23 0 corr23 0 freq23 100e6 gain_mode23 False if_gain23 20 iq_balance_mode23 0 gain23 10 ant24 bb_gain24 20 bw24 0 dc_offset_mode24 0 corr24 0 freq24 100e6 gain_mode24 False if_gain24 20 iq_balance_mode24 0 gain24 10 ant25 bb_gain25 20 bw25 0 dc_offset_mode25 0 corr25 0 freq25 100e6 gain_mode25 False if_gain25 20 iq_balance_mode25 0 gain25 10 ant26 bb_gain26 20 bw26 0 dc_offset_mode26 0 corr26 0 freq26 100e6 gain_mode26 False if_gain26 20 iq_balance_mode26 0 gain26 10 ant27 bb_gain27 20 bw27 0 dc_offset_mode27 0 corr27 0 freq27 100e6 gain_mode27 False if_gain27 20 iq_balance_mode27 0 gain27 10 ant28 bb_gain28 20 bw28 0 dc_offset_mode28 0 corr28 0 freq28 100e6 gain_mode28 False if_gain28 20 iq_balance_mode28 0 gain28 10 ant29 bb_gain29 20 bw29 0 dc_offset_mode29 0 corr29 0 freq29 100e6 gain_mode29 False if_gain29 20 iq_balance_mode29 0 gain29 10 ant2 bb_gain2 20 bw2 0 dc_offset_mode2 0 corr2 0 freq2 100e6 gain_mode2 True if_gain2 20 iq_balance_mode2 0 gain2 10 ant30 bb_gain30 20 bw30 0 dc_offset_mode30 0 corr30 0 freq30 100e6 gain_mode30 False if_gain30 20 iq_balance_mode30 0 gain30 10 ant31 bb_gain31 20 bw31 0 dc_offset_mode31 0 corr31 0 freq31 100e6 gain_mode31 False if_gain31 20 iq_balance_mode31 0 gain31 10 ant3 bb_gain3 20 bw3 0 dc_offset_mode3 0 corr3 0 freq3 100e6 gain_mode3 True if_gain3 20 iq_balance_mode3 0 gain3 10 ant4 bb_gain4 20 bw4 0 dc_offset_mode4 0 corr4 0 freq4 100e6 gain_mode4 True if_gain4 20 iq_balance_mode4 0 gain4 10 ant5 bb_gain5 20 bw5 0 dc_offset_mode5 0 corr5 0 freq5 100e6 gain_mode5 False if_gain5 20 iq_balance_mode5 0 gain5 10 ant6 bb_gain6 20 bw6 0 dc_offset_mode6 0 corr6 0 freq6 100e6 gain_mode6 False if_gain6 20 iq_balance_mode6 0 gain6 10 ant7 bb_gain7 20 bw7 0 dc_offset_mode7 0 corr7 0 freq7 100e6 gain_mode7 False if_gain7 20 iq_balance_mode7 0 gain7 10 ant8 bb_gain8 20 bw8 0 dc_offset_mode8 0 corr8 0 freq8 100e6 gain_mode8 False if_gain8 20 iq_balance_mode8 0 gain8 10 ant9 bb_gain9 20 bw9 0 dc_offset_mode9 0 corr9 0 freq9 100e6 gain_mode9 False if_gain9 20 iq_balance_mode9 0 gain9 10 comment affinity args args _enabled True _coordinate (8, 237) _rotation 0 id rtlsdr_source_0 maxoutbuf 0 clock_source0 time_source0 clock_source1 time_source1 clock_source2 time_source2 clock_source3 time_source3 clock_source4 time_source4 clock_source5 time_source5 clock_source6 time_source6 clock_source7 time_source7 minoutbuf 0 nchan 1 num_mboards 1 type fc32 sample_rate samp_rate sync parameter alias comment _enabled True _coordinate (16, 128) _rotation 0 id samp_rate label samp_rate short_id s type eng_float value 2000000.052982 parameter alias comment _enabled True _coordinate (1368, 7) _rotation 0 id serverport label UDP server listening port short_id type string value 4729 parameter alias comment _enabled True _coordinate (584, 112) _rotation 0 id shiftoff label Frequency Shiftoff short_id o type eng_float value 400e3 blocks_head_0 blocks_rotator_cc_0 0 0 blocks_rotator_cc_0 gsm_input_0 0 0 blocks_socket_pdu_0_0 gsm_message_printer_1 pdus msgs gsm_bcch_ccch_sdcch4_demapper_0 gsm_control_channels_decoder_0 bursts bursts gsm_clock_offset_control_0 gsm_input_0 ctrl ctrl_in gsm_control_channels_decoder_0 blocks_socket_pdu_0_1 msgs pdus gsm_control_channels_decoder_0_0 blocks_socket_pdu_0_1 msgs pdus gsm_decryption_0 gsm_control_channels_decoder_0_0 bursts bursts gsm_input_0 gsm_receiver_0 0 0 gsm_receiver_0 gsm_bcch_ccch_sdcch4_demapper_0 C0 bursts gsm_receiver_0 gsm_sdcch8_demapper_0 C0 bursts gsm_receiver_0 gsm_clock_offset_control_0 measurements measurements gsm_sdcch8_demapper_0 gsm_decryption_0 bursts bursts rtlsdr_source_0 blocks_head_0 0 0 gr-gsm-0.41.2/apps/grgsm_scanner000077500000000000000000000402641316153413000165160ustar00rootroot00000000000000#!/usr/bin/env python # -*- coding: utf-8 -*- # @file # @author (C) 2015 by Piotr Krysik # @author (C) 2015 by Roman Khassraf # @section LICENSE # # Gr-gsm is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Gr-gsm is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with gr-gsm; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # # from gnuradio import blocks from gnuradio import gr from gnuradio import eng_notation from gnuradio.eng_option import eng_option from gnuradio.filter import firdes from gnuradio.filter import pfb from math import pi from optparse import OptionParser import grgsm import numpy import os import osmosdr import pmt import time # from wideband_receiver import * class receiver_with_decoder(grgsm.hier_block): def __init__(self, OSR=4, chan_num=0, fc=939.4e6, ppm=0, samp_rate=0.2e6): grgsm.hier_block.__init__( self, "Receiver With Decoder", gr.io_signature(1, 1, gr.sizeof_gr_complex * 1), gr.io_signature(0, 0, 0), ) self.message_port_register_hier_out("bursts") self.message_port_register_hier_out("msgs") ################################################## # Parameters ################################################## self.OSR = OSR self.chan_num = chan_num self.fc = fc self.ppm = ppm self.samp_rate = samp_rate ################################################## # Variables ################################################## self.samp_rate_out = samp_rate_out = 1625000.0 / 6.0 * OSR ################################################## # Blocks ################################################## self.gsm_receiver_0 = grgsm.receiver(OSR, ([chan_num]), ([])) self.gsm_input_0 = grgsm.gsm_input( ppm=ppm, osr=OSR, fc=fc, samp_rate_in=samp_rate, ) self.gsm_control_channels_decoder_0 = grgsm.control_channels_decoder() self.gsm_clock_offset_control_0 = grgsm.clock_offset_control(fc, samp_rate, osr=4) self.gsm_bcch_ccch_demapper_0 = grgsm.gsm_bcch_ccch_demapper(0) ################################################## # Connections ################################################## self.msg_connect(self.gsm_bcch_ccch_demapper_0, 'bursts', self, 'bursts') self.msg_connect(self.gsm_bcch_ccch_demapper_0, 'bursts', self.gsm_control_channels_decoder_0, 'bursts') self.msg_connect(self.gsm_clock_offset_control_0, 'ctrl', self.gsm_input_0, 'ctrl_in') self.msg_connect(self.gsm_control_channels_decoder_0, 'msgs', self, 'msgs') self.msg_connect(self.gsm_receiver_0, 'C0', self.gsm_bcch_ccch_demapper_0, 'bursts') self.msg_connect(self.gsm_receiver_0, 'measurements', self.gsm_clock_offset_control_0, 'measurements') self.connect((self.gsm_input_0, 0), (self.gsm_receiver_0, 0)) self.connect((self, 0), (self.gsm_input_0, 0)) def get_OSR(self): return self.OSR def set_OSR(self, OSR): self.OSR = OSR self.set_samp_rate_out(1625000.0 / 6.0 * self.OSR) self.gsm_input_0.set_osr(self.OSR) def get_chan_num(self): return self.chan_num def set_chan_num(self, chan_num): self.chan_num = chan_num def get_fc(self): return self.fc def set_fc(self, fc): self.fc = fc self.gsm_input_0.set_fc(self.fc) def get_ppm(self): return self.ppm def set_ppm(self, ppm): self.ppm = ppm self.gsm_input_0.set_ppm(self.ppm) def get_samp_rate(self): return self.samp_rate def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.gsm_input_0.set_samp_rate_in(self.samp_rate) def get_samp_rate_out(self): return self.samp_rate_out def set_samp_rate_out(self, samp_rate_out): self.samp_rate_out = samp_rate_out class wideband_receiver(grgsm.hier_block): def __init__(self, OSR=4, fc=939.4e6, samp_rate=0.4e6): grgsm.hier_block.__init__( self, "Wideband receiver", gr.io_signature(1, 1, gr.sizeof_gr_complex * 1), gr.io_signature(0, 0, 0), ) self.message_port_register_hier_out("bursts") self.message_port_register_hier_out("msgs") self.__init(OSR, fc, samp_rate) def __init(self, OSR=4, fc=939.4e6, samp_rate=0.4e6): ################################################## # Parameters ################################################## self.OSR = OSR self.fc = fc self.samp_rate = samp_rate self.channels_num = int(samp_rate / 0.2e6) self.OSR_PFB = 2 ################################################## # Blocks ################################################## self.pfb_channelizer_ccf_0 = pfb.channelizer_ccf( self.channels_num, (), self.OSR_PFB, 100) self.pfb_channelizer_ccf_0.set_channel_map(([])) self.create_receivers() ################################################## # Connections ################################################## self.connect((self, 0), (self.pfb_channelizer_ccf_0, 0)) for chan in xrange(0, self.channels_num): self.connect((self.pfb_channelizer_ccf_0, chan), (self.receivers_with_decoders[chan], 0)) self.msg_connect(self.receivers_with_decoders[chan], 'bursts', self, 'bursts') self.msg_connect(self.receivers_with_decoders[chan], 'msgs', self, 'msgs') def create_receivers(self): self.receivers_with_decoders = {} for chan in xrange(0, self.channels_num): self.receivers_with_decoders[chan] = receiver_with_decoder(fc=self.fc, OSR=self.OSR, chan_num=chan, samp_rate=self.OSR_PFB * 0.2e6) def get_OSR(self): return self.OSR def set_OSR(self, OSR): self.OSR = OSR self.create_receivers() def get_fc(self): return self.fc def set_fc(self, fc): self.fc = fc self.create_receivers() def get_samp_rate(self): return self.samp_rate class wideband_scanner(gr.top_block): def __init__(self, rec_len=3, sample_rate=2e6, carrier_frequency=939e6, gain=24, ppm=0, args=""): gr.top_block.__init__(self, "Wideband Scanner") self.rec_len = rec_len self.sample_rate = sample_rate self.carrier_frequency = carrier_frequency self.ppm = ppm # if no file name is given process data from rtl_sdr source print "Args=", args self.rtlsdr_source = osmosdr.source(args="numchan=" + str(1) + " " + args) self.rtlsdr_source.set_min_output_buffer(int(sample_rate*rec_len)) self.rtlsdr_source.set_sample_rate(sample_rate) # capture half of GSM channel lower than channel center (-0.1MHz) # this is needed when even number of channels is captured in order to process full captured bandwidth self.rtlsdr_source.set_center_freq(carrier_frequency - 0.1e6, 0) # correction of central frequency # if the receiver has large frequency offset # the value of this variable should be set close to that offset in ppm self.rtlsdr_source.set_freq_corr(ppm, 0) self.rtlsdr_source.set_dc_offset_mode(2, 0) self.rtlsdr_source.set_iq_balance_mode(0, 0) self.rtlsdr_source.set_gain_mode(True, 0) self.rtlsdr_source.set_bandwidth(sample_rate, 0) self.rtlsdr_source.set_gain(gain, 0) self.rtlsdr_source.set_if_gain(32, 0) self.rtlsdr_source.set_bb_gain(30, 0) self.head = blocks.head(gr.sizeof_gr_complex * 1, int(rec_len * sample_rate)) # shift again by -0.1MHz in order to align channel center in 0Hz self.blocks_rotator_cc = blocks.rotator_cc(-2 * pi * 0.1e6 / sample_rate) self.wideband_receiver = wideband_receiver(OSR=4, fc=carrier_frequency, samp_rate=sample_rate) self.gsm_extract_system_info = grgsm.extract_system_info() self.connect((self.rtlsdr_source, 0), (self.head, 0)) self.connect((self.head, 0), (self.blocks_rotator_cc, 0)) self.connect((self.blocks_rotator_cc, 0), (self.wideband_receiver, 0)) self.msg_connect(self.wideband_receiver, 'msgs', self.gsm_extract_system_info, 'msgs') def set_carrier_frequency(self, carrier_frequency): self.carrier_frequency = carrier_frequency self.rtlsdr_source.set_center_freq(carrier_frequency - 0.1e6, 0) class channel_info(object): def __init__(self, arfcn, freq, cid, lac, mcc, mnc, ccch_conf, power, neighbours, cell_arfcns): self.arfcn = arfcn self.freq = freq self.cid = cid self.lac = lac self.mcc = mcc self.mnc = mnc self.ccch_conf = ccch_conf self.power = power self.neighbours = neighbours self.cell_arfcns = cell_arfcns def get_verbose_info(self): i = " |---- Configuration: %s\n" % self.get_ccch_conf() i += " |---- Cell ARFCNs: " + ", ".join(map(str, self.cell_arfcns)) + "\n" i += " |---- Neighbour Cells: " + ", ".join(map(str, self.neighbours)) + "\n" return i def get_ccch_conf(self): if self.ccch_conf == 0: return "1 CCCH, not combined" elif self.ccch_conf == 1: return "1 CCCH, combined" elif self.ccch_conf == 2: return "2 CCCH, not combined" elif self.ccch_conf == 4: return "3 CCCH, not combined" elif self.ccch_conf == 6: return "4 CCCH, not combined" else: return "Unknown" def getKey(self): return self.arfcn def __cmp__(self, other): if hasattr(other, 'getKey'): return self.getKey().__cmp__(other.getKey()) def __repr__(self): return "%s(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)" % ( self.__class__, self.arfcn, self.freq, self.cid, self.lac, self.mcc, self.mnc, self.ccch_conf, self.power, self.neighbours, self.cell_arfcns) def __str__(self): return "ARFCN: %4u, Freq: %6.1fM, CID: %5u, LAC: %5u, MCC: %3u, MNC: %3u, Pwr: %3i" % ( self.arfcn, self.freq / 1e6, self.cid, self.lac, self.mcc, self.mnc, self.power) def do_scan(samp_rate, band, speed, ppm, gain, args, prn = None): signallist = [] channels_num = int(samp_rate / 0.2e6) for arfcn_range in grgsm.arfcn.get_arfcn_ranges(band): first_arfcn = arfcn_range[0] last_arfcn = arfcn_range[1] last_center_arfcn = last_arfcn - int((channels_num / 2) - 1) current_freq = grgsm.arfcn.arfcn2downlink(first_arfcn + int(channels_num / 2) - 1) last_freq = grgsm.arfcn.arfcn2downlink(last_center_arfcn) stop_freq = last_freq + 0.2e6 * channels_num while current_freq < stop_freq: # silence rtl_sdr output: # open 2 fds null_fds = [os.open(os.devnull, os.O_RDWR) for x in xrange(2)] # save the current file descriptors to a tuple save = os.dup(1), os.dup(2) # put /dev/null fds on 1 and 2 os.dup2(null_fds[0], 1) os.dup2(null_fds[1], 2) # instantiate scanner and processor scanner = wideband_scanner(rec_len=6 - speed, sample_rate=samp_rate, carrier_frequency=current_freq, ppm=ppm, gain=gain, args=args) # start recording scanner.start() scanner.wait() scanner.stop() freq_offsets = numpy.fft.ifftshift( numpy.array(range(int(-numpy.floor(channels_num / 2)), int(numpy.floor((channels_num + 1) / 2)))) * 2e5) detected_c0_channels = scanner.gsm_extract_system_info.get_chans() found_list = [] if detected_c0_channels: chans = numpy.array(scanner.gsm_extract_system_info.get_chans()) found_freqs = current_freq + freq_offsets[(chans)] cell_ids = numpy.array(scanner.gsm_extract_system_info.get_cell_id()) lacs = numpy.array(scanner.gsm_extract_system_info.get_lac()) mccs = numpy.array(scanner.gsm_extract_system_info.get_mcc()) mncs = numpy.array(scanner.gsm_extract_system_info.get_mnc()) ccch_confs = numpy.array(scanner.gsm_extract_system_info.get_ccch_conf()) powers = numpy.array(scanner.gsm_extract_system_info.get_pwrs()) for i in range(0, len(chans)): cell_arfcn_list = scanner.gsm_extract_system_info.get_cell_arfcns(chans[i]) neighbour_list = scanner.gsm_extract_system_info.get_neighbours(chans[i]) info = channel_info(grgsm.arfcn.downlink2arfcn(found_freqs[i]), found_freqs[i], cell_ids[i], lacs[i], mccs[i], mncs[i], ccch_confs[i], powers[i], neighbour_list, cell_arfcn_list) found_list.append(info) scanner = None # restore file descriptors so we can print the results os.dup2(save[0], 1) os.dup2(save[1], 2) # close the temporary fds os.close(null_fds[0]) os.close(null_fds[1]) if prn: prn(found_list) signallist.extend(found_list) current_freq += channels_num * 0.2e6 return signallist def argument_parser(): parser = OptionParser(option_class=eng_option, usage="%prog: [options]") bands_list = ", ".join(grgsm.arfcn.get_bands()) parser.add_option("-b", "--band", dest="band", default="GSM900", help="Specify the GSM band for the frequency.\nAvailable bands are: " + bands_list) parser.add_option("-s", "--samp-rate", dest="samp_rate", type="float", default=2e6, help="Set sample rate [default=%default] - allowed values even_number*0.2e6") parser.add_option("-p", "--ppm", dest="ppm", type="intx", default=0, help="Set frequency correction in ppm [default=%default]") parser.add_option("-g", "--gain", dest="gain", type="eng_float", default=24.0, help="Set gain [default=%default]") parser.add_option("", "--args", dest="args", type="string", default="", help="Set device arguments [default=%default]") parser.add_option("--speed", dest="speed", type="intx", default=4, help="Scan speed [default=%default]. Value range 0-5.") parser.add_option("-v", "--verbose", action="store_true", help="If set, verbose information output is printed: ccch configuration, cell ARFCN's, neighbour ARFCN's") """ Dont forget: sudo sysctl kernel.shmmni=32000 """ return parser def main(options = None): if options is None: (options, args) = argument_parser().parse_args() if options.band not in grgsm.arfcn.get_bands(): parser.error("Invalid GSM band\n") if options.speed < 0 or options.speed > 5: parser.error("Invalid scan speed.\n") if (options.samp_rate / 0.2e6) % 2 != 0: parser.error("Invalid sample rate. Sample rate must be an even numer * 0.2e6") def printfunc(found_list): for info in sorted(found_list): print info if options.verbose: print info.get_verbose_info() print "" do_scan(options.samp_rate, options.band, options.speed, options.ppm, options.gain, options.args, prn = printfunc) if __name__ == '__main__': main() gr-gsm-0.41.2/apps/helpers/000077500000000000000000000000001316153413000153745ustar00rootroot00000000000000gr-gsm-0.41.2/apps/helpers/CMakeLists.txt000066400000000000000000000016511316153413000201370ustar00rootroot00000000000000# Copyright 2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. include(GrPython) GR_PYTHON_INSTALL( PROGRAMS grgsm_capture grgsm_channelize DESTINATION bin ) install( PROGRAMS DESTINATION bin ) gr-gsm-0.41.2/apps/helpers/README000066400000000000000000000004751316153413000162620ustar00rootroot00000000000000Helper programs for grgsm_decode: -grgsm_capture (old name: airprobe_rtlsdr_capture.py) - program for capturing GSM signal to a file that can be later processed by grgsm_decode, -grgsm_channelize (old name: gsm_channelize.py) - splits wideband capture file into multiple files - each contain single GSM channel, gr-gsm-0.41.2/apps/helpers/grgsm_capture000077500000000000000000000220131316153413000201620ustar00rootroot00000000000000#!/usr/bin/env python # -*- coding: utf-8 -*- # @file # @author (C) 2015 by Roman Khassraf # @section LICENSE # # Gr-gsm is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Gr-gsm is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with gr-gsm; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # # from gnuradio import blocks from gnuradio import eng_notation from gnuradio import gr from gnuradio.eng_option import eng_option from gnuradio.filter import firdes from math import pi from optparse import OptionParser import grgsm import osmosdr import pmt import signal import sys class grgsm_capture(gr.top_block): def __init__(self, fc, gain, samp_rate, ppm, arfcn, cfile=None, burst_file=None, verbose=False, rec_length=None, args=""): gr.top_block.__init__(self, "Gr-gsm Capture") ################################################## # Parameters ################################################## self.fc = fc self.gain = gain self.samp_rate = samp_rate self.ppm = ppm self.arfcn = arfcn self.cfile = cfile self.burst_file = burst_file self.verbose = verbose self.shiftoff = shiftoff = 400e3 self.rec_length = rec_length ################################################## # Processing Blocks ################################################## self.rtlsdr_source = osmosdr.source( args="numchan=" + str(1) + " " + args ) self.rtlsdr_source.set_sample_rate(samp_rate) self.rtlsdr_source.set_center_freq(fc - shiftoff, 0) self.rtlsdr_source.set_freq_corr(ppm, 0) self.rtlsdr_source.set_dc_offset_mode(2, 0) self.rtlsdr_source.set_iq_balance_mode(2, 0) self.rtlsdr_source.set_gain_mode(True, 0) self.rtlsdr_source.set_gain(gain, 0) self.rtlsdr_source.set_if_gain(20, 0) self.rtlsdr_source.set_bb_gain(20, 0) self.rtlsdr_source.set_antenna("", 0) self.rtlsdr_source.set_bandwidth(250e3+abs(shiftoff), 0) self.blocks_rotator = blocks.rotator_cc(-2*pi*shiftoff/samp_rate) if self.rec_length is not None: self.blocks_head_0 = blocks.head(gr.sizeof_gr_complex, int(samp_rate*rec_length)) if self.verbose or self.burst_file: self.gsm_receiver = grgsm.receiver(4, ([self.arfcn]), ([])) self.gsm_input = grgsm.gsm_input( ppm=0, osr=4, fc=fc, samp_rate_in=samp_rate, ) self.gsm_clock_offset_control = grgsm.clock_offset_control(fc-shiftoff, samp_rate, osr=4) if self.burst_file: self.gsm_burst_file_sink = grgsm.burst_file_sink(self.burst_file) if self.cfile: self.blocks_file_sink = blocks.file_sink(gr.sizeof_gr_complex*1, self.cfile, False) self.blocks_file_sink.set_unbuffered(False) if self.verbose: self.gsm_bursts_printer_0 = grgsm.bursts_printer(pmt.intern(""), False, False, False, False) ################################################## # Connections ################################################## if self.rec_length is not None: #if recording length is defined connect head block after the source self.connect((self.rtlsdr_source, 0), (self.blocks_head_0, 0)) self.connect((self.blocks_head_0, 0), (self.blocks_rotator, 0)) else: self.connect((self.rtlsdr_source, 0), (self.blocks_rotator, 0)) if self.cfile: self.connect((self.blocks_rotator, 0), (self.blocks_file_sink, 0)) if self.verbose or self.burst_file: self.connect((self.gsm_input, 0), (self.gsm_receiver, 0)) self.connect((self.blocks_rotator, 0), (self.gsm_input, 0)) self.msg_connect(self.gsm_clock_offset_control, "ctrl", self.gsm_input, "ctrl_in") self.msg_connect(self.gsm_receiver, "measurements", self.gsm_clock_offset_control, "measurements") if self.burst_file: self.msg_connect(self.gsm_receiver, "C0", self.gsm_burst_file_sink, "in") if self.verbose: self.msg_connect(self.gsm_receiver, "C0", self.gsm_bursts_printer_0, "bursts") def get_fc(self): return self.fc def set_fc(self, fc): self.fc = fc if self.verbose or self.burst_file: self.gsm_input.set_fc(self.fc) def get_arfcn(self): return self.arfcn def set_arfcn(self, arfcn): self.arfcn = arfcn if self.verbose or self.burst_file: self.gsm_receiver.set_cell_allocation([self.arfcn]) new_freq = grgsm.arfcn.arfcn2downlink(self.arfcn) self.set_fc(new_freq) def get_gain(self): return self.gain def set_gain(self, gain): self.gain = gain def get_samp_rate(self): return self.samp_rate def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.rtlsdr_source.set_sample_rate(self.samp_rate) if self.verbose or self.burst_file: self.gsm_input.set_samp_rate_in(self.samp_rate) def get_ppm(self): return self.ppm def set_ppm(self, ppm): self.ppm = ppm self.set_ppm_slider(self.ppm) def get_rec_length(self): return self.rec_length def set_rec_length(self, rec_length): self.rec_length = rec_length self.blocks_head_0.set_length(int(self.samp_rate*self.rec_length)) if __name__ == '__main__': parser = OptionParser(option_class=eng_option, usage="%prog [options]", description="RTL-SDR capturing app of gr-gsm.") parser.add_option("-f", "--fc", dest="fc", type="eng_float", help="Set frequency [default=%default]") parser.add_option("-a", "--arfcn", dest="arfcn", type="intx", help="Set ARFCN instead of frequency (for PCS1900 add 0x8000 (2**15) to the ARFCN number)") parser.add_option("-g", "--gain", dest="gain", type="eng_float", default=eng_notation.num_to_str(30), help="Set gain [default=%default]") parser.add_option("-s", "--samp-rate", dest="samp_rate", type="eng_float", default=eng_notation.num_to_str(1000000), help="Set samp_rate [default=%default]") parser.add_option("-p", "--ppm", dest="ppm", type="intx", default=0, help="Set ppm [default=%default]") parser.add_option("-b", "--burst-file", dest="burst_file", help="File where the captured bursts are saved") parser.add_option("-c", "--cfile", dest="cfile", help="File where the captured data are saved") parser.add_option("", "--args", dest="args", type="string", default="", help="Set device arguments [default=%default]") parser.add_option("-v", "--verbose", action="store_true", help="If set, the captured bursts are printed to stdout") parser.add_option("-T", "--rec-length", dest="rec_length", type="eng_float", help="Set length of recording in seconds [default=%default]") (options, args) = parser.parse_args() if options.cfile is None and options.burst_file is None: parser.error("Please provide a cfile or a burst file (or both) to save the captured data\n") if (options.fc is None and options.arfcn is None) or (options.fc is not None and options.arfcn is not None): parser.error("You have to provide either a frequency or an ARFCN (but not both).\n") arfcn = 0 fc = 939.4e6 if options.arfcn: if not grgsm.arfcn.is_valid_arfcn(options.arfcn): parser.error("ARFCN is not valid\n") else: arfcn = options.arfcn fc = grgsm.arfcn.arfcn2downlink(arfcn) elif options.fc: fc = options.fc arfcn = grgsm.arfcn.downlink2arfcn(options.fc) tb = grgsm_capture(fc=fc, gain=options.gain, samp_rate=options.samp_rate, ppm=options.ppm, arfcn=arfcn, cfile=options.cfile, burst_file=options.burst_file, verbose=options.verbose, rec_length=options.rec_length, args=options.args) def signal_handler(signal, frame): tb.stop() tb.wait() sys.exit(0) signal.signal(signal.SIGINT, signal_handler) tb.start() tb.wait() gr-gsm-0.41.2/apps/helpers/grgsm_channelize000077500000000000000000000155761316153413000206570ustar00rootroot00000000000000#!/usr/bin/env python2 # -*- coding: utf-8 -*- # @file # @author (C) 2015 by Pieter Robyns # @section LICENSE # # Gr-gsm is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Gr-gsm is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with gr-gsm; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # # ################################################## # gr-gsm channelizer # # Standalone application to channelize a wideband # GSM capture file into multiple seperate capture # files for the specified ARFCNs. ################################################## from gnuradio import blocks from gnuradio import eng_notation from gnuradio import filter from gnuradio import gr from gnuradio.eng_option import eng_option from gnuradio.filter import firdes from argparse import ArgumentParser, ArgumentTypeError, RawDescriptionHelpFormatter import grgsm.arfcn as arfcn from gnuradio.filter import pfb import math import os EXTRA_HELP = """ Example usage: grgsm_channelize.py -c my_wideband_capture.cfile -f 925.2e6 990 991 992 993 994 995 1019 1020 1021 1022 1023 The above example will channelize my_wideband_capture.cfile, in this case a cfile captured at 925.2 MHz centered (ARFCN 975) and 2 Msps. As a result, 12 files will be generated for ARFCNs 975 - 1023 at 1 Msps each. """ def eng_float(value): try: return eng_notation.str_to_num(value) except: raise ArgumentTypeError("invalid engineering notation value: {0}".format(value)) class grgsm_channelize(gr.top_block): def __init__(self, arfcns, resamp_rate, fc, samp_rate, input_file, dest_dir, data_type="complex"): gr.top_block.__init__(self, "grgsm_channelize") ################################################## # Parameters ################################################## self.arfcns = arfcns self.resamp_rate = resamp_rate self.fc = fc self.samp_rate = samp_rate self.blocks_resamplers = {} self.blocks_rotators = {} self.blocks_file_sinks = {} ################################################## # Blocks and connections ################################################## self.source = None if data_type == "ishort": self.blocks_file_source = blocks.file_source(gr.sizeof_short, input_file, False) self.source = blocks.interleaved_short_to_complex(False, False) self.connect((self.blocks_file_source, 0), (self.source, 0)) elif data_type == "complex": self.source = blocks.file_source(gr.sizeof_gr_complex, input_file, False) fc_str = eng_notation.num_to_str(fc) print("Extracting channels %s, given that the center frequency is at %s" % (str(arfcns), eng_notation.num_to_str(fc))) for channel in self.arfcns: channel_freq = arfcn.arfcn2downlink(channel) freq_diff = channel_freq - fc freq_diff_str = "+" if 0 <= freq_diff else "" freq_diff_str += eng_notation.num_to_str(freq_diff) print("ARFCN %d is at %sHz %sHz" % (channel, fc_str, freq_diff_str)) self.blocks_resamplers[channel] = pfb.arb_resampler_ccf( resamp_rate, taps=None, flt_size=32) self.blocks_rotators[channel] = blocks.rotator_cc(-2*math.pi*(freq_diff)/samp_rate) self.connect( (self.source, 0), (self.blocks_rotators[channel], 0) ) self.connect( (self.blocks_rotators[channel], 0), (self.blocks_resamplers[channel], 0) ) self.blocks_file_sinks[channel] = blocks.file_sink(gr.sizeof_gr_complex, dest_dir+"/out_" + str(channel) + ".cfile", False) self.blocks_file_sinks[channel].set_unbuffered(False) self.connect((self.blocks_resamplers[channel], 0), (self.blocks_file_sinks[channel], 0)) if __name__ == '__main__': parser = ArgumentParser(formatter_class=RawDescriptionHelpFormatter, description='Split wideband a GSM capture into seperate files per ARFCN.', add_help=True, epilog=EXTRA_HELP) parser.add_argument(dest="arfcns", type=int, nargs='+', help="List of ARFCNs (for PCS1900 add 0x8000 (2**15) to the ARFCN number)") parser.add_argument("-s", "--samp-rate", dest="samp_rate", type=eng_float, default=eng_notation.num_to_str(2e6), help="Sample rate of the wideband capture file [default=%(default)s]") parser.add_argument("-f", "--fc", dest="fc", type=eng_float, default=eng_notation.num_to_str(935e6), required=True, help="Carrier frequency in Hz [default=%(default)s]") parser.add_argument("-o", "--out-samp-rate", dest="out_samp_rate", type=eng_float, default=eng_notation.num_to_str(1e6), help="Sample rate of the output capture files [default=%(default)s]") parser.add_argument("-i", "--input_file", dest="input_file", type=str, required=True, help="Path to wideband GSM capture file") parser.add_argument("-t", "--data_type", dest="data_type", type=str, choices=["complex","ishort"], default="complex", help="Type of the input file [default=%(default)s]") parser.add_argument("-d", "--dest_dir", dest="dest_dir", type=str, help="Destination directory - if not given defaults to input file name without extension") args = parser.parse_args() for ch in args.arfcns: if not arfcn.is_valid_arfcn(ch): parser.error("ARFCN "+str(ch)+" is not valid\n") if not os.path.exists(args.input_file): raise IOError(args.input_file + " does not exist") input_filename, _ = os.path.splitext(os.path.basename(args.input_file)) if args.dest_dir is None: args.dest_dir = input_filename if not os.path.exists("./"+args.dest_dir): os.makedirs("./"+args.dest_dir) if args.samp_rate % args.out_samp_rate != 0: raise Exception("Input sample rate should be multiple of output sample rate in order to get integer decimation.") resamp_rate = args.out_samp_rate / args.samp_rate print("Input sample rate: " + eng_notation.num_to_str(args.samp_rate)) print("Output sample rate: " + eng_notation.num_to_str(args.out_samp_rate)) print("==> using resample rate of " + str(resamp_rate)) tb = grgsm_channelize(arfcns=args.arfcns, resamp_rate=resamp_rate, fc=args.fc, samp_rate=args.samp_rate, input_file=args.input_file, dest_dir=args.dest_dir, data_type=args.data_type ) tb.start() tb.wait() print("Done!") gr-gsm-0.41.2/cmake/000077500000000000000000000000001316153413000140475ustar00rootroot00000000000000gr-gsm-0.41.2/cmake/Modules/000077500000000000000000000000001316153413000154575ustar00rootroot00000000000000gr-gsm-0.41.2/cmake/Modules/CMakeParseArgumentsCopy.cmake000066400000000000000000000134031316153413000231560ustar00rootroot00000000000000# CMAKE_PARSE_ARGUMENTS( args...) # # CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions for # parsing the arguments given to that macro or function. # It processes the arguments and defines a set of variables which hold the # values of the respective options. # # The argument contains all options for the respective macro, # i.e. keywords which can be used when calling the macro without any value # following, like e.g. the OPTIONAL keyword of the install() command. # # The argument contains all keywords for this macro # which are followed by one value, like e.g. DESTINATION keyword of the # install() command. # # The argument contains all keywords for this macro # which can be followed by more than one value, like e.g. the TARGETS or # FILES keywords of the install() command. # # When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the # keywords listed in , and # a variable composed of the given # followed by "_" and the name of the respective keyword. # These variables will then hold the respective value from the argument list. # For the keywords this will be TRUE or FALSE. # # All remaining arguments are collected in a variable # _UNPARSED_ARGUMENTS, this can be checked afterwards to see whether # your macro was called with unrecognized parameters. # # As an example here a my_install() macro, which takes similar arguments as the # real install() command: # # function(MY_INSTALL) # set(options OPTIONAL FAST) # set(oneValueArgs DESTINATION RENAME) # set(multiValueArgs TARGETS CONFIGURATIONS) # cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) # ... # # Assume my_install() has been called like this: # my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub) # # After the cmake_parse_arguments() call the macro will have set the following # variables: # MY_INSTALL_OPTIONAL = TRUE # MY_INSTALL_FAST = FALSE (this option was not used when calling my_install() # MY_INSTALL_DESTINATION = "bin" # MY_INSTALL_RENAME = "" (was not used) # MY_INSTALL_TARGETS = "foo;bar" # MY_INSTALL_CONFIGURATIONS = "" (was not used) # MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL" # # You can the continue and process these variables. # # Keywords terminate lists of values, e.g. if directly after a one_value_keyword # another recognized keyword follows, this is interpreted as the beginning of # the new option. # E.g. my_install(TARGETS foo DESTINATION OPTIONAL) would result in # MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION would # be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor. #============================================================================= # Copyright 2010 Alexander Neundorf # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. # # This software is distributed WITHOUT ANY WARRANTY; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) if(__CMAKE_PARSE_ARGUMENTS_INCLUDED) return() endif() set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE) function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames) # first set all result variables to empty/FALSE foreach(arg_name ${_singleArgNames} ${_multiArgNames}) set(${prefix}_${arg_name}) endforeach(arg_name) foreach(option ${_optionNames}) set(${prefix}_${option} FALSE) endforeach(option) set(${prefix}_UNPARSED_ARGUMENTS) set(insideValues FALSE) set(currentArgName) # now iterate over all arguments and fill the result variables foreach(currentArg ${ARGN}) list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1) if(insideValues) if("${insideValues}" STREQUAL "SINGLE") set(${prefix}_${currentArgName} ${currentArg}) set(insideValues FALSE) elseif("${insideValues}" STREQUAL "MULTI") list(APPEND ${prefix}_${currentArgName} ${currentArg}) endif() else(insideValues) list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg}) endif(insideValues) else() if(NOT ${optionIndex} EQUAL -1) set(${prefix}_${currentArg} TRUE) set(insideValues FALSE) elseif(NOT ${singleArgIndex} EQUAL -1) set(currentArgName ${currentArg}) set(${prefix}_${currentArgName}) set(insideValues "SINGLE") elseif(NOT ${multiArgIndex} EQUAL -1) set(currentArgName ${currentArg}) set(${prefix}_${currentArgName}) set(insideValues "MULTI") endif() endif() endforeach(currentArg) # propagate the result variables to the caller: foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames}) set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE) endforeach(arg_name) set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE) endfunction(CMAKE_PARSE_ARGUMENTS _options _singleArgs _multiArgs) gr-gsm-0.41.2/cmake/Modules/CreateSymlink.cmake000066400000000000000000000005671316153413000212430ustar00rootroot00000000000000#create logical links in order to keep legacy names of apps macro(CREATE_SYMLINK _source _dest) set(source ${CMAKE_CURRENT_SOURCE_DIR}/${_source}) set(dest ${CMAKE_CURRENT_BINARY_DIR}/${_dest}) list(APPEND symlinks ${dest}) add_custom_command( DEPENDS ${source} OUTPUT ${dest} COMMAND ln -sf ${_source} ${_dest} ) endmacro(CREATE_SYMLINK) gr-gsm-0.41.2/cmake/Modules/FindCppUnit.cmake000066400000000000000000000017131316153413000206460ustar00rootroot00000000000000# http://www.cmake.org/pipermail/cmake/2006-October/011446.html # Modified to use pkg config and use standard var names # # Find the CppUnit includes and library # # This module defines # CPPUNIT_INCLUDE_DIR, where to find tiff.h, etc. # CPPUNIT_LIBRARIES, the libraries to link against to use CppUnit. # CPPUNIT_FOUND, If false, do not try to use CppUnit. INCLUDE(FindPkgConfig) PKG_CHECK_MODULES(PC_CPPUNIT "cppunit") FIND_PATH(CPPUNIT_INCLUDE_DIRS NAMES cppunit/TestCase.h HINTS ${PC_CPPUNIT_INCLUDE_DIR} PATHS /usr/local/include /usr/include ) FIND_LIBRARY(CPPUNIT_LIBRARIES NAMES cppunit HINTS ${PC_CPPUNIT_LIBDIR} PATHS ${CPPUNIT_INCLUDE_DIRS}/../lib /usr/local/lib /usr/lib ) LIST(APPEND CPPUNIT_LIBRARIES ${CMAKE_DL_LIBS}) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPPUNIT DEFAULT_MSG CPPUNIT_LIBRARIES CPPUNIT_INCLUDE_DIRS) MARK_AS_ADVANCED(CPPUNIT_LIBRARIES CPPUNIT_INCLUDE_DIRS) gr-gsm-0.41.2/cmake/Modules/FindGnuradioRuntime.cmake000066400000000000000000000021751316153413000224030ustar00rootroot00000000000000INCLUDE(FindPkgConfig) PKG_CHECK_MODULES(PC_GNURADIO_RUNTIME gnuradio-runtime) if(PC_GNURADIO_RUNTIME_FOUND) # look for include files FIND_PATH( GNURADIO_RUNTIME_INCLUDE_DIRS NAMES gnuradio/top_block.h HINTS $ENV{GNURADIO_RUNTIME_DIR}/include ${PC_GNURADIO_RUNTIME_INCLUDE_DIRS} ${CMAKE_INSTALL_PREFIX}/include PATHS /usr/local/include /usr/include ) # look for libs FIND_LIBRARY( GNURADIO_RUNTIME_LIBRARIES NAMES gnuradio-runtime HINTS $ENV{GNURADIO_RUNTIME_DIR}/lib ${PC_GNURADIO_RUNTIME_LIBDIR} ${CMAKE_INSTALL_PREFIX}/lib/ ${CMAKE_INSTALL_PREFIX}/lib64/ PATHS /usr/local/lib /usr/local/lib64 /usr/lib /usr/lib64 ) set(GNURADIO_RUNTIME_FOUND ${PC_GNURADIO_RUNTIME_FOUND}) endif(PC_GNURADIO_RUNTIME_FOUND) INCLUDE(FindPackageHandleStandardArgs) # do not check GNURADIO_RUNTIME_INCLUDE_DIRS, is not set when default include path us used. FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_RUNTIME DEFAULT_MSG GNURADIO_RUNTIME_LIBRARIES) MARK_AS_ADVANCED(GNURADIO_RUNTIME_LIBRARIES GNURADIO_RUNTIME_INCLUDE_DIRS) gr-gsm-0.41.2/cmake/Modules/FindLibosmocodec.cmake000066400000000000000000000020601316153413000216620ustar00rootroot00000000000000INCLUDE(FindPkgConfig) pkg_check_modules(PC_libosmocodec libosmocodec) set(LIBOSMOCODEC_DEFINITIONS ${PC_LIBOSMOCODEC_CFLAGS_OTHER}) find_path( LIBOSMOCODEC_INCLUDE_DIR NAMES osmocom/codec/codec.h HINTS ${PC_libosmocodec_INCLUDEDIR} ${PC_libosmocodec_INCLUDE_DIRS} ${CMAKE_INSTALL_PREFIX}/include PATHS /usr/local/include /usr/include ) find_library( LIBOSMOCODEC_LIBRARY NAMES libosmocodec osmocodec HINTS ${PC_libosmocodec_LIBDIR} ${PC_libosmocodec_LIBRARY_DIRS} ${CMAKE_INSTALL_PREFIX}/lib/ ${CMAKE_INSTALL_PREFIX}/lib64/ PATHS /usr/local/lib /usr/lib ) set(LIBOSMOCODEC_LIBRARIES ${LIBOSMOCODEC_LIBRARY}) set(LIBOSMOCODEC_INCLUDE_DIRS ${LIBOSMOCODEC_INCLUDE_DIR}) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(libosmocodec DEFAULT_MSG LIBOSMOCODEC_LIBRARY LIBOSMOCODEC_INCLUDE_DIR) mark_as_advanced(LIBOSMOCODEC_INCLUDE_DIR LIBOSMOCODEC_LIBRARY ) gr-gsm-0.41.2/cmake/Modules/FindLibosmocoding.cmake000066400000000000000000000021171316153413000220530ustar00rootroot00000000000000find_package(PkgConfig) pkg_check_modules(PC_libosmocoding libosmocoding) set(LIBOSMOCODING_DEFINITIONS ${PC_LIBOSMOCODING_CFLAGS_OTHER}) find_path( LIBOSMOCODING_INCLUDE_DIR NAMES osmocom/coding/gsm0503_coding.h HINTS ${PC_libosmocoding_INCLUDEDIR} ${PC_libosmocoding_INCLUDE_DIRS} ${CMAKE_INSTALL_PREFIX}/include PATHS /usr/local/include /usr/include ) find_library( LIBOSMOCODING_LIBRARY NAMES libosmocoding osmocoding HINTS ${PC_libosmocoding_LIBDIR} ${PC_libosmocoding_LIBRARY_DIRS} ${CMAKE_INSTALL_PREFIX}/lib/ ${CMAKE_INSTALL_PREFIX}/lib64/ PATHS /usr/local/lib /usr/lib ) set(LIBOSMOCODING_LIBRARIES ${LIBOSMOCODING_LIBRARY}) set(LIBOSMOCODING_INCLUDE_DIRS ${LIBOSMOCODING_INCLUDE_DIR}) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(libosmocoding DEFAULT_MSG LIBOSMOCODING_LIBRARY LIBOSMOCODING_INCLUDE_DIR) mark_as_advanced(LIBOSMOCODING_INCLUDE_DIR LIBOSMOCODING_LIBRARY )gr-gsm-0.41.2/cmake/Modules/FindLibosmocore.cmake000066400000000000000000000026771316153413000215530ustar00rootroot00000000000000#find_package(PkgConfig) INCLUDE(FindPkgConfig) pkg_check_modules(PC_libosmocore libosmocore) pkg_check_modules(PC_libosmogsm libosmogsm) set(LIBOSMOCORE_DEFINITIONS ${PC_LIBOSMOCORE_CFLAGS_OTHER}) find_path( LIBOSMOCORE_INCLUDE_DIR NAMES osmocom/core/application.h HINTS ${PC_libosmocore_INCLUDEDIR} ${PC_libosmocore_INCLUDE_DIRS} ${CMAKE_INSTALL_PREFIX}/include PATHS /usr/local/include /usr/include ) find_library( LIBOSMOCORE_LIBRARY NAMES libosmocore osmocore HINTS ${PC_libosmocore_LIBDIR} ${PC_libosmocore_LIBRARY_DIRS} ${CMAKE_INSTALL_PREFIX}/lib/ ${CMAKE_INSTALL_PREFIX}/lib64/ PATHS /usr/local/lib /usr/lib ) find_library( LIBOSMOCORE_GSM_LIBRARY NAMES libosmogsm osmogsm HINTS ${PC_libosmocore_LIBDIR} ${PC_libosmocore_LIBRARY_DIRS} ${CMAKE_INSTALL_PREFIX}/lib/ ${CMAKE_INSTALL_PREFIX}/lib64/ PATHS /usr/local/lib /usr/lib ) set(LIBOSMOCORE_LIBRARIES ${LIBOSMOCORE_LIBRARY} ${LIBOSMOCORE_GSM_LIBRARY}) set(LIBOSMOCORE_INCLUDE_DIRS ${LIBOSMOCORE_INCLUDE_DIR}) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(libosmocore DEFAULT_MSG LIBOSMOCORE_LIBRARY LIBOSMOCORE_INCLUDE_DIR) mark_as_advanced(LIBOSMOCORE_INCLUDE_DIR LIBOSMOCORE_LIBRARY ) gr-gsm-0.41.2/cmake/Modules/FindSWIG.cmake000066400000000000000000000076471316153413000200510ustar00rootroot00000000000000####################################################################### # Find the library for SWIG # # The goal here is to intercept calls to "FIND_PACKAGE(SWIG)" in order # to do a global version check locally after passing on the "find" to # SWIG-provided scripts. ######################################################################## # make this file non-reentrant within the current context if(__INCLUDED_FIND_SWIG_CMAKE) return() endif() set(__INCLUDED_FIND_SWIG_CMAKE TRUE) # some status messages message(STATUS "") message(STATUS "Checking for module SWIG") # # First check to see if SWIG installed its own CMake file, or if the # one provided by CMake finds SWIG. # # save the current MODULE path set(SAVED_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) # clear the current MODULE path; uses system paths only unset(CMAKE_MODULE_PATH) # try to find SWIG via the provided parameters, # handle REQUIRED internally later unset(SWIG_FOUND) # was the version specified? unset(LOCAL_SWIG_FIND_VERSION) if(SWIG_FIND_VERSION) set(LOCAL_SWIG_FIND_VERSION ${SWIG_FIND_VERSION}) endif(SWIG_FIND_VERSION) # was EXACT specified? unset(LOCAL_SWIG_FIND_VERSION_EXACT) if(SWIG_FIND_VERSION_EXACT) set(LOCAL_SWIG_FIND_VERSION_EXACT "EXACT") endif(SWIG_FIND_VERSION_EXACT) # was REQUIRED specified? unset(LOCAL_SWIG_FIND_REQUIRED) if(SWIG_FIND_REQUIRED) set(LOCAL_SWIG_FIND_REQUIRED "REQUIRED") endif(SWIG_FIND_REQUIRED) # try to find SWIG using the provided parameters, quietly; # # this call will error out internally (and not quietly) if: # 1: EXACT is specified and the version found does not match the requested version; # 2: REQUIRED is set and SWIG was not found; # # this call will return SWIG_FOUND == FALSE if REQUIRED is not set, and: # 1: SWIG was not found; # 2: The version found is less than the requested version. find_package( SWIG ${LOCAL_SWIG_FIND_VERSION} ${LOCAL_SWIG_FIND_VERSION_EXACT} ${LOCAL_SWIG_FIND_REQUIRED} QUIET ) # restore CMAKE_MODULE_PATH set(CMAKE_MODULE_PATH ${SAVED_CMAKE_MODULE_PATH}) # specific version checks set(SWIG_VERSION_CHECK FALSE) if(SWIG_FOUND) # SWIG was found; make sure the version meets GR's needs message(STATUS "Found SWIG version ${SWIG_VERSION}.") if("${SWIG_VERSION}" VERSION_GREATER "1.3.30") if(NOT "${SWIG_VERSION}" VERSION_EQUAL "3.0.3" AND NOT "${SWIG_VERSION}" VERSION_EQUAL "3.0.4") set(SWIG_VERSION_CHECK TRUE) else() message(STATUS "SWIG versions 3.0.3 and 3.0.4 fail to work with GNU Radio.") endif() else() message(STATUS "Minimum SWIG version required is 1.3.31 for GNU Radio.") endif() else() # SWIG was either not found, or is less than the requested version if(SWIG_VERSION) # SWIG_VERSION is set, but SWIG_FOUND is false; probably a version mismatch message(STATUS "Found SWIG version ${SWIG_VERSION}.") message(STATUS "Requested SWIG version is at least ${SWIG_FIND_VERSION}.") endif() endif() # did the version check fail? if(NOT SWIG_VERSION_CHECK) # yes: clear various variables and set FOUND to FALSE message(STATUS "Disabling SWIG because version check failed.") unset(SWIG_VERSION CACHE) unset(SWIG_DIR CACHE) unset(SWIG_EXECUTABLE CACHE) set(SWIG_FOUND FALSE CACHE BOOL "Set to TRUE if a compatible version of SWIG is found" FORCE) endif() # check to see if SWIG variables were set if(SWIG_FOUND AND SWIG_DIR AND SWIG_EXECUTABLE) # yes: even if set SWIG_FOUND==TRUE, then these have already been # done, but done quietly. It does not hurt to redo them here. include(FindPackageHandleStandardArgs) find_package_handle_standard_args(SWIG DEFAULT_MSG SWIG_EXECUTABLE SWIG_DIR) mark_as_advanced(SWIG_EXECUTABLE SWIG_DIR) elseif(SWIG_FIND_REQUIRED) if(SWIG_FIND_VERSION) message(FATAL_ERROR "The found SWIG version (${SWIG_VERSION}) is not compatible with the version required (${SWIG_FIND_VERSION}).") else() message(FATAL_ERROR "SWIG is required, but was not found.") endif() endif() gr-gsm-0.41.2/cmake/Modules/FindVolk.cmake000066400000000000000000000011321316153413000201720ustar00rootroot00000000000000INCLUDE(FindPkgConfig) PKG_CHECK_MODULES(PC_VOLK volk) FIND_PATH( VOLK_INCLUDE_DIRS NAMES volk/volk.h HINTS $ENV{VOLK_DIR}/include ${PC_VOLK_INCLUDEDIR} PATHS /usr/local/include /usr/include ) FIND_LIBRARY( VOLK_LIBRARIES NAMES volk HINTS $ENV{VOLK_DIR}/lib ${PC_VOLK_LIBDIR} PATHS /usr/local/lib /usr/local/lib64 /usr/lib /usr/lib64 ) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(VOLK DEFAULT_MSG VOLK_LIBRARIES VOLK_INCLUDE_DIRS) MARK_AS_ADVANCED(VOLK_LIBRARIES VOLK_INCLUDE_DIRS) gr-gsm-0.41.2/cmake/Modules/GrMiscUtils.cmake000066400000000000000000000411221316153413000206660ustar00rootroot00000000000000# Copyright 2010-2011,2014 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. if(DEFINED __INCLUDED_GR_MISC_UTILS_CMAKE) return() endif() set(__INCLUDED_GR_MISC_UTILS_CMAKE TRUE) ######################################################################## # Set global variable macro. # Used for subdirectories to export settings. # Example: include and library paths. ######################################################################## function(GR_SET_GLOBAL var) set(${var} ${ARGN} CACHE INTERNAL "" FORCE) endfunction(GR_SET_GLOBAL) ######################################################################## # Set the pre-processor definition if the condition is true. # - def the pre-processor definition to set and condition name ######################################################################## function(GR_ADD_COND_DEF def) if(${def}) add_definitions(-D${def}) endif(${def}) endfunction(GR_ADD_COND_DEF) ######################################################################## # Check for a header and conditionally set a compile define. # - hdr the relative path to the header file # - def the pre-processor definition to set ######################################################################## function(GR_CHECK_HDR_N_DEF hdr def) include(CheckIncludeFileCXX) CHECK_INCLUDE_FILE_CXX(${hdr} ${def}) GR_ADD_COND_DEF(${def}) endfunction(GR_CHECK_HDR_N_DEF) ######################################################################## # Include subdirectory macro. # Sets the CMake directory variables, # includes the subdirectory CMakeLists.txt, # resets the CMake directory variables. # # This macro includes subdirectories rather than adding them # so that the subdirectory can affect variables in the level above. # This provides a work-around for the lack of convenience libraries. # This way a subdirectory can append to the list of library sources. ######################################################################## macro(GR_INCLUDE_SUBDIRECTORY subdir) #insert the current directories on the front of the list list(INSERT _cmake_source_dirs 0 ${CMAKE_CURRENT_SOURCE_DIR}) list(INSERT _cmake_binary_dirs 0 ${CMAKE_CURRENT_BINARY_DIR}) #set the current directories to the names of the subdirs set(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}) set(CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${subdir}) #include the subdirectory CMakeLists to run it file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) include(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt) #reset the value of the current directories list(GET _cmake_source_dirs 0 CMAKE_CURRENT_SOURCE_DIR) list(GET _cmake_binary_dirs 0 CMAKE_CURRENT_BINARY_DIR) #pop the subdir names of the front of the list list(REMOVE_AT _cmake_source_dirs 0) list(REMOVE_AT _cmake_binary_dirs 0) endmacro(GR_INCLUDE_SUBDIRECTORY) ######################################################################## # Check if a compiler flag works and conditionally set a compile define. # - flag the compiler flag to check for # - have the variable to set with result ######################################################################## macro(GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE flag have) include(CheckCXXCompilerFlag) CHECK_CXX_COMPILER_FLAG(${flag} ${have}) if(${have}) if(${CMAKE_VERSION} VERSION_GREATER "2.8.4") STRING(FIND "${CMAKE_CXX_FLAGS}" "${flag}" flag_dup) if(${flag_dup} EQUAL -1) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}") endif(${flag_dup} EQUAL -1) endif(${CMAKE_VERSION} VERSION_GREATER "2.8.4") endif(${have}) endmacro(GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE) ######################################################################## # Generates the .la libtool file # This appears to generate libtool files that cannot be used by auto*. # Usage GR_LIBTOOL(TARGET [target] DESTINATION [dest]) # Notice: there is not COMPONENT option, these will not get distributed. ######################################################################## function(GR_LIBTOOL) if(NOT DEFINED GENERATE_LIBTOOL) set(GENERATE_LIBTOOL OFF) #disabled by default endif() if(GENERATE_LIBTOOL) include(CMakeParseArgumentsCopy) CMAKE_PARSE_ARGUMENTS(GR_LIBTOOL "" "TARGET;DESTINATION" "" ${ARGN}) find_program(LIBTOOL libtool) if(LIBTOOL) include(CMakeMacroLibtoolFile) CREATE_LIBTOOL_FILE(${GR_LIBTOOL_TARGET} /${GR_LIBTOOL_DESTINATION}) endif(LIBTOOL) endif(GENERATE_LIBTOOL) endfunction(GR_LIBTOOL) ######################################################################## # Do standard things to the library target # - set target properties # - make install rules # Also handle gnuradio custom naming conventions w/ extras mode. ######################################################################## function(GR_LIBRARY_FOO target) #parse the arguments for component names include(CMakeParseArgumentsCopy) CMAKE_PARSE_ARGUMENTS(GR_LIBRARY "" "RUNTIME_COMPONENT;DEVEL_COMPONENT" "" ${ARGN}) #set additional target properties set_target_properties(${target} PROPERTIES SOVERSION ${LIBVER}) #install the generated files like so... install(TARGETS ${target} LIBRARY DESTINATION ${GR_LIBRARY_DIR} COMPONENT ${GR_LIBRARY_RUNTIME_COMPONENT} # .so/.dylib file ARCHIVE DESTINATION ${GR_LIBRARY_DIR} COMPONENT ${GR_LIBRARY_DEVEL_COMPONENT} # .lib file RUNTIME DESTINATION ${GR_RUNTIME_DIR} COMPONENT ${GR_LIBRARY_RUNTIME_COMPONENT} # .dll file ) #extras mode enabled automatically on linux if(NOT DEFINED LIBRARY_EXTRAS) set(LIBRARY_EXTRAS ${LINUX}) endif() #special extras mode to enable alternative naming conventions if(LIBRARY_EXTRAS) #create .la file before changing props GR_LIBTOOL(TARGET ${target} DESTINATION ${GR_LIBRARY_DIR}) #give the library a special name with ultra-zero soversion set_target_properties(${target} PROPERTIES OUTPUT_NAME ${target}-${LIBVER} SOVERSION "0.0.0") set(target_name lib${target}-${LIBVER}.so.0.0.0) #custom command to generate symlinks add_custom_command( TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink ${target_name} ${CMAKE_CURRENT_BINARY_DIR}/lib${target}.so COMMAND ${CMAKE_COMMAND} -E create_symlink ${target_name} ${CMAKE_CURRENT_BINARY_DIR}/lib${target}-${LIBVER}.so.0 COMMAND ${CMAKE_COMMAND} -E touch ${target_name} #so the symlinks point to something valid so cmake 2.6 will install ) #and install the extra symlinks install( FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${target}.so ${CMAKE_CURRENT_BINARY_DIR}/lib${target}-${LIBVER}.so.0 DESTINATION ${GR_LIBRARY_DIR} COMPONENT ${GR_LIBRARY_RUNTIME_COMPONENT} ) endif(LIBRARY_EXTRAS) endfunction(GR_LIBRARY_FOO) ######################################################################## # Create a dummy custom command that depends on other targets. # Usage: # GR_GEN_TARGET_DEPS(unique_name target_deps ...) # ADD_CUSTOM_COMMAND( ${target_deps}) # # Custom command cant depend on targets, but can depend on executables, # and executables can depend on targets. So this is the process: ######################################################################## function(GR_GEN_TARGET_DEPS name var) file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp.in "int main(void){return 0;}\n" ) execute_process( COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp ) add_executable(${name} ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp) if(ARGN) add_dependencies(${name} ${ARGN}) endif(ARGN) if(CMAKE_CROSSCOMPILING) set(${var} "DEPENDS;${name}" PARENT_SCOPE) #cant call command when cross else() set(${var} "DEPENDS;${name};COMMAND;${name}" PARENT_SCOPE) endif() endfunction(GR_GEN_TARGET_DEPS) ######################################################################## # Control use of gr_logger # Usage: # GR_LOGGING() # # Will set ENABLE_GR_LOG to 1 by default. # Can manually set with -DENABLE_GR_LOG=0|1 ######################################################################## function(GR_LOGGING) find_package(Log4cpp) OPTION(ENABLE_GR_LOG "Use gr_logger" ON) if(ENABLE_GR_LOG) # If gr_logger is enabled, make it usable add_definitions( -DENABLE_GR_LOG ) # also test LOG4CPP; if we have it, use this version of the logger # otherwise, default to the stdout/stderr model. if(LOG4CPP_FOUND) SET(HAVE_LOG4CPP True CACHE INTERNAL "" FORCE) add_definitions( -DHAVE_LOG4CPP ) else(not LOG4CPP_FOUND) SET(HAVE_LOG4CPP False CACHE INTERNAL "" FORCE) SET(LOG4CPP_INCLUDE_DIRS "" CACHE INTERNAL "" FORCE) SET(LOG4CPP_LIBRARY_DIRS "" CACHE INTERNAL "" FORCE) SET(LOG4CPP_LIBRARIES "" CACHE INTERNAL "" FORCE) endif(LOG4CPP_FOUND) SET(ENABLE_GR_LOG ${ENABLE_GR_LOG} CACHE INTERNAL "" FORCE) else(ENABLE_GR_LOG) SET(HAVE_LOG4CPP False CACHE INTERNAL "" FORCE) SET(LOG4CPP_INCLUDE_DIRS "" CACHE INTERNAL "" FORCE) SET(LOG4CPP_LIBRARY_DIRS "" CACHE INTERNAL "" FORCE) SET(LOG4CPP_LIBRARIES "" CACHE INTERNAL "" FORCE) endif(ENABLE_GR_LOG) message(STATUS "ENABLE_GR_LOG set to ${ENABLE_GR_LOG}.") message(STATUS "HAVE_LOG4CPP set to ${HAVE_LOG4CPP}.") message(STATUS "LOG4CPP_LIBRARIES set to ${LOG4CPP_LIBRARIES}.") endfunction(GR_LOGGING) ######################################################################## # Check if HAVE_PTHREAD_SETSCHEDPARAM and HAVE_SCHED_SETSCHEDULER # should be defined ######################################################################## macro(GR_CHECK_LINUX_SCHED_AVAIL) set(CMAKE_REQUIRED_LIBRARIES -lpthread) CHECK_CXX_SOURCE_COMPILES(" #include int main(){ pthread_t pthread; pthread_setschedparam(pthread, 0, 0); return 0; } " HAVE_PTHREAD_SETSCHEDPARAM ) GR_ADD_COND_DEF(HAVE_PTHREAD_SETSCHEDPARAM) CHECK_CXX_SOURCE_COMPILES(" #include int main(){ pid_t pid; sched_setscheduler(pid, 0, 0); return 0; } " HAVE_SCHED_SETSCHEDULER ) GR_ADD_COND_DEF(HAVE_SCHED_SETSCHEDULER) endmacro(GR_CHECK_LINUX_SCHED_AVAIL) ######################################################################## # Macros to generate source and header files from template ######################################################################## macro(GR_EXPAND_X_H component root) include(GrPython) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py "#!${PYTHON_EXECUTABLE} import sys, os, re sys.path.append('${GR_RUNTIME_PYTHONPATH}') os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}' os.chdir('${CMAKE_CURRENT_BINARY_DIR}') if __name__ == '__main__': import build_utils root, inp = sys.argv[1:3] for sig in sys.argv[3:]: name = re.sub ('X+', sig, root) d = build_utils.standard_dict2(name, sig, '${component}') build_utils.expand_template(d, inp) ") #make a list of all the generated headers unset(expanded_files_h) foreach(sig ${ARGN}) string(REGEX REPLACE "X+" ${sig} name ${root}) list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h) endforeach(sig) unset(name) #create a command to generate the headers add_custom_command( OUTPUT ${expanded_files_h} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.h.t COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py ${root} ${root}.h.t ${ARGN} ) #install rules for the generated headers list(APPEND generated_includes ${expanded_files_h}) endmacro(GR_EXPAND_X_H) macro(GR_EXPAND_X_CC_H component root) include(GrPython) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py "#!${PYTHON_EXECUTABLE} import sys, os, re sys.path.append('${GR_RUNTIME_PYTHONPATH}') os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}' os.chdir('${CMAKE_CURRENT_BINARY_DIR}') if __name__ == '__main__': import build_utils root, inp = sys.argv[1:3] for sig in sys.argv[3:]: name = re.sub ('X+', sig, root) d = build_utils.standard_impl_dict2(name, sig, '${component}') build_utils.expand_template(d, inp) ") #make a list of all the generated files unset(expanded_files_cc) unset(expanded_files_h) foreach(sig ${ARGN}) string(REGEX REPLACE "X+" ${sig} name ${root}) list(APPEND expanded_files_cc ${CMAKE_CURRENT_BINARY_DIR}/${name}.cc) list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h) endforeach(sig) unset(name) #create a command to generate the source files add_custom_command( OUTPUT ${expanded_files_cc} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.cc.t COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py ${root} ${root}.cc.t ${ARGN} ) #create a command to generate the header files add_custom_command( OUTPUT ${expanded_files_h} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.h.t COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py ${root} ${root}.h.t ${ARGN} ) #make source files depends on headers to force generation set_source_files_properties(${expanded_files_cc} PROPERTIES OBJECT_DEPENDS "${expanded_files_h}" ) #install rules for the generated files list(APPEND generated_sources ${expanded_files_cc}) list(APPEND generated_headers ${expanded_files_h}) endmacro(GR_EXPAND_X_CC_H) macro(GR_EXPAND_X_CC_H_IMPL component root) include(GrPython) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py "#!${PYTHON_EXECUTABLE} import sys, os, re sys.path.append('${GR_RUNTIME_PYTHONPATH}') os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}' os.chdir('${CMAKE_CURRENT_BINARY_DIR}') if __name__ == '__main__': import build_utils root, inp = sys.argv[1:3] for sig in sys.argv[3:]: name = re.sub ('X+', sig, root) d = build_utils.standard_dict(name, sig, '${component}') build_utils.expand_template(d, inp, '_impl') ") #make a list of all the generated files unset(expanded_files_cc_impl) unset(expanded_files_h_impl) unset(expanded_files_h) foreach(sig ${ARGN}) string(REGEX REPLACE "X+" ${sig} name ${root}) list(APPEND expanded_files_cc_impl ${CMAKE_CURRENT_BINARY_DIR}/${name}_impl.cc) list(APPEND expanded_files_h_impl ${CMAKE_CURRENT_BINARY_DIR}/${name}_impl.h) list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/../include/gnuradio/${component}/${name}.h) endforeach(sig) unset(name) #create a command to generate the _impl.cc files add_custom_command( OUTPUT ${expanded_files_cc_impl} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}_impl.cc.t COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py ${root} ${root}_impl.cc.t ${ARGN} ) #create a command to generate the _impl.h files add_custom_command( OUTPUT ${expanded_files_h_impl} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}_impl.h.t COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py ${root} ${root}_impl.h.t ${ARGN} ) #make _impl.cc source files depend on _impl.h to force generation set_source_files_properties(${expanded_files_cc_impl} PROPERTIES OBJECT_DEPENDS "${expanded_files_h_impl}" ) #make _impl.h source files depend on headers to force generation set_source_files_properties(${expanded_files_h_impl} PROPERTIES OBJECT_DEPENDS "${expanded_files_h}" ) #install rules for the generated files list(APPEND generated_sources ${expanded_files_cc_impl}) list(APPEND generated_headers ${expanded_files_h_impl}) endmacro(GR_EXPAND_X_CC_H_IMPL) gr-gsm-0.41.2/cmake/Modules/GrPlatform.cmake000066400000000000000000000032131316153413000205350ustar00rootroot00000000000000# Copyright 2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. if(DEFINED __INCLUDED_GR_PLATFORM_CMAKE) return() endif() set(__INCLUDED_GR_PLATFORM_CMAKE TRUE) ######################################################################## # Setup additional defines for OS types ######################################################################## if(CMAKE_SYSTEM_NAME STREQUAL "Linux") set(LINUX TRUE) endif() if(LINUX AND EXISTS "/etc/debian_version") set(DEBIAN TRUE) endif() if(LINUX AND EXISTS "/etc/redhat-release") set(REDHAT TRUE) endif() ######################################################################## # when the library suffix should be 64 (applies to redhat linux family) ######################################################################## if(NOT DEFINED LIB_SUFFIX AND REDHAT AND CMAKE_SYSTEM_PROCESSOR MATCHES "64$") set(LIB_SUFFIX 64) endif() set(LIB_SUFFIX ${LIB_SUFFIX} CACHE STRING "lib directory suffix") gr-gsm-0.41.2/cmake/Modules/GrPython.cmake000066400000000000000000000217331316153413000202410ustar00rootroot00000000000000# Copyright 2010-2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. if(DEFINED __INCLUDED_GR_PYTHON_CMAKE) return() endif() set(__INCLUDED_GR_PYTHON_CMAKE TRUE) ######################################################################## # Setup the python interpreter: # This allows the user to specify a specific interpreter, # or finds the interpreter via the built-in cmake module. ######################################################################## #this allows the user to override PYTHON_EXECUTABLE if(PYTHON_EXECUTABLE) set(PYTHONINTERP_FOUND TRUE) #otherwise if not set, try to automatically find it else(PYTHON_EXECUTABLE) #use the built-in find script find_package(PythonInterp 2) #and if that fails use the find program routine if(NOT PYTHONINTERP_FOUND) find_program(PYTHON_EXECUTABLE NAMES python python2 python2.7 python2.6 python2.5) if(PYTHON_EXECUTABLE) set(PYTHONINTERP_FOUND TRUE) endif(PYTHON_EXECUTABLE) endif(NOT PYTHONINTERP_FOUND) endif(PYTHON_EXECUTABLE) #make the path to the executable appear in the cmake gui set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter") #make sure we can use -B with python (introduced in 2.6) if(PYTHON_EXECUTABLE) execute_process( COMMAND ${PYTHON_EXECUTABLE} -B -c "" OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE PYTHON_HAS_DASH_B_RESULT ) if(PYTHON_HAS_DASH_B_RESULT EQUAL 0) set(PYTHON_DASH_B "-B") endif() endif(PYTHON_EXECUTABLE) ######################################################################## # Check for the existence of a python module: # - desc a string description of the check # - mod the name of the module to import # - cmd an additional command to run # - have the result variable to set ######################################################################## macro(GR_PYTHON_CHECK_MODULE desc mod cmd have) message(STATUS "") message(STATUS "Python checking for ${desc}") execute_process( COMMAND ${PYTHON_EXECUTABLE} -c " ######################################### try: import ${mod} except: exit(-1) try: assert ${cmd} except: exit(-1) #########################################" RESULT_VARIABLE ${have} ) if(${have} EQUAL 0) message(STATUS "Python checking for ${desc} - found") set(${have} TRUE) else(${have} EQUAL 0) message(STATUS "Python checking for ${desc} - not found") set(${have} FALSE) endif(${have} EQUAL 0) endmacro(GR_PYTHON_CHECK_MODULE) ######################################################################## # Sets the python installation directory GR_PYTHON_DIR ######################################################################## execute_process(COMMAND ${PYTHON_EXECUTABLE} -c " from distutils import sysconfig print sysconfig.get_python_lib(plat_specific=True, prefix='') " OUTPUT_VARIABLE GR_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE ) file(TO_CMAKE_PATH ${GR_PYTHON_DIR} GR_PYTHON_DIR) ######################################################################## # Create an always-built target with a unique name # Usage: GR_UNIQUE_TARGET( ) ######################################################################## function(GR_UNIQUE_TARGET desc) file(RELATIVE_PATH reldir ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}) execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import re, hashlib unique = hashlib.md5('${reldir}${ARGN}').hexdigest()[:5] print(re.sub('\\W', '_', '${desc} ${reldir} ' + unique))" OUTPUT_VARIABLE _target OUTPUT_STRIP_TRAILING_WHITESPACE) add_custom_target(${_target} ALL DEPENDS ${ARGN}) endfunction(GR_UNIQUE_TARGET) ######################################################################## # Install python sources (also builds and installs byte-compiled python) ######################################################################## function(GR_PYTHON_INSTALL) include(CMakeParseArgumentsCopy) CMAKE_PARSE_ARGUMENTS(GR_PYTHON_INSTALL "" "DESTINATION;COMPONENT" "FILES;PROGRAMS" ${ARGN}) #################################################################### if(GR_PYTHON_INSTALL_FILES) #################################################################### install(${ARGN}) #installs regular python files #create a list of all generated files unset(pysrcfiles) unset(pycfiles) unset(pyofiles) foreach(pyfile ${GR_PYTHON_INSTALL_FILES}) get_filename_component(pyfile ${pyfile} ABSOLUTE) list(APPEND pysrcfiles ${pyfile}) #determine if this file is in the source or binary directory file(RELATIVE_PATH source_rel_path ${CMAKE_CURRENT_SOURCE_DIR} ${pyfile}) string(LENGTH "${source_rel_path}" source_rel_path_len) file(RELATIVE_PATH binary_rel_path ${CMAKE_CURRENT_BINARY_DIR} ${pyfile}) string(LENGTH "${binary_rel_path}" binary_rel_path_len) #and set the generated path appropriately if(${source_rel_path_len} GREATER ${binary_rel_path_len}) set(pygenfile ${CMAKE_CURRENT_BINARY_DIR}/${binary_rel_path}) else() set(pygenfile ${CMAKE_CURRENT_BINARY_DIR}/${source_rel_path}) endif() list(APPEND pycfiles ${pygenfile}c) list(APPEND pyofiles ${pygenfile}o) #ensure generation path exists get_filename_component(pygen_path ${pygenfile} PATH) file(MAKE_DIRECTORY ${pygen_path}) endforeach(pyfile) #the command to generate the pyc files add_custom_command( DEPENDS ${pysrcfiles} OUTPUT ${pycfiles} COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/python_compile_helper.py ${pysrcfiles} ${pycfiles} ) #the command to generate the pyo files add_custom_command( DEPENDS ${pysrcfiles} OUTPUT ${pyofiles} COMMAND ${PYTHON_EXECUTABLE} -O ${CMAKE_BINARY_DIR}/python_compile_helper.py ${pysrcfiles} ${pyofiles} ) #create install rule and add generated files to target list set(python_install_gen_targets ${pycfiles} ${pyofiles}) install(FILES ${python_install_gen_targets} DESTINATION ${GR_PYTHON_INSTALL_DESTINATION} COMPONENT ${GR_PYTHON_INSTALL_COMPONENT} ) #################################################################### elseif(GR_PYTHON_INSTALL_PROGRAMS) #################################################################### file(TO_NATIVE_PATH ${PYTHON_EXECUTABLE} pyexe_native) foreach(pyfile ${GR_PYTHON_INSTALL_PROGRAMS}) get_filename_component(pyfile_name ${pyfile} NAME) get_filename_component(pyfile ${pyfile} ABSOLUTE) string(REPLACE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" pyexefile "${pyfile}.exe") list(APPEND python_install_gen_targets ${pyexefile}) get_filename_component(pyexefile_path ${pyexefile} PATH) file(MAKE_DIRECTORY ${pyexefile_path}) add_custom_command( OUTPUT ${pyexefile} DEPENDS ${pyfile} COMMAND ${PYTHON_EXECUTABLE} -c \"open('${pyexefile}', 'w').write('\#!${pyexe_native}\\n'+open('${pyfile}').read())\" COMMENT "Shebangin ${pyfile_name}" ) #on windows, python files need an extension to execute get_filename_component(pyfile_ext ${pyfile} EXT) if(WIN32 AND NOT pyfile_ext) set(pyfile_name "${pyfile_name}.py") endif() install(PROGRAMS ${pyexefile} RENAME ${pyfile_name} DESTINATION ${GR_PYTHON_INSTALL_DESTINATION} COMPONENT ${GR_PYTHON_INSTALL_COMPONENT} ) endforeach(pyfile) endif() GR_UNIQUE_TARGET("pygen" ${python_install_gen_targets}) endfunction(GR_PYTHON_INSTALL) ######################################################################## # Write the python helper script that generates byte code files ######################################################################## file(WRITE ${CMAKE_BINARY_DIR}/python_compile_helper.py " import sys, py_compile files = sys.argv[1:] srcs, gens = files[:len(files)/2], files[len(files)/2:] for src, gen in zip(srcs, gens): py_compile.compile(file=src, cfile=gen, doraise=True) ") gr-gsm-0.41.2/cmake/Modules/GrSwig.cmake000066400000000000000000000207471316153413000176750ustar00rootroot00000000000000# Copyright 2010-2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. if(DEFINED __INCLUDED_GR_SWIG_CMAKE) return() endif() set(__INCLUDED_GR_SWIG_CMAKE TRUE) include(GrPython) ######################################################################## # Builds a swig documentation file to be generated into python docstrings # Usage: GR_SWIG_MAKE_DOCS(output_file input_path input_path....) # # Set the following variable to specify extra dependent targets: # - GR_SWIG_DOCS_SOURCE_DEPS # - GR_SWIG_DOCS_TARGET_DEPS ######################################################################## function(GR_SWIG_MAKE_DOCS output_file) find_package(Doxygen) if(DOXYGEN_FOUND) #setup the input files variable list, quote formated set(input_files) unset(INPUT_PATHS) foreach(input_path ${ARGN}) if (IS_DIRECTORY ${input_path}) #when input path is a directory file(GLOB input_path_h_files ${input_path}/*.h) else() #otherwise its just a file, no glob set(input_path_h_files ${input_path}) endif() list(APPEND input_files ${input_path_h_files}) set(INPUT_PATHS "${INPUT_PATHS} \"${input_path}\"") endforeach(input_path) #determine the output directory get_filename_component(name ${output_file} NAME_WE) get_filename_component(OUTPUT_DIRECTORY ${output_file} PATH) set(OUTPUT_DIRECTORY ${OUTPUT_DIRECTORY}/${name}_swig_docs) make_directory(${OUTPUT_DIRECTORY}) #generate the Doxyfile used by doxygen configure_file( ${CMAKE_SOURCE_DIR}/docs/doxygen/Doxyfile.swig_doc.in ${OUTPUT_DIRECTORY}/Doxyfile @ONLY) #Create a dummy custom command that depends on other targets include(GrMiscUtils) GR_GEN_TARGET_DEPS(_${name}_tag tag_deps ${GR_SWIG_DOCS_TARGET_DEPS}) #call doxygen on the Doxyfile + input headers add_custom_command( OUTPUT ${OUTPUT_DIRECTORY}/xml/index.xml DEPENDS ${input_files} ${GR_SWIG_DOCS_SOURCE_DEPS} ${tag_deps} COMMAND ${DOXYGEN_EXECUTABLE} ${OUTPUT_DIRECTORY}/Doxyfile COMMENT "Generating doxygen xml for ${name} docs" ) #call the swig_doc script on the xml files add_custom_command( OUTPUT ${output_file} DEPENDS ${input_files} ${OUTPUT_DIRECTORY}/xml/index.xml COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${CMAKE_SOURCE_DIR}/docs/doxygen/swig_doc.py ${OUTPUT_DIRECTORY}/xml ${output_file} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docs/doxygen ) else(DOXYGEN_FOUND) file(WRITE ${output_file} "\n") #no doxygen -> empty file endif(DOXYGEN_FOUND) endfunction(GR_SWIG_MAKE_DOCS) ######################################################################## # Build a swig target for the common gnuradio use case. Usage: # GR_SWIG_MAKE(target ifile ifile ifile...) # # Set the following variables before calling: # - GR_SWIG_FLAGS # - GR_SWIG_INCLUDE_DIRS # - GR_SWIG_LIBRARIES # - GR_SWIG_SOURCE_DEPS # - GR_SWIG_TARGET_DEPS # - GR_SWIG_DOC_FILE # - GR_SWIG_DOC_DIRS ######################################################################## macro(GR_SWIG_MAKE name) set(ifiles ${ARGN}) #do swig doc generation if specified if (GR_SWIG_DOC_FILE) set(GR_SWIG_DOCS_SOURCE_DEPS ${GR_SWIG_SOURCE_DEPS}) set(GR_SWIG_DOCS_TAREGT_DEPS ${GR_SWIG_TARGET_DEPS}) GR_SWIG_MAKE_DOCS(${GR_SWIG_DOC_FILE} ${GR_SWIG_DOC_DIRS}) list(APPEND GR_SWIG_SOURCE_DEPS ${GR_SWIG_DOC_FILE}) endif() #append additional include directories find_package(PythonLibs 2) list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_PATH}) #deprecated name (now dirs) list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS}) list(APPEND GR_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}) list(APPEND GR_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}) #determine include dependencies for swig file execute_process( COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/get_swig_deps.py "${ifiles}" "${GR_SWIG_INCLUDE_DIRS}" OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE SWIG_MODULE_${name}_EXTRA_DEPS WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) #Create a dummy custom command that depends on other targets include(GrMiscUtils) GR_GEN_TARGET_DEPS(_${name}_swig_tag tag_deps ${GR_SWIG_TARGET_DEPS}) set(tag_file ${CMAKE_CURRENT_BINARY_DIR}/${name}.tag) add_custom_command( OUTPUT ${tag_file} DEPENDS ${GR_SWIG_SOURCE_DEPS} ${tag_deps} COMMAND ${CMAKE_COMMAND} -E touch ${tag_file} ) #append the specified include directories include_directories(${GR_SWIG_INCLUDE_DIRS}) list(APPEND SWIG_MODULE_${name}_EXTRA_DEPS ${tag_file}) #setup the swig flags with flags and include directories set(CMAKE_SWIG_FLAGS -fvirtual -modern -keyword -w511 -module ${name} ${GR_SWIG_FLAGS}) foreach(dir ${GR_SWIG_INCLUDE_DIRS}) list(APPEND CMAKE_SWIG_FLAGS "-I${dir}") endforeach(dir) #set the C++ property on the swig .i file so it builds set_source_files_properties(${ifiles} PROPERTIES CPLUSPLUS ON) #setup the actual swig library target to be built include(UseSWIG) SWIG_ADD_MODULE(${name} python ${ifiles}) SWIG_LINK_LIBRARIES(${name} ${PYTHON_LIBRARIES} ${GR_SWIG_LIBRARIES}) endmacro(GR_SWIG_MAKE) ######################################################################## # Install swig targets generated by GR_SWIG_MAKE. Usage: # GR_SWIG_INSTALL( # TARGETS target target target... # [DESTINATION destination] # [COMPONENT component] # ) ######################################################################## macro(GR_SWIG_INSTALL) include(CMakeParseArgumentsCopy) CMAKE_PARSE_ARGUMENTS(GR_SWIG_INSTALL "" "DESTINATION;COMPONENT" "TARGETS" ${ARGN}) foreach(name ${GR_SWIG_INSTALL_TARGETS}) install(TARGETS ${SWIG_MODULE_${name}_REAL_NAME} DESTINATION ${GR_SWIG_INSTALL_DESTINATION} COMPONENT ${GR_SWIG_INSTALL_COMPONENT} ) include(GrPython) GR_PYTHON_INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name}.py DESTINATION ${GR_SWIG_INSTALL_DESTINATION} COMPONENT ${GR_SWIG_INSTALL_COMPONENT} ) GR_LIBTOOL( TARGET ${SWIG_MODULE_${name}_REAL_NAME} DESTINATION ${GR_SWIG_INSTALL_DESTINATION} ) endforeach(name) endmacro(GR_SWIG_INSTALL) ######################################################################## # Generate a python file that can determine swig dependencies. # Used by the make macro above to determine extra dependencies. # When you build C++, CMake figures out the header dependencies. # This code essentially performs that logic for swig includes. ######################################################################## file(WRITE ${CMAKE_BINARY_DIR}/get_swig_deps.py " import os, sys, re include_matcher = re.compile('[#|%]include\\s*[<|\"](.*)[>|\"]') include_dirs = sys.argv[2].split(';') def get_swig_incs(file_path): file_contents = open(file_path, 'r').read() return include_matcher.findall(file_contents, re.MULTILINE) def get_swig_deps(file_path, level): deps = [file_path] if level == 0: return deps for inc_file in get_swig_incs(file_path): for inc_dir in include_dirs: inc_path = os.path.join(inc_dir, inc_file) if not os.path.exists(inc_path): continue deps.extend(get_swig_deps(inc_path, level-1)) return deps if __name__ == '__main__': ifiles = sys.argv[1].split(';') deps = sum([get_swig_deps(ifile, 3) for ifile in ifiles], []) #sys.stderr.write(';'.join(set(deps)) + '\\n\\n') print(';'.join(set(deps))) ") gr-gsm-0.41.2/cmake/Modules/GrTest.cmake000066400000000000000000000127021316153413000176730ustar00rootroot00000000000000# Copyright 2010-2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. if(DEFINED __INCLUDED_GR_TEST_CMAKE) return() endif() set(__INCLUDED_GR_TEST_CMAKE TRUE) ######################################################################## # Add a unit test and setup the environment for a unit test. # Takes the same arguments as the ADD_TEST function. # # Before calling set the following variables: # GR_TEST_TARGET_DEPS - built targets for the library path # GR_TEST_LIBRARY_DIRS - directories for the library path # GR_TEST_PYTHON_DIRS - directories for the python path ######################################################################## function(GR_ADD_TEST test_name) if(WIN32) #Ensure that the build exe also appears in the PATH. list(APPEND GR_TEST_TARGET_DEPS ${ARGN}) #In the land of windows, all libraries must be in the PATH. #Since the dependent libraries are not yet installed, #we must manually set them in the PATH to run tests. #The following appends the path of a target dependency. foreach(target ${GR_TEST_TARGET_DEPS}) get_target_property(location ${target} LOCATION) if(location) get_filename_component(path ${location} PATH) string(REGEX REPLACE "\\$\\(.*\\)" ${CMAKE_BUILD_TYPE} path ${path}) list(APPEND GR_TEST_LIBRARY_DIRS ${path}) endif(location) endforeach(target) #SWIG generates the python library files into a subdirectory. #Therefore, we must append this subdirectory into PYTHONPATH. #Only do this for the python directories matching the following: foreach(pydir ${GR_TEST_PYTHON_DIRS}) get_filename_component(name ${pydir} NAME) if(name MATCHES "^(swig|lib|src)$") list(APPEND GR_TEST_PYTHON_DIRS ${pydir}/${CMAKE_BUILD_TYPE}) endif() endforeach(pydir) endif(WIN32) file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR} srcdir) file(TO_NATIVE_PATH "${GR_TEST_LIBRARY_DIRS}" libpath) #ok to use on dir list? file(TO_NATIVE_PATH "${GR_TEST_PYTHON_DIRS}" pypath) #ok to use on dir list? set(environs "GR_DONT_LOAD_PREFS=1" "srcdir=${srcdir}") #http://www.cmake.org/pipermail/cmake/2009-May/029464.html #Replaced this add test + set environs code with the shell script generation. #Its nicer to be able to manually run the shell script to diagnose problems. #ADD_TEST(${ARGV}) #SET_TESTS_PROPERTIES(${test_name} PROPERTIES ENVIRONMENT "${environs}") if(UNIX) set(binpath "${CMAKE_CURRENT_BINARY_DIR}:$PATH") #set both LD and DYLD paths to cover multiple UNIX OS library paths list(APPEND libpath "$LD_LIBRARY_PATH" "$DYLD_LIBRARY_PATH") list(APPEND pypath "$PYTHONPATH") #replace list separator with the path separator string(REPLACE ";" ":" libpath "${libpath}") string(REPLACE ";" ":" pypath "${pypath}") list(APPEND environs "PATH=${binpath}" "LD_LIBRARY_PATH=${libpath}" "DYLD_LIBRARY_PATH=${libpath}" "PYTHONPATH=${pypath}") #generate a bat file that sets the environment and runs the test find_program(SHELL sh) set(sh_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.sh) file(WRITE ${sh_file} "#!${SHELL}\n") #each line sets an environment variable foreach(environ ${environs}) file(APPEND ${sh_file} "export ${environ}\n") endforeach(environ) #load the command to run with its arguments foreach(arg ${ARGN}) file(APPEND ${sh_file} "${arg} ") endforeach(arg) file(APPEND ${sh_file} "\n") #make the shell file executable execute_process(COMMAND chmod +x ${sh_file}) add_test(${test_name} ${SHELL} ${sh_file}) endif(UNIX) if(WIN32) list(APPEND libpath ${DLL_PATHS} "%PATH%") list(APPEND pypath "%PYTHONPATH%") #replace list separator with the path separator (escaped) string(REPLACE ";" "\\;" libpath "${libpath}") string(REPLACE ";" "\\;" pypath "${pypath}") list(APPEND environs "PATH=${libpath}" "PYTHONPATH=${pypath}") #generate a bat file that sets the environment and runs the test set(bat_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.bat) file(WRITE ${bat_file} "@echo off\n") #each line sets an environment variable foreach(environ ${environs}) file(APPEND ${bat_file} "SET ${environ}\n") endforeach(environ) #load the command to run with its arguments foreach(arg ${ARGN}) file(APPEND ${bat_file} "${arg} ") endforeach(arg) file(APPEND ${bat_file} "\n") add_test(${test_name} ${bat_file}) endif(WIN32) endfunction(GR_ADD_TEST) gr-gsm-0.41.2/cmake/Modules/GrVersion.cmake000066400000000000000000000062311316153413000204010ustar00rootroot00000000000000# Copyright 2011,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. if(DEFINED __INCLUDED_GR_VERSION_CMAKE) return() endif() set(__INCLUDED_GR_VERSION_CMAKE TRUE) #eventually, replace version.sh and fill in the variables below set(MAJOR_VERSION ${VERSION_INFO_MAJOR_VERSION}) set(API_COMPAT ${VERSION_INFO_API_COMPAT}) set(MINOR_VERSION ${VERSION_INFO_MINOR_VERSION}) set(MAINT_VERSION ${VERSION_INFO_MAINT_VERSION}) ######################################################################## # Extract the version string from git describe. ######################################################################## find_package(Git) if(GIT_FOUND AND EXISTS ${CMAKE_SOURCE_DIR}/.git) message(STATUS "Extracting version information from git describe...") execute_process( COMMAND ${GIT_EXECUTABLE} describe --always --abbrev=8 --long OUTPUT_VARIABLE GIT_DESCRIBE OUTPUT_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ) else() set(GIT_DESCRIBE "v${MAJOR_VERSION}.${API_COMPAT}.x-xxx-xunknown") endif() ######################################################################## # Use the logic below to set the version constants ######################################################################## if("${MINOR_VERSION}" STREQUAL "git") # VERSION: 3.3git-xxx-gxxxxxxxx # DOCVER: 3.3git # LIBVER: 3.3git set(VERSION "${GIT_DESCRIBE}") set(DOCVER "${MAJOR_VERSION}.${API_COMPAT}${MINOR_VERSION}") set(LIBVER "${MAJOR_VERSION}.${API_COMPAT}${MINOR_VERSION}") set(RC_MINOR_VERSION "0") set(RC_MAINT_VERSION "0") elseif("${MAINT_VERSION}" STREQUAL "git") # VERSION: 3.3.1git-xxx-gxxxxxxxx # DOCVER: 3.3.1git # LIBVER: 3.3.1git set(VERSION "${GIT_DESCRIBE}") set(DOCVER "${MAJOR_VERSION}.${API_COMPAT}.${MINOR_VERSION}${MAINT_VERSION}") set(LIBVER "${MAJOR_VERSION}.${API_COMPAT}.${MINOR_VERSION}${MAINT_VERSION}") math(EXPR RC_MINOR_VERSION "${MINOR_VERSION} - 1") set(RC_MAINT_VERSION "0") else() # This is a numbered release. # VERSION: 3.3.1{.x} # DOCVER: 3.3.1{.x} # LIBVER: 3.3.1{.x} if("${MAINT_VERSION}" STREQUAL "0") set(VERSION "${MAJOR_VERSION}.${API_COMPAT}.${MINOR_VERSION}") else() set(VERSION "${MAJOR_VERSION}.${API_COMPAT}.${MINOR_VERSION}.${MAINT_VERSION}") endif() set(DOCVER "${VERSION}") set(LIBVER "${VERSION}") set(RC_MINOR_VERSION ${MINOR_VERSION}) set(RC_MAINT_VERSION ${MAINT_VERSION}) endif() gr-gsm-0.41.2/cmake/Modules/gr-gsmConfig.cmake000066400000000000000000000013551316153413000210070ustar00rootroot00000000000000INCLUDE(FindPkgConfig) PKG_CHECK_MODULES(PC_GR_GSM grgsm) FIND_PATH( GR_GSM_INCLUDE_DIRS NAMES grgsm/api.h HINTS $ENV{GR_GSM_DIR}/include ${PC_GR_GSM_INCLUDEDIR} PATHS ${CMAKE_INSTALL_PREFIX}/include /usr/local/include /usr/include ) FIND_LIBRARY( GR_GSM_LIBRARIES NAMES grgsm HINTS $ENV{GR_GSM_DIR}/lib ${PC_GR_GSM_LIBDIR} PATHS ${CMAKE_INSTALL_PREFIX}/lib ${CMAKE_INSTALL_PREFIX}/lib64 /usr/local/lib /usr/local/lib64 /usr/lib /usr/lib64 ) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(GR_GSM DEFAULT_MSG GR_GSM_LIBRARIES GR_GSM_INCLUDE_DIRS) MARK_AS_ADVANCED(GR_GSM_LIBRARIES GR_GSM_INCLUDE_DIRS) gr-gsm-0.41.2/cmake/cmake_uninstall.cmake.in000066400000000000000000000025321316153413000206310ustar00rootroot00000000000000# http://www.vtk.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) STRING(REGEX REPLACE "\n" ";" files "${files}") FOREACH(file ${files}) MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") IF(EXISTS "$ENV{DESTDIR}${file}") EXEC_PROGRAM( "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" OUTPUT_VARIABLE rm_out RETURN_VALUE rm_retval ) IF(NOT "${rm_retval}" STREQUAL 0) MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") ENDIF(NOT "${rm_retval}" STREQUAL 0) ELSEIF(IS_SYMLINK "$ENV{DESTDIR}${file}") EXEC_PROGRAM( "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" OUTPUT_VARIABLE rm_out RETURN_VALUE rm_retval ) IF(NOT "${rm_retval}" STREQUAL 0) MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") ENDIF(NOT "${rm_retval}" STREQUAL 0) ELSE(EXISTS "$ENV{DESTDIR}${file}") MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") ENDIF(EXISTS "$ENV{DESTDIR}${file}") ENDFOREACH(file) gr-gsm-0.41.2/dists/000077500000000000000000000000001316153413000141155ustar00rootroot00000000000000gr-gsm-0.41.2/dists/debian/000077500000000000000000000000001316153413000153375ustar00rootroot00000000000000gr-gsm-0.41.2/dists/debian/build-package000077500000000000000000000010041316153413000177500ustar00rootroot00000000000000#!/bin/bash if [ ! -e debian ] ; then ln -s dists/debian . fi BASEVERSION=$(dpkg-parsechangelog --show-field Version | cut -d- -f1) DEBVERSION=$(dpkg-parsechangelog --show-field Version) debdir=$(cd $(dirname $0); pwd) pkgdir=$(cd $debdir/..; pwd) pkgbasedir=$(cd $debdir/..; basename $(pwd)) cd $pkgdir/.. tar -acf gr-gsm_${BASEVERSION}.orig.tar.gz $pkgbasedir cd $pkgdir debuild -S -sa #pdebuild cd .. dput ppa:ptrkrysik/gr-gsm gr-gsm_${DEBVERSION}_source.changes if [ -h debian ] ; then rm debian fi gr-gsm-0.41.2/dists/debian/changelog000066400000000000000000000005001316153413000172040ustar00rootroot00000000000000gr-gsm (0.41.1-0ppa0) xenial; urgency=low * First packaged release of gr-gsm (for Debian). -- Piotr Krysik Sun, 2 Sep 2017 21:00:00 +0100 gr-gsm (0.40-0ppa0) xenial; urgency=low * Initial upload (Closes: #871055). -- Piotr Krysik Sun, 24 Apr 2016 16:00:00 +0100 gr-gsm-0.41.2/dists/debian/compat000066400000000000000000000000021316153413000165350ustar00rootroot000000000000009 gr-gsm-0.41.2/dists/debian/control000066400000000000000000000016631316153413000167500ustar00rootroot00000000000000Source: gr-gsm Section: libdevel Priority: optional Maintainer: Piotr Krysik Build-Depends: cmake, debhelper (>= 9~), gnuradio-dev, libosmocore-dev, pkg-config, python-dev, python-scipy, swig X-Python-Version: >= 2.7, << 2.8 Standards-Version: 4.0.1 Homepage: http://github.com/ptrkrysik/gr-gsm/ Vcs-Git: git://github.com/ptrkrysik/gr-gsm.git Vcs-Browser: https://github.com/ptrkrysik/gr-gsm/ Package: gr-gsm Architecture: any Pre-Depends: ${misc:Pre-Depends} Depends: ${misc:Depends}, ${python:Depends}, ${shlibs:Depends}, libjs-jquery, gnuradio, gr-osmosdr Description: Gnuradio blocks and tools for receiving GSM transmissions Implementation of the Global System for Mobile Communications protocol and provide tools for scanning for GSM base stations and for decoding GSM radio trafic. gr-gsm-0.41.2/dists/debian/copyright000066400000000000000000000117311316153413000172750ustar00rootroot00000000000000Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Files: * Copyright: 2015-2017, Roman Khassraf License: GPL-3+ Files: lib/decoding/* Copyright: 2009-2017, Piotr Krysik License: GPL-3+ Files: lib/decoding/openbts/* Copyright: 2012-2014, Range Networks, Inc License: AGPL-3+ Files: lib/decoding/openbts/BitVector.cpp lib/decoding/openbts/BitVector.h lib/decoding/openbts/Vector.h lib/decoding/openbts/ViterbiR204.cpp lib/decoding/openbts/ViterbiR204.h Copyright: 2014, Range Networks, Inc 2008, 2009, 2014, Free Software Foundation, Inc License: AGPL-3+ Files: lib/decoding/openbts/GSM610Tables.cpp lib/decoding/openbts/GSM610Tables.h Copyright: 2008, Free Software Foundation, Inc License: AGPL-3+ Files: lib/decoding/openbts/GSM660Tables.cpp lib/decoding/openbts/GSM660Tables.h Copyright: 2010, Sylvain Munaut License: AGPL-3+ Files: lib/decoding/osmocom/* Copyright: 2016, Tom Tsou 2013, Andreas Eversberg License: GPL-2+ Files: lib/decoding/osmocom/coding/gsm0503.h Copyright: 2016, sysmocom s.f.m.c. GmbH License: GPL-2+ Files: lib/decoding/osmocom/coding/gsm0503_coding.c lib/decoding/osmocom/coding/gsm0503_coding.h Copyright: 2016, Tom Tsou 2015, Alexander Chemeris 2013, Andreas Eversberg License: GPL-2+ Files: lib/decoding/osmocom/coding/gsm0503_conv.c Copyright: 2016, sysmocom s.f.m.c. GmbH 2011-2016, Sylvain Munaut License: GPL-3+ Files: lib/decoding/tch_f_decoder_impl.cc Copyright: 2017, Piotr Krysik 2015, Roman Khassraf License: GPL-3+ Files: lib/decoding/tch_f_decoder_impl.h Copyright: 2015-2017, Roman Khassraf License: GPL-3+ Files: lib/decryption/* Copyright: 2015, Roman Khassraf 2014, Piotr Krysik License: GPL-3+ Files: lib/decryption/decryption_impl.h Copyright: 2009-2017, Piotr Krysik License: GPL-3+ Files: lib/demapping/universal_ctrl_chans_demapper_impl.cc lib/demapping/universal_ctrl_chans_demapper_impl.h Copyright: 2009-2017, Piotr Krysik License: GPL-3+ Files: lib/flow_control/uplink_downlink_splitter_impl.cc lib/flow_control/uplink_downlink_splitter_impl.h Copyright: 2009-2017, Piotr Krysik License: GPL-3+ Files: lib/misc_utils/bursts_printer_impl.cc lib/misc_utils/bursts_printer_impl.h lib/misc_utils/controlled_fractional_resampler_cc_impl.cc lib/misc_utils/controlled_fractional_resampler_cc_impl.h lib/misc_utils/controlled_rotator_cc_impl.cc lib/misc_utils/controlled_rotator_cc_impl.h lib/misc_utils/extract_system_info_impl.cc lib/misc_utils/extract_system_info_impl.h lib/misc_utils/message_printer_impl.cc lib/misc_utils/message_printer_impl.h lib/misc_utils/msg_to_tag_impl.cc lib/misc_utils/msg_to_tag_impl.h lib/misc_utils/tmsi_dumper_impl.cc lib/misc_utils/tmsi_dumper_impl.h Copyright: 2009-2017, Piotr Krysik License: GPL-3+ Files: lib/receiver/* Copyright: 2009-2017, Piotr Krysik License: GPL-3+ Files: lib/receiver/cx_channel_hopper_impl.cc lib/receiver/cx_channel_hopper_impl.h Copyright: 2015, Pieter Robyns License: GPL-3+ Files: python/__init__.py python/build_utils.py python/build_utils_codes.py Copyright: 2004, 2008, 2009, 2012, Free Software Foundation, Inc License: GPL-3+ Files: python/demapping/* Copyright: 2009-2017, Piotr Krysik License: GPL-3+ Files: python/misc_utils/* Copyright: 2009-2017, Piotr Krysik License: GPL-3+ Files: python/misc_utils/arfcn.py Copyright: 2015-2017, Roman Khassraf License: GPL-3+ Files: python/qa_controlled_fractional_resampler_cc.py python/qa_msg_to_tag.py python/qa_uplink_downlink_splitter.py Copyright: 2009-2017, Piotr Krysik License: GPL-3+ Files: python/receiver/* Copyright: 2009-2017, Piotr Krysik License: GPL-3+ License: AGPL-3+ Please fill license AGPL-3+ from header of lib/decoding/openbts/* License: GPL-2+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 dated June, 1991, or (at your option) any later version. . On Debian systems, the complete text of version 2 of the GNU General Public License can be found in '/usr/share/common-licenses/GPL-2'. License: GPL-3+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 3 dated June, 2007, or (at your option) any later version. . On Debian systems, the complete text of version 3 of the GNU General Public License can be found in '/usr/share/common-licenses/GPL-3'. gr-gsm-0.41.2/dists/debian/gr-gsm.links000066400000000000000000000001201316153413000175660ustar00rootroot00000000000000/usr/share/javascript/jquery/jquery.min.js /usr/share/doc/gr-gsm/html/jquery.js gr-gsm-0.41.2/dists/debian/rules000077500000000000000000000012001316153413000164100ustar00rootroot00000000000000#!/usr/bin/make -f DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) export DEB_HOST_MULTIARCH %: dh $@ --with python2 --parallel override_dh_auto_configure: dh_auto_configure -- -DLIB_SUFFIX="/$(DEB_HOST_MULTIARCH)" -DPythonLibs_FIND_VERSION:STRING="2.7" -DPYTHON_EXECUTABLE:STRING="/usr/bin/python" override_dh_auto_install: dh_auto_install # Remove compiled python files rm -f debian/gr-gsm/usr/lib/python2.7/dist-packages/grgsm/*py[co] # Use jquery.js file from libjs-jquery instead, see gr-gsm.links rm -f debian/gr-gsm/usr/share/doc/gr-gsm/html/jquery.js debian/copyright: cme update dpkg-copyright gr-gsm-0.41.2/dists/debian/source/000077500000000000000000000000001316153413000166375ustar00rootroot00000000000000gr-gsm-0.41.2/dists/debian/source/format000066400000000000000000000000141316153413000200450ustar00rootroot000000000000003.0 (quilt) gr-gsm-0.41.2/docs/000077500000000000000000000000001316153413000137175ustar00rootroot00000000000000gr-gsm-0.41.2/docs/CMakeLists.txt000066400000000000000000000046441316153413000164670ustar00rootroot00000000000000# Copyright 2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. ######################################################################## # Setup dependencies ######################################################################## find_package(Doxygen) ######################################################################## # Begin conditional configuration ######################################################################## if(ENABLE_DOXYGEN) ######################################################################## # Add subdirectories ######################################################################## add_subdirectory(doxygen) endif(ENABLE_DOXYGEN) ######################################################################## # Convert manual pages from rst to roff and install them ######################################################################## find_program(RST2MAN_EXECUTABLE NAMES rst2man rst2man.py rst2man2 rst2man2.py) function(BUILD_MAN_PAGE _sources _src _dst) add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_dst}" COMMAND ${RST2MAN_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${_src} ${CMAKE_CURRENT_BINARY_DIR}/${_dst} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_src}) list(APPEND ${_sources} "${CMAKE_CURRENT_BINARY_DIR}/${_dst}") set(${_sources} ${${_sources}} PARENT_SCOPE) add_custom_target(man_${_src} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_dst}) endfunction() if(NOT RST2MAN_EXECUTABLE) message(WARNING "rst2man from python-docutils is required to build man pages") else() build_man_page(MAN1_OUTPUT grgsm_livemon.rst grgsm_livemon.1) install(FILES ${MAN1_OUTPUT} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1) endif() gr-gsm-0.41.2/docs/doxygen/000077500000000000000000000000001316153413000153745ustar00rootroot00000000000000gr-gsm-0.41.2/docs/doxygen/CMakeLists.txt000066400000000000000000000037351316153413000201440ustar00rootroot00000000000000# Copyright 2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. ######################################################################## # Create the doxygen configuration file ######################################################################## file(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR} top_srcdir) file(TO_NATIVE_PATH ${CMAKE_BINARY_DIR} top_builddir) file(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR} abs_top_srcdir) file(TO_NATIVE_PATH ${CMAKE_BINARY_DIR} abs_top_builddir) set(HAVE_DOT ${DOXYGEN_DOT_FOUND}) set(enable_html_docs YES) set(enable_latex_docs NO) set(enable_xml_docs YES) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) set(BUILT_DIRS ${CMAKE_CURRENT_BINARY_DIR}/xml ${CMAKE_CURRENT_BINARY_DIR}/html) ######################################################################## # Make and install doxygen docs ######################################################################## add_custom_command( OUTPUT ${BUILT_DIRS} COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Generating documentation with doxygen" ) add_custom_target(doxygen_target ALL DEPENDS ${BUILT_DIRS}) install(DIRECTORY ${BUILT_DIRS} DESTINATION ${GR_PKG_DOC_DIR}) gr-gsm-0.41.2/docs/doxygen/Doxyfile.in000066400000000000000000001730021316153413000175120ustar00rootroot00000000000000# Doxyfile 1.5.7.1 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = "GNU Radio's GSM Package" # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek, # Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages), # Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish, # Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, Slovene, # Spanish, Swedish, and Ukrainian. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = YES # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = NO # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = YES # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 8 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = YES # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter # and setter methods for a property. Setting this option to YES (the default) # will make doxygen to replace the get and set methods by a property in the # documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The SYMBOL_CACHE_SIZE determines the size of the internal cache use to # determine which symbols to keep in memory and which to flush to disk. # When the cache is full, less often used symbols will be written to disk. # For small to medium size projects (<1000 input files) the default value is # probably good enough. For larger projects a too small cache size can cause # doxygen to be busy swapping symbols to and from disk most of the time # causing a significant performance penality. # If the system has enough physical memory increasing the cache will improve the # performance by keeping more symbols in memory. Note that the value works on # a logarithmic scale so increasing the size by one will rougly double the # memory usage. The cache size is given by this formula: # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols SYMBOL_CACHE_SIZE = 4 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespace are hidden. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = NO # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = NO # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = NO # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= NO # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = NO # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = NO # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by # doxygen. The layout file controls the global structure of the generated output files # in an output format independent way. The create the layout file that represents # doxygen's defaults, run doxygen with the -l option. You can optionally specify a # file name after the option, if omitted DoxygenLayout.xml will be used as the name # of the layout file. LAYOUT_FILE = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = YES # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be abled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text " # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = @top_srcdir@ @top_builddir@ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 FILE_PATTERNS = *.h \ *.dox # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = @abs_top_builddir@/docs/doxygen/html \ @abs_top_builddir@/docs/doxygen/xml \ @abs_top_builddir@/docs/doxygen/other/doxypy.py \ @abs_top_builddir@/_CPack_Packages \ @abs_top_srcdir@/cmake # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = */.deps/* \ */.libs/* \ */.svn/* \ */CVS/* \ */__init__.py \ */qa_*.cc \ */qa_*.h \ */qa_*.py # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = ad9862 \ numpy \ *swig* \ *Swig* \ *my_top_block* \ *my_graph* \ *app_top_block* \ *am_rx_graph* \ *_queue_watcher_thread* \ *parse* \ *MyFrame* \ *MyApp* \ *PyObject* \ *wfm_rx_block* \ *_sptr* \ *debug* \ *wfm_rx_sca_block* \ *tv_rx_block* \ *wxapt_rx_block* \ *example_signal* # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. Doxygen will compare the file name with each pattern and apply the # filter if there is a match. The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = *.py=@top_srcdir@/doc/doxygen/other/doxypy.py # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = NO # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = YES # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = YES # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. Otherwise they will link to the documentstion. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = YES # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = @enable_html_docs@ # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. For this to work a browser that supports # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). HTML_DYNAMIC_SECTIONS = NO # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = YES # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER # are set, an additional index file will be generated that can be used as input for # Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated # HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # Qt Help Project / Namespace. QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # Qt Help Project / Virtual Folders. QHP_VIRTUAL_FOLDER = doc # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file . QHG_LOCATION = # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = YES # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to FRAME, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, # Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are # probably better off using the HTML help feature. Other possible values # for this tag are: HIERARCHIES, which will generate the Groups, Directories, # and Class Hierarchy pages using a tree view instead of an ordered list; # ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which # disables this behavior completely. For backwards compatibility with previous # releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE # respectively. GENERATE_TREEVIEW = YES # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 180 # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = @enable_latex_docs@ # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = letter # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = NO # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = @enable_xml_docs@ # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = NO #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. This is useful # if you want to understand what is going on. On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse # the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option is superseded by the HAVE_DOT option below. This is only a # fallback. It is recommended to install and use dot, since it yields more # powerful graphs. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = @HAVE_DOT@ # By default doxygen will write a font called FreeSans.ttf to the output # directory and reference it in all dot files that doxygen generates. This # font does not include all possible unicode characters however, so when you need # these (or just want a differently looking font) you can specify the font name # using DOT_FONTNAME. You need need to make sure dot is able to find the font, # which can be done by putting it in a standard location or by setting the # DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory # containing the font. DOT_FONTNAME = FreeSans # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the output directory to look for the # FreeSans.ttf font (which doxygen will put there itself). If you specify a # different font using DOT_FONTNAME you can set the path where dot # can find it using this tag. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = NO # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = YES # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Configuration::additions related to the search engine #--------------------------------------------------------------------------- # The SEARCHENGINE tag specifies whether or not a search engine should be # used. If set to NO the values of all tags below this one will be ignored. SEARCHENGINE = NO gr-gsm-0.41.2/docs/doxygen/Doxyfile.swig_doc.in000066400000000000000000001736171316153413000213230ustar00rootroot00000000000000# Doxyfile 1.6.1 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = @CPACK_PACKAGE_NAME@ # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = @CPACK_PACKAGE_VERSION@ # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = @OUTPUT_DIRECTORY@ # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 8 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it parses. # With this tag you can assign which parser to use for a given extension. # Doxygen has a built-in mapping, but you can override or extend it using this tag. # The format is ext=language, where ext is a file extension, and language is one of # the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, # Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat # .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), # use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. EXTENSION_MAPPING = # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = YES # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter # and setter methods for a property. Setting this option to YES (the default) # will make doxygen to replace the get and set methods by a property in the # documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The SYMBOL_CACHE_SIZE determines the size of the internal cache use to # determine which symbols to keep in memory and which to flush to disk. # When the cache is full, less often used symbols will be written to disk. # For small to medium size projects (<1000 input files) the default value is # probably good enough. For larger projects a too small cache size can cause # doxygen to be busy swapping symbols to and from disk most of the time # causing a significant performance penality. # If the system has enough physical memory increasing the cache will improve the # performance by keeping more symbols in memory. Note that the value works on # a logarithmic scale so increasing the size by one will rougly double the # memory usage. The cache size is given by this formula: # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols SYMBOL_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = NO # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespace are hidden. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = NO # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. # This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by # doxygen. The layout file controls the global structure of the generated output files # in an output format independent way. The create the layout file that represents # doxygen's defaults, run doxygen with the -l option. You can optionally specify a # file name after the option, if omitted DoxygenLayout.xml will be used as the name # of the layout file. LAYOUT_FILE = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = YES # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be abled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = @INPUT_PATHS@ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 FILE_PATTERNS = *.h # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. # If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. # Doxygen will compare the file name with each pattern and apply the # filter if there is a match. # The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. # Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = NO # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = NO # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. For this to work a browser that supports # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). HTML_DYNAMIC_SECTIONS = NO # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER # are set, an additional index file will be generated that can be used as input for # Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated # HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. # For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's # filter section matches. # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to YES, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). # Windows users are probably better off using the HTML help feature. GENERATE_TREEVIEW = NO # By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, # and Class Hierarchy pages using a tree view instead of an ordered list. USE_INLINE_TREES = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 # When the SEARCHENGINE tag is enable doxygen will generate a search box for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP) or Qt help (GENERATE_QHP) # there is already a search function so this one should typically # be disabled. SEARCHENGINE = YES #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO # If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = YES # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. # This is useful # if you want to understand what is going on. # On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = YES # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse # the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option is superseded by the HAVE_DOT option below. This is only a # fallback. It is recommended to install and use dot, since it yields more # powerful graphs. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = NO # By default doxygen will write a font called FreeSans.ttf to the output # directory and reference it in all dot files that doxygen generates. This # font does not include all possible unicode characters however, so when you need # these (or just want a differently looking font) you can specify the font name # using DOT_FONTNAME. You need need to make sure dot is able to find the font, # which can be done by putting it in a standard location or by setting the # DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory # containing the font. DOT_FONTNAME = FreeSans # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the output directory to look for the # FreeSans.ttf font (which doxygen will put there itself). If you specify a # different font using DOT_FONTNAME you can set the path where dot # can find it using this tag. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = YES # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES gr-gsm-0.41.2/docs/doxygen/doxyxml/000077500000000000000000000000001316153413000171005ustar00rootroot00000000000000gr-gsm-0.41.2/docs/doxygen/doxyxml/__init__.py000066400000000000000000000046521316153413000212200ustar00rootroot00000000000000# # Copyright 2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # """ Python interface to contents of doxygen xml documentation. Example use: See the contents of the example folder for the C++ and doxygen-generated xml used in this example. >>> # Parse the doxygen docs. >>> import os >>> this_dir = os.path.dirname(globals()['__file__']) >>> xml_path = this_dir + "/example/xml/" >>> di = DoxyIndex(xml_path) Get a list of all top-level objects. >>> print([mem.name() for mem in di.members()]) [u'Aadvark', u'aadvarky_enough', u'main'] Get all functions. >>> print([mem.name() for mem in di.in_category(DoxyFunction)]) [u'aadvarky_enough', u'main'] Check if an object is present. >>> di.has_member(u'Aadvark') True >>> di.has_member(u'Fish') False Get an item by name and check its properties. >>> aad = di.get_member(u'Aadvark') >>> print(aad.brief_description) Models the mammal Aadvark. >>> print(aad.detailed_description) Sadly the model is incomplete and cannot capture all aspects of an aadvark yet. This line is uninformative and is only to test line breaks in the comments. >>> [mem.name() for mem in aad.members()] [u'aadvarkness', u'print', u'Aadvark', u'get_aadvarkness'] >>> aad.get_member(u'print').brief_description u'Outputs the vital aadvark statistics.' """ from doxyindex import DoxyIndex, DoxyFunction, DoxyParam, DoxyClass, DoxyFile, DoxyNamespace, DoxyGroup, DoxyFriend, DoxyOther def _test(): import os this_dir = os.path.dirname(globals()['__file__']) xml_path = this_dir + "/example/xml/" di = DoxyIndex(xml_path) # Get the Aadvark class aad = di.get_member('Aadvark') aad.brief_description import doctest return doctest.testmod() if __name__ == "__main__": _test() gr-gsm-0.41.2/docs/doxygen/doxyxml/base.py000066400000000000000000000152121316153413000203650ustar00rootroot00000000000000# # Copyright 2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # """ A base class is created. Classes based upon this are used to make more user-friendly interfaces to the doxygen xml docs than the generated classes provide. """ import os import pdb from xml.parsers.expat import ExpatError from generated import compound class Base(object): class Duplicate(StandardError): pass class NoSuchMember(StandardError): pass class ParsingError(StandardError): pass def __init__(self, parse_data, top=None): self._parsed = False self._error = False self._parse_data = parse_data self._members = [] self._dict_members = {} self._in_category = {} self._data = {} if top is not None: self._xml_path = top._xml_path # Set up holder of references else: top = self self._refs = {} self._xml_path = parse_data self.top = top @classmethod def from_refid(cls, refid, top=None): """ Instantiate class from a refid rather than parsing object. """ # First check to see if its already been instantiated. if top is not None and refid in top._refs: return top._refs[refid] # Otherwise create a new instance and set refid. inst = cls(None, top=top) inst.refid = refid inst.add_ref(inst) return inst @classmethod def from_parse_data(cls, parse_data, top=None): refid = getattr(parse_data, 'refid', None) if refid is not None and top is not None and refid in top._refs: return top._refs[refid] inst = cls(parse_data, top=top) if refid is not None: inst.refid = refid inst.add_ref(inst) return inst def add_ref(self, obj): if hasattr(obj, 'refid'): self.top._refs[obj.refid] = obj mem_classes = [] def get_cls(self, mem): for cls in self.mem_classes: if cls.can_parse(mem): return cls raise StandardError(("Did not find a class for object '%s'." \ % (mem.get_name()))) def convert_mem(self, mem): try: cls = self.get_cls(mem) converted = cls.from_parse_data(mem, self.top) if converted is None: raise StandardError('No class matched this object.') self.add_ref(converted) return converted except StandardError, e: print e @classmethod def includes(cls, inst): return isinstance(inst, cls) @classmethod def can_parse(cls, obj): return False def _parse(self): self._parsed = True def _get_dict_members(self, cat=None): """ For given category a dictionary is returned mapping member names to members of that category. For names that are duplicated the name is mapped to None. """ self.confirm_no_error() if cat not in self._dict_members: new_dict = {} for mem in self.in_category(cat): if mem.name() not in new_dict: new_dict[mem.name()] = mem else: new_dict[mem.name()] = self.Duplicate self._dict_members[cat] = new_dict return self._dict_members[cat] def in_category(self, cat): self.confirm_no_error() if cat is None: return self._members if cat not in self._in_category: self._in_category[cat] = [mem for mem in self._members if cat.includes(mem)] return self._in_category[cat] def get_member(self, name, cat=None): self.confirm_no_error() # Check if it's in a namespace or class. bits = name.split('::') first = bits[0] rest = '::'.join(bits[1:]) member = self._get_dict_members(cat).get(first, self.NoSuchMember) # Raise any errors that are returned. if member in set([self.NoSuchMember, self.Duplicate]): raise member() if rest: return member.get_member(rest, cat=cat) return member def has_member(self, name, cat=None): try: mem = self.get_member(name, cat=cat) return True except self.NoSuchMember: return False def data(self): self.confirm_no_error() return self._data def members(self): self.confirm_no_error() return self._members def process_memberdefs(self): mdtss = [] for sec in self._retrieved_data.compounddef.sectiondef: mdtss += sec.memberdef # At the moment we lose all information associated with sections. # Sometimes a memberdef is in several sectiondef. # We make sure we don't get duplicates here. uniques = set([]) for mem in mdtss: converted = self.convert_mem(mem) pair = (mem.name, mem.__class__) if pair not in uniques: uniques.add(pair) self._members.append(converted) def retrieve_data(self): filename = os.path.join(self._xml_path, self.refid + '.xml') try: self._retrieved_data = compound.parse(filename) except ExpatError: print('Error in xml in file %s' % filename) self._error = True self._retrieved_data = None def check_parsed(self): if not self._parsed: self._parse() def confirm_no_error(self): self.check_parsed() if self._error: raise self.ParsingError() def error(self): self.check_parsed() return self._error def name(self): # first see if we can do it without processing. if self._parse_data is not None: return self._parse_data.name self.check_parsed() return self._retrieved_data.compounddef.name gr-gsm-0.41.2/docs/doxygen/doxyxml/doxyindex.py000066400000000000000000000146271316153413000214770ustar00rootroot00000000000000# # Copyright 2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # """ Classes providing more user-friendly interfaces to the doxygen xml docs than the generated classes provide. """ import os from generated import index from base import Base from text import description class DoxyIndex(Base): """ Parses a doxygen xml directory. """ __module__ = "gnuradio.utils.doxyxml" def _parse(self): if self._parsed: return super(DoxyIndex, self)._parse() self._root = index.parse(os.path.join(self._xml_path, 'index.xml')) for mem in self._root.compound: converted = self.convert_mem(mem) # For files we want the contents to be accessible directly # from the parent rather than having to go through the file # object. if self.get_cls(mem) == DoxyFile: if mem.name.endswith('.h'): self._members += converted.members() self._members.append(converted) else: self._members.append(converted) def generate_swig_doc_i(self): """ %feature("docstring") gr_make_align_on_samplenumbers_ss::align_state " Wraps the C++: gr_align_on_samplenumbers_ss::align_state"; """ pass class DoxyCompMem(Base): kind = None def __init__(self, *args, **kwargs): super(DoxyCompMem, self).__init__(*args, **kwargs) @classmethod def can_parse(cls, obj): return obj.kind == cls.kind def set_descriptions(self, parse_data): bd = description(getattr(parse_data, 'briefdescription', None)) dd = description(getattr(parse_data, 'detaileddescription', None)) self._data['brief_description'] = bd self._data['detailed_description'] = dd class DoxyCompound(DoxyCompMem): pass class DoxyMember(DoxyCompMem): pass class DoxyFunction(DoxyMember): __module__ = "gnuradio.utils.doxyxml" kind = 'function' def _parse(self): if self._parsed: return super(DoxyFunction, self)._parse() self.set_descriptions(self._parse_data) self._data['params'] = [] prms = self._parse_data.param for prm in prms: self._data['params'].append(DoxyParam(prm)) brief_description = property(lambda self: self.data()['brief_description']) detailed_description = property(lambda self: self.data()['detailed_description']) params = property(lambda self: self.data()['params']) Base.mem_classes.append(DoxyFunction) class DoxyParam(DoxyMember): __module__ = "gnuradio.utils.doxyxml" def _parse(self): if self._parsed: return super(DoxyParam, self)._parse() self.set_descriptions(self._parse_data) self._data['declname'] = self._parse_data.declname brief_description = property(lambda self: self.data()['brief_description']) detailed_description = property(lambda self: self.data()['detailed_description']) declname = property(lambda self: self.data()['declname']) class DoxyClass(DoxyCompound): __module__ = "gnuradio.utils.doxyxml" kind = 'class' def _parse(self): if self._parsed: return super(DoxyClass, self)._parse() self.retrieve_data() if self._error: return self.set_descriptions(self._retrieved_data.compounddef) # Sectiondef.kind tells about whether private or public. # We just ignore this for now. self.process_memberdefs() brief_description = property(lambda self: self.data()['brief_description']) detailed_description = property(lambda self: self.data()['detailed_description']) Base.mem_classes.append(DoxyClass) class DoxyFile(DoxyCompound): __module__ = "gnuradio.utils.doxyxml" kind = 'file' def _parse(self): if self._parsed: return super(DoxyFile, self)._parse() self.retrieve_data() self.set_descriptions(self._retrieved_data.compounddef) if self._error: return self.process_memberdefs() brief_description = property(lambda self: self.data()['brief_description']) detailed_description = property(lambda self: self.data()['detailed_description']) Base.mem_classes.append(DoxyFile) class DoxyNamespace(DoxyCompound): __module__ = "gnuradio.utils.doxyxml" kind = 'namespace' Base.mem_classes.append(DoxyNamespace) class DoxyGroup(DoxyCompound): __module__ = "gnuradio.utils.doxyxml" kind = 'group' def _parse(self): if self._parsed: return super(DoxyGroup, self)._parse() self.retrieve_data() if self._error: return cdef = self._retrieved_data.compounddef self._data['title'] = description(cdef.title) # Process inner groups grps = cdef.innergroup for grp in grps: converted = DoxyGroup.from_refid(grp.refid, top=self.top) self._members.append(converted) # Process inner classes klasses = cdef.innerclass for kls in klasses: converted = DoxyClass.from_refid(kls.refid, top=self.top) self._members.append(converted) # Process normal members self.process_memberdefs() title = property(lambda self: self.data()['title']) Base.mem_classes.append(DoxyGroup) class DoxyFriend(DoxyMember): __module__ = "gnuradio.utils.doxyxml" kind = 'friend' Base.mem_classes.append(DoxyFriend) class DoxyOther(Base): __module__ = "gnuradio.utils.doxyxml" kinds = set(['variable', 'struct', 'union', 'define', 'typedef', 'enum', 'dir', 'page']) @classmethod def can_parse(cls, obj): return obj.kind in cls.kinds Base.mem_classes.append(DoxyOther) gr-gsm-0.41.2/docs/doxygen/doxyxml/generated/000077500000000000000000000000001316153413000210365ustar00rootroot00000000000000gr-gsm-0.41.2/docs/doxygen/doxyxml/generated/__init__.py000066400000000000000000000003531316153413000231500ustar00rootroot00000000000000""" Contains generated files produced by generateDS.py. These do the real work of parsing the doxygen xml files but the resultant classes are not very friendly to navigate so the rest of the doxyxml module processes them further. """ gr-gsm-0.41.2/docs/doxygen/doxyxml/generated/compound.py000066400000000000000000000475101316153413000232430ustar00rootroot00000000000000#!/usr/bin/env python """ Generated Mon Feb 9 19:08:05 2009 by generateDS.py. """ from string import lower as str_lower from xml.dom import minidom from xml.dom import Node import sys import compoundsuper as supermod from compoundsuper import MixedContainer class DoxygenTypeSub(supermod.DoxygenType): def __init__(self, version=None, compounddef=None): supermod.DoxygenType.__init__(self, version, compounddef) def find(self, details): return self.compounddef.find(details) supermod.DoxygenType.subclass = DoxygenTypeSub # end class DoxygenTypeSub class compounddefTypeSub(supermod.compounddefType): def __init__(self, kind=None, prot=None, id=None, compoundname='', title='', basecompoundref=None, derivedcompoundref=None, includes=None, includedby=None, incdepgraph=None, invincdepgraph=None, innerdir=None, innerfile=None, innerclass=None, innernamespace=None, innerpage=None, innergroup=None, templateparamlist=None, sectiondef=None, briefdescription=None, detaileddescription=None, inheritancegraph=None, collaborationgraph=None, programlisting=None, location=None, listofallmembers=None): supermod.compounddefType.__init__(self, kind, prot, id, compoundname, title, basecompoundref, derivedcompoundref, includes, includedby, incdepgraph, invincdepgraph, innerdir, innerfile, innerclass, innernamespace, innerpage, innergroup, templateparamlist, sectiondef, briefdescription, detaileddescription, inheritancegraph, collaborationgraph, programlisting, location, listofallmembers) def find(self, details): if self.id == details.refid: return self for sectiondef in self.sectiondef: result = sectiondef.find(details) if result: return result supermod.compounddefType.subclass = compounddefTypeSub # end class compounddefTypeSub class listofallmembersTypeSub(supermod.listofallmembersType): def __init__(self, member=None): supermod.listofallmembersType.__init__(self, member) supermod.listofallmembersType.subclass = listofallmembersTypeSub # end class listofallmembersTypeSub class memberRefTypeSub(supermod.memberRefType): def __init__(self, virt=None, prot=None, refid=None, ambiguityscope=None, scope='', name=''): supermod.memberRefType.__init__(self, virt, prot, refid, ambiguityscope, scope, name) supermod.memberRefType.subclass = memberRefTypeSub # end class memberRefTypeSub class compoundRefTypeSub(supermod.compoundRefType): def __init__(self, virt=None, prot=None, refid=None, valueOf_='', mixedclass_=None, content_=None): supermod.compoundRefType.__init__(self, mixedclass_, content_) supermod.compoundRefType.subclass = compoundRefTypeSub # end class compoundRefTypeSub class reimplementTypeSub(supermod.reimplementType): def __init__(self, refid=None, valueOf_='', mixedclass_=None, content_=None): supermod.reimplementType.__init__(self, mixedclass_, content_) supermod.reimplementType.subclass = reimplementTypeSub # end class reimplementTypeSub class incTypeSub(supermod.incType): def __init__(self, local=None, refid=None, valueOf_='', mixedclass_=None, content_=None): supermod.incType.__init__(self, mixedclass_, content_) supermod.incType.subclass = incTypeSub # end class incTypeSub class refTypeSub(supermod.refType): def __init__(self, prot=None, refid=None, valueOf_='', mixedclass_=None, content_=None): supermod.refType.__init__(self, mixedclass_, content_) supermod.refType.subclass = refTypeSub # end class refTypeSub class refTextTypeSub(supermod.refTextType): def __init__(self, refid=None, kindref=None, external=None, valueOf_='', mixedclass_=None, content_=None): supermod.refTextType.__init__(self, mixedclass_, content_) supermod.refTextType.subclass = refTextTypeSub # end class refTextTypeSub class sectiondefTypeSub(supermod.sectiondefType): def __init__(self, kind=None, header='', description=None, memberdef=None): supermod.sectiondefType.__init__(self, kind, header, description, memberdef) def find(self, details): for memberdef in self.memberdef: if memberdef.id == details.refid: return memberdef return None supermod.sectiondefType.subclass = sectiondefTypeSub # end class sectiondefTypeSub class memberdefTypeSub(supermod.memberdefType): def __init__(self, initonly=None, kind=None, volatile=None, const=None, raise_=None, virt=None, readable=None, prot=None, explicit=None, new=None, final=None, writable=None, add=None, static=None, remove=None, sealed=None, mutable=None, gettable=None, inline=None, settable=None, id=None, templateparamlist=None, type_=None, definition='', argsstring='', name='', read='', write='', bitfield='', reimplements=None, reimplementedby=None, param=None, enumvalue=None, initializer=None, exceptions=None, briefdescription=None, detaileddescription=None, inbodydescription=None, location=None, references=None, referencedby=None): supermod.memberdefType.__init__(self, initonly, kind, volatile, const, raise_, virt, readable, prot, explicit, new, final, writable, add, static, remove, sealed, mutable, gettable, inline, settable, id, templateparamlist, type_, definition, argsstring, name, read, write, bitfield, reimplements, reimplementedby, param, enumvalue, initializer, exceptions, briefdescription, detaileddescription, inbodydescription, location, references, referencedby) supermod.memberdefType.subclass = memberdefTypeSub # end class memberdefTypeSub class descriptionTypeSub(supermod.descriptionType): def __init__(self, title='', para=None, sect1=None, internal=None, mixedclass_=None, content_=None): supermod.descriptionType.__init__(self, mixedclass_, content_) supermod.descriptionType.subclass = descriptionTypeSub # end class descriptionTypeSub class enumvalueTypeSub(supermod.enumvalueType): def __init__(self, prot=None, id=None, name='', initializer=None, briefdescription=None, detaileddescription=None, mixedclass_=None, content_=None): supermod.enumvalueType.__init__(self, mixedclass_, content_) supermod.enumvalueType.subclass = enumvalueTypeSub # end class enumvalueTypeSub class templateparamlistTypeSub(supermod.templateparamlistType): def __init__(self, param=None): supermod.templateparamlistType.__init__(self, param) supermod.templateparamlistType.subclass = templateparamlistTypeSub # end class templateparamlistTypeSub class paramTypeSub(supermod.paramType): def __init__(self, type_=None, declname='', defname='', array='', defval=None, briefdescription=None): supermod.paramType.__init__(self, type_, declname, defname, array, defval, briefdescription) supermod.paramType.subclass = paramTypeSub # end class paramTypeSub class linkedTextTypeSub(supermod.linkedTextType): def __init__(self, ref=None, mixedclass_=None, content_=None): supermod.linkedTextType.__init__(self, mixedclass_, content_) supermod.linkedTextType.subclass = linkedTextTypeSub # end class linkedTextTypeSub class graphTypeSub(supermod.graphType): def __init__(self, node=None): supermod.graphType.__init__(self, node) supermod.graphType.subclass = graphTypeSub # end class graphTypeSub class nodeTypeSub(supermod.nodeType): def __init__(self, id=None, label='', link=None, childnode=None): supermod.nodeType.__init__(self, id, label, link, childnode) supermod.nodeType.subclass = nodeTypeSub # end class nodeTypeSub class childnodeTypeSub(supermod.childnodeType): def __init__(self, relation=None, refid=None, edgelabel=None): supermod.childnodeType.__init__(self, relation, refid, edgelabel) supermod.childnodeType.subclass = childnodeTypeSub # end class childnodeTypeSub class linkTypeSub(supermod.linkType): def __init__(self, refid=None, external=None, valueOf_=''): supermod.linkType.__init__(self, refid, external) supermod.linkType.subclass = linkTypeSub # end class linkTypeSub class listingTypeSub(supermod.listingType): def __init__(self, codeline=None): supermod.listingType.__init__(self, codeline) supermod.listingType.subclass = listingTypeSub # end class listingTypeSub class codelineTypeSub(supermod.codelineType): def __init__(self, external=None, lineno=None, refkind=None, refid=None, highlight=None): supermod.codelineType.__init__(self, external, lineno, refkind, refid, highlight) supermod.codelineType.subclass = codelineTypeSub # end class codelineTypeSub class highlightTypeSub(supermod.highlightType): def __init__(self, class_=None, sp=None, ref=None, mixedclass_=None, content_=None): supermod.highlightType.__init__(self, mixedclass_, content_) supermod.highlightType.subclass = highlightTypeSub # end class highlightTypeSub class referenceTypeSub(supermod.referenceType): def __init__(self, endline=None, startline=None, refid=None, compoundref=None, valueOf_='', mixedclass_=None, content_=None): supermod.referenceType.__init__(self, mixedclass_, content_) supermod.referenceType.subclass = referenceTypeSub # end class referenceTypeSub class locationTypeSub(supermod.locationType): def __init__(self, bodystart=None, line=None, bodyend=None, bodyfile=None, file=None, valueOf_=''): supermod.locationType.__init__(self, bodystart, line, bodyend, bodyfile, file) supermod.locationType.subclass = locationTypeSub # end class locationTypeSub class docSect1TypeSub(supermod.docSect1Type): def __init__(self, id=None, title='', para=None, sect2=None, internal=None, mixedclass_=None, content_=None): supermod.docSect1Type.__init__(self, mixedclass_, content_) supermod.docSect1Type.subclass = docSect1TypeSub # end class docSect1TypeSub class docSect2TypeSub(supermod.docSect2Type): def __init__(self, id=None, title='', para=None, sect3=None, internal=None, mixedclass_=None, content_=None): supermod.docSect2Type.__init__(self, mixedclass_, content_) supermod.docSect2Type.subclass = docSect2TypeSub # end class docSect2TypeSub class docSect3TypeSub(supermod.docSect3Type): def __init__(self, id=None, title='', para=None, sect4=None, internal=None, mixedclass_=None, content_=None): supermod.docSect3Type.__init__(self, mixedclass_, content_) supermod.docSect3Type.subclass = docSect3TypeSub # end class docSect3TypeSub class docSect4TypeSub(supermod.docSect4Type): def __init__(self, id=None, title='', para=None, internal=None, mixedclass_=None, content_=None): supermod.docSect4Type.__init__(self, mixedclass_, content_) supermod.docSect4Type.subclass = docSect4TypeSub # end class docSect4TypeSub class docInternalTypeSub(supermod.docInternalType): def __init__(self, para=None, sect1=None, mixedclass_=None, content_=None): supermod.docInternalType.__init__(self, mixedclass_, content_) supermod.docInternalType.subclass = docInternalTypeSub # end class docInternalTypeSub class docInternalS1TypeSub(supermod.docInternalS1Type): def __init__(self, para=None, sect2=None, mixedclass_=None, content_=None): supermod.docInternalS1Type.__init__(self, mixedclass_, content_) supermod.docInternalS1Type.subclass = docInternalS1TypeSub # end class docInternalS1TypeSub class docInternalS2TypeSub(supermod.docInternalS2Type): def __init__(self, para=None, sect3=None, mixedclass_=None, content_=None): supermod.docInternalS2Type.__init__(self, mixedclass_, content_) supermod.docInternalS2Type.subclass = docInternalS2TypeSub # end class docInternalS2TypeSub class docInternalS3TypeSub(supermod.docInternalS3Type): def __init__(self, para=None, sect3=None, mixedclass_=None, content_=None): supermod.docInternalS3Type.__init__(self, mixedclass_, content_) supermod.docInternalS3Type.subclass = docInternalS3TypeSub # end class docInternalS3TypeSub class docInternalS4TypeSub(supermod.docInternalS4Type): def __init__(self, para=None, mixedclass_=None, content_=None): supermod.docInternalS4Type.__init__(self, mixedclass_, content_) supermod.docInternalS4Type.subclass = docInternalS4TypeSub # end class docInternalS4TypeSub class docURLLinkSub(supermod.docURLLink): def __init__(self, url=None, valueOf_='', mixedclass_=None, content_=None): supermod.docURLLink.__init__(self, mixedclass_, content_) supermod.docURLLink.subclass = docURLLinkSub # end class docURLLinkSub class docAnchorTypeSub(supermod.docAnchorType): def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None): supermod.docAnchorType.__init__(self, mixedclass_, content_) supermod.docAnchorType.subclass = docAnchorTypeSub # end class docAnchorTypeSub class docFormulaTypeSub(supermod.docFormulaType): def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None): supermod.docFormulaType.__init__(self, mixedclass_, content_) supermod.docFormulaType.subclass = docFormulaTypeSub # end class docFormulaTypeSub class docIndexEntryTypeSub(supermod.docIndexEntryType): def __init__(self, primaryie='', secondaryie=''): supermod.docIndexEntryType.__init__(self, primaryie, secondaryie) supermod.docIndexEntryType.subclass = docIndexEntryTypeSub # end class docIndexEntryTypeSub class docListTypeSub(supermod.docListType): def __init__(self, listitem=None): supermod.docListType.__init__(self, listitem) supermod.docListType.subclass = docListTypeSub # end class docListTypeSub class docListItemTypeSub(supermod.docListItemType): def __init__(self, para=None): supermod.docListItemType.__init__(self, para) supermod.docListItemType.subclass = docListItemTypeSub # end class docListItemTypeSub class docSimpleSectTypeSub(supermod.docSimpleSectType): def __init__(self, kind=None, title=None, para=None): supermod.docSimpleSectType.__init__(self, kind, title, para) supermod.docSimpleSectType.subclass = docSimpleSectTypeSub # end class docSimpleSectTypeSub class docVarListEntryTypeSub(supermod.docVarListEntryType): def __init__(self, term=None): supermod.docVarListEntryType.__init__(self, term) supermod.docVarListEntryType.subclass = docVarListEntryTypeSub # end class docVarListEntryTypeSub class docRefTextTypeSub(supermod.docRefTextType): def __init__(self, refid=None, kindref=None, external=None, valueOf_='', mixedclass_=None, content_=None): supermod.docRefTextType.__init__(self, mixedclass_, content_) supermod.docRefTextType.subclass = docRefTextTypeSub # end class docRefTextTypeSub class docTableTypeSub(supermod.docTableType): def __init__(self, rows=None, cols=None, row=None, caption=None): supermod.docTableType.__init__(self, rows, cols, row, caption) supermod.docTableType.subclass = docTableTypeSub # end class docTableTypeSub class docRowTypeSub(supermod.docRowType): def __init__(self, entry=None): supermod.docRowType.__init__(self, entry) supermod.docRowType.subclass = docRowTypeSub # end class docRowTypeSub class docEntryTypeSub(supermod.docEntryType): def __init__(self, thead=None, para=None): supermod.docEntryType.__init__(self, thead, para) supermod.docEntryType.subclass = docEntryTypeSub # end class docEntryTypeSub class docHeadingTypeSub(supermod.docHeadingType): def __init__(self, level=None, valueOf_='', mixedclass_=None, content_=None): supermod.docHeadingType.__init__(self, mixedclass_, content_) supermod.docHeadingType.subclass = docHeadingTypeSub # end class docHeadingTypeSub class docImageTypeSub(supermod.docImageType): def __init__(self, width=None, type_=None, name=None, height=None, valueOf_='', mixedclass_=None, content_=None): supermod.docImageType.__init__(self, mixedclass_, content_) supermod.docImageType.subclass = docImageTypeSub # end class docImageTypeSub class docDotFileTypeSub(supermod.docDotFileType): def __init__(self, name=None, valueOf_='', mixedclass_=None, content_=None): supermod.docDotFileType.__init__(self, mixedclass_, content_) supermod.docDotFileType.subclass = docDotFileTypeSub # end class docDotFileTypeSub class docTocItemTypeSub(supermod.docTocItemType): def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None): supermod.docTocItemType.__init__(self, mixedclass_, content_) supermod.docTocItemType.subclass = docTocItemTypeSub # end class docTocItemTypeSub class docTocListTypeSub(supermod.docTocListType): def __init__(self, tocitem=None): supermod.docTocListType.__init__(self, tocitem) supermod.docTocListType.subclass = docTocListTypeSub # end class docTocListTypeSub class docLanguageTypeSub(supermod.docLanguageType): def __init__(self, langid=None, para=None): supermod.docLanguageType.__init__(self, langid, para) supermod.docLanguageType.subclass = docLanguageTypeSub # end class docLanguageTypeSub class docParamListTypeSub(supermod.docParamListType): def __init__(self, kind=None, parameteritem=None): supermod.docParamListType.__init__(self, kind, parameteritem) supermod.docParamListType.subclass = docParamListTypeSub # end class docParamListTypeSub class docParamListItemSub(supermod.docParamListItem): def __init__(self, parameternamelist=None, parameterdescription=None): supermod.docParamListItem.__init__(self, parameternamelist, parameterdescription) supermod.docParamListItem.subclass = docParamListItemSub # end class docParamListItemSub class docParamNameListSub(supermod.docParamNameList): def __init__(self, parametername=None): supermod.docParamNameList.__init__(self, parametername) supermod.docParamNameList.subclass = docParamNameListSub # end class docParamNameListSub class docParamNameSub(supermod.docParamName): def __init__(self, direction=None, ref=None, mixedclass_=None, content_=None): supermod.docParamName.__init__(self, mixedclass_, content_) supermod.docParamName.subclass = docParamNameSub # end class docParamNameSub class docXRefSectTypeSub(supermod.docXRefSectType): def __init__(self, id=None, xreftitle=None, xrefdescription=None): supermod.docXRefSectType.__init__(self, id, xreftitle, xrefdescription) supermod.docXRefSectType.subclass = docXRefSectTypeSub # end class docXRefSectTypeSub class docCopyTypeSub(supermod.docCopyType): def __init__(self, link=None, para=None, sect1=None, internal=None): supermod.docCopyType.__init__(self, link, para, sect1, internal) supermod.docCopyType.subclass = docCopyTypeSub # end class docCopyTypeSub class docCharTypeSub(supermod.docCharType): def __init__(self, char=None, valueOf_=''): supermod.docCharType.__init__(self, char) supermod.docCharType.subclass = docCharTypeSub # end class docCharTypeSub class docParaTypeSub(supermod.docParaType): def __init__(self, char=None, valueOf_=''): supermod.docParaType.__init__(self, char) self.parameterlist = [] self.simplesects = [] self.content = [] def buildChildren(self, child_, nodeName_): supermod.docParaType.buildChildren(self, child_, nodeName_) if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == "ref": obj_ = supermod.docRefTextType.factory() obj_.build(child_) self.content.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'parameterlist': obj_ = supermod.docParamListType.factory() obj_.build(child_) self.parameterlist.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'simplesect': obj_ = supermod.docSimpleSectType.factory() obj_.build(child_) self.simplesects.append(obj_) supermod.docParaType.subclass = docParaTypeSub # end class docParaTypeSub def parse(inFilename): doc = minidom.parse(inFilename) rootNode = doc.documentElement rootObj = supermod.DoxygenType.factory() rootObj.build(rootNode) return rootObj gr-gsm-0.41.2/docs/doxygen/doxyxml/generated/compoundsuper.py000066400000000000000000012770141316153413000243270ustar00rootroot00000000000000#!/usr/bin/env python # # Generated Thu Jun 11 18:44:25 2009 by generateDS.py. # import sys import getopt from string import lower as str_lower from xml.dom import minidom from xml.dom import Node # # User methods # # Calls to the methods in these classes are generated by generateDS.py. # You can replace these methods by re-implementing the following class # in a module named generatedssuper.py. try: from generatedssuper import GeneratedsSuper except ImportError, exp: class GeneratedsSuper: def format_string(self, input_data, input_name=''): return input_data def format_integer(self, input_data, input_name=''): return '%d' % input_data def format_float(self, input_data, input_name=''): return '%f' % input_data def format_double(self, input_data, input_name=''): return '%e' % input_data def format_boolean(self, input_data, input_name=''): return '%s' % input_data # # If you have installed IPython you can uncomment and use the following. # IPython is available from http://ipython.scipy.org/. # ## from IPython.Shell import IPShellEmbed ## args = '' ## ipshell = IPShellEmbed(args, ## banner = 'Dropping into IPython', ## exit_msg = 'Leaving Interpreter, back to program.') # Then use the following line where and when you want to drop into the # IPython shell: # ipshell(' -- Entering ipshell.\nHit Ctrl-D to exit') # # Globals # ExternalEncoding = 'ascii' # # Support/utility functions. # def showIndent(outfile, level): for idx in range(level): outfile.write(' ') def quote_xml(inStr): s1 = (isinstance(inStr, basestring) and inStr or '%s' % inStr) s1 = s1.replace('&', '&') s1 = s1.replace('<', '<') s1 = s1.replace('>', '>') return s1 def quote_attrib(inStr): s1 = (isinstance(inStr, basestring) and inStr or '%s' % inStr) s1 = s1.replace('&', '&') s1 = s1.replace('<', '<') s1 = s1.replace('>', '>') if '"' in s1: if "'" in s1: s1 = '"%s"' % s1.replace('"', """) else: s1 = "'%s'" % s1 else: s1 = '"%s"' % s1 return s1 def quote_python(inStr): s1 = inStr if s1.find("'") == -1: if s1.find('\n') == -1: return "'%s'" % s1 else: return "'''%s'''" % s1 else: if s1.find('"') != -1: s1 = s1.replace('"', '\\"') if s1.find('\n') == -1: return '"%s"' % s1 else: return '"""%s"""' % s1 class MixedContainer: # Constants for category: CategoryNone = 0 CategoryText = 1 CategorySimple = 2 CategoryComplex = 3 # Constants for content_type: TypeNone = 0 TypeText = 1 TypeString = 2 TypeInteger = 3 TypeFloat = 4 TypeDecimal = 5 TypeDouble = 6 TypeBoolean = 7 def __init__(self, category, content_type, name, value): self.category = category self.content_type = content_type self.name = name self.value = value def getCategory(self): return self.category def getContenttype(self, content_type): return self.content_type def getValue(self): return self.value def getName(self): return self.name def export(self, outfile, level, name, namespace): if self.category == MixedContainer.CategoryText: outfile.write(self.value) elif self.category == MixedContainer.CategorySimple: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export(outfile, level, namespace,name) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s' % (self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeInteger or \ self.content_type == MixedContainer.TypeBoolean: outfile.write('<%s>%d' % (self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeFloat or \ self.content_type == MixedContainer.TypeDecimal: outfile.write('<%s>%f' % (self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeDouble: outfile.write('<%s>%g' % (self.name, self.value, self.name)) def exportLiteral(self, outfile, level, name): if self.category == MixedContainer.CategoryText: showIndent(outfile, level) outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' % \ (self.category, self.content_type, self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' % \ (self.category, self.content_type, self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write('MixedContainer(%d, %d, "%s",\n' % \ (self.category, self.content_type, self.name,)) self.value.exportLiteral(outfile, level + 1) showIndent(outfile, level) outfile.write(')\n') class _MemberSpec(object): def __init__(self, name='', data_type='', container=0): self.name = name self.data_type = data_type self.container = container def set_name(self, name): self.name = name def get_name(self): return self.name def set_data_type(self, data_type): self.data_type = data_type def get_data_type(self): return self.data_type def set_container(self, container): self.container = container def get_container(self): return self.container # # Data representation classes. # class DoxygenType(GeneratedsSuper): subclass = None superclass = None def __init__(self, version=None, compounddef=None): self.version = version self.compounddef = compounddef def factory(*args_, **kwargs_): if DoxygenType.subclass: return DoxygenType.subclass(*args_, **kwargs_) else: return DoxygenType(*args_, **kwargs_) factory = staticmethod(factory) def get_compounddef(self): return self.compounddef def set_compounddef(self, compounddef): self.compounddef = compounddef def get_version(self): return self.version def set_version(self, version): self.version = version def export(self, outfile, level, namespace_='', name_='DoxygenType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='DoxygenType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='DoxygenType'): outfile.write(' version=%s' % (quote_attrib(self.version), )) def exportChildren(self, outfile, level, namespace_='', name_='DoxygenType'): if self.compounddef: self.compounddef.export(outfile, level, namespace_, name_='compounddef') def hasContent_(self): if ( self.compounddef is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='DoxygenType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.version is not None: showIndent(outfile, level) outfile.write('version = "%s",\n' % (self.version,)) def exportLiteralChildren(self, outfile, level, name_): if self.compounddef: showIndent(outfile, level) outfile.write('compounddef=model_.compounddefType(\n') self.compounddef.exportLiteral(outfile, level, name_='compounddef') showIndent(outfile, level) outfile.write('),\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('version'): self.version = attrs.get('version').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'compounddef': obj_ = compounddefType.factory() obj_.build(child_) self.set_compounddef(obj_) # end class DoxygenType class compounddefType(GeneratedsSuper): subclass = None superclass = None def __init__(self, kind=None, prot=None, id=None, compoundname=None, title=None, basecompoundref=None, derivedcompoundref=None, includes=None, includedby=None, incdepgraph=None, invincdepgraph=None, innerdir=None, innerfile=None, innerclass=None, innernamespace=None, innerpage=None, innergroup=None, templateparamlist=None, sectiondef=None, briefdescription=None, detaileddescription=None, inheritancegraph=None, collaborationgraph=None, programlisting=None, location=None, listofallmembers=None): self.kind = kind self.prot = prot self.id = id self.compoundname = compoundname self.title = title if basecompoundref is None: self.basecompoundref = [] else: self.basecompoundref = basecompoundref if derivedcompoundref is None: self.derivedcompoundref = [] else: self.derivedcompoundref = derivedcompoundref if includes is None: self.includes = [] else: self.includes = includes if includedby is None: self.includedby = [] else: self.includedby = includedby self.incdepgraph = incdepgraph self.invincdepgraph = invincdepgraph if innerdir is None: self.innerdir = [] else: self.innerdir = innerdir if innerfile is None: self.innerfile = [] else: self.innerfile = innerfile if innerclass is None: self.innerclass = [] else: self.innerclass = innerclass if innernamespace is None: self.innernamespace = [] else: self.innernamespace = innernamespace if innerpage is None: self.innerpage = [] else: self.innerpage = innerpage if innergroup is None: self.innergroup = [] else: self.innergroup = innergroup self.templateparamlist = templateparamlist if sectiondef is None: self.sectiondef = [] else: self.sectiondef = sectiondef self.briefdescription = briefdescription self.detaileddescription = detaileddescription self.inheritancegraph = inheritancegraph self.collaborationgraph = collaborationgraph self.programlisting = programlisting self.location = location self.listofallmembers = listofallmembers def factory(*args_, **kwargs_): if compounddefType.subclass: return compounddefType.subclass(*args_, **kwargs_) else: return compounddefType(*args_, **kwargs_) factory = staticmethod(factory) def get_compoundname(self): return self.compoundname def set_compoundname(self, compoundname): self.compoundname = compoundname def get_title(self): return self.title def set_title(self, title): self.title = title def get_basecompoundref(self): return self.basecompoundref def set_basecompoundref(self, basecompoundref): self.basecompoundref = basecompoundref def add_basecompoundref(self, value): self.basecompoundref.append(value) def insert_basecompoundref(self, index, value): self.basecompoundref[index] = value def get_derivedcompoundref(self): return self.derivedcompoundref def set_derivedcompoundref(self, derivedcompoundref): self.derivedcompoundref = derivedcompoundref def add_derivedcompoundref(self, value): self.derivedcompoundref.append(value) def insert_derivedcompoundref(self, index, value): self.derivedcompoundref[index] = value def get_includes(self): return self.includes def set_includes(self, includes): self.includes = includes def add_includes(self, value): self.includes.append(value) def insert_includes(self, index, value): self.includes[index] = value def get_includedby(self): return self.includedby def set_includedby(self, includedby): self.includedby = includedby def add_includedby(self, value): self.includedby.append(value) def insert_includedby(self, index, value): self.includedby[index] = value def get_incdepgraph(self): return self.incdepgraph def set_incdepgraph(self, incdepgraph): self.incdepgraph = incdepgraph def get_invincdepgraph(self): return self.invincdepgraph def set_invincdepgraph(self, invincdepgraph): self.invincdepgraph = invincdepgraph def get_innerdir(self): return self.innerdir def set_innerdir(self, innerdir): self.innerdir = innerdir def add_innerdir(self, value): self.innerdir.append(value) def insert_innerdir(self, index, value): self.innerdir[index] = value def get_innerfile(self): return self.innerfile def set_innerfile(self, innerfile): self.innerfile = innerfile def add_innerfile(self, value): self.innerfile.append(value) def insert_innerfile(self, index, value): self.innerfile[index] = value def get_innerclass(self): return self.innerclass def set_innerclass(self, innerclass): self.innerclass = innerclass def add_innerclass(self, value): self.innerclass.append(value) def insert_innerclass(self, index, value): self.innerclass[index] = value def get_innernamespace(self): return self.innernamespace def set_innernamespace(self, innernamespace): self.innernamespace = innernamespace def add_innernamespace(self, value): self.innernamespace.append(value) def insert_innernamespace(self, index, value): self.innernamespace[index] = value def get_innerpage(self): return self.innerpage def set_innerpage(self, innerpage): self.innerpage = innerpage def add_innerpage(self, value): self.innerpage.append(value) def insert_innerpage(self, index, value): self.innerpage[index] = value def get_innergroup(self): return self.innergroup def set_innergroup(self, innergroup): self.innergroup = innergroup def add_innergroup(self, value): self.innergroup.append(value) def insert_innergroup(self, index, value): self.innergroup[index] = value def get_templateparamlist(self): return self.templateparamlist def set_templateparamlist(self, templateparamlist): self.templateparamlist = templateparamlist def get_sectiondef(self): return self.sectiondef def set_sectiondef(self, sectiondef): self.sectiondef = sectiondef def add_sectiondef(self, value): self.sectiondef.append(value) def insert_sectiondef(self, index, value): self.sectiondef[index] = value def get_briefdescription(self): return self.briefdescription def set_briefdescription(self, briefdescription): self.briefdescription = briefdescription def get_detaileddescription(self): return self.detaileddescription def set_detaileddescription(self, detaileddescription): self.detaileddescription = detaileddescription def get_inheritancegraph(self): return self.inheritancegraph def set_inheritancegraph(self, inheritancegraph): self.inheritancegraph = inheritancegraph def get_collaborationgraph(self): return self.collaborationgraph def set_collaborationgraph(self, collaborationgraph): self.collaborationgraph = collaborationgraph def get_programlisting(self): return self.programlisting def set_programlisting(self, programlisting): self.programlisting = programlisting def get_location(self): return self.location def set_location(self, location): self.location = location def get_listofallmembers(self): return self.listofallmembers def set_listofallmembers(self, listofallmembers): self.listofallmembers = listofallmembers def get_kind(self): return self.kind def set_kind(self, kind): self.kind = kind def get_prot(self): return self.prot def set_prot(self, prot): self.prot = prot def get_id(self): return self.id def set_id(self, id): self.id = id def export(self, outfile, level, namespace_='', name_='compounddefType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='compounddefType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='compounddefType'): if self.kind is not None: outfile.write(' kind=%s' % (quote_attrib(self.kind), )) if self.prot is not None: outfile.write(' prot=%s' % (quote_attrib(self.prot), )) if self.id is not None: outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) def exportChildren(self, outfile, level, namespace_='', name_='compounddefType'): if self.compoundname is not None: showIndent(outfile, level) outfile.write('<%scompoundname>%s\n' % (namespace_, self.format_string(quote_xml(self.compoundname).encode(ExternalEncoding), input_name='compoundname'), namespace_)) if self.title is not None: showIndent(outfile, level) outfile.write('<%stitle>%s\n' % (namespace_, self.format_string(quote_xml(self.title).encode(ExternalEncoding), input_name='title'), namespace_)) for basecompoundref_ in self.basecompoundref: basecompoundref_.export(outfile, level, namespace_, name_='basecompoundref') for derivedcompoundref_ in self.derivedcompoundref: derivedcompoundref_.export(outfile, level, namespace_, name_='derivedcompoundref') for includes_ in self.includes: includes_.export(outfile, level, namespace_, name_='includes') for includedby_ in self.includedby: includedby_.export(outfile, level, namespace_, name_='includedby') if self.incdepgraph: self.incdepgraph.export(outfile, level, namespace_, name_='incdepgraph') if self.invincdepgraph: self.invincdepgraph.export(outfile, level, namespace_, name_='invincdepgraph') for innerdir_ in self.innerdir: innerdir_.export(outfile, level, namespace_, name_='innerdir') for innerfile_ in self.innerfile: innerfile_.export(outfile, level, namespace_, name_='innerfile') for innerclass_ in self.innerclass: innerclass_.export(outfile, level, namespace_, name_='innerclass') for innernamespace_ in self.innernamespace: innernamespace_.export(outfile, level, namespace_, name_='innernamespace') for innerpage_ in self.innerpage: innerpage_.export(outfile, level, namespace_, name_='innerpage') for innergroup_ in self.innergroup: innergroup_.export(outfile, level, namespace_, name_='innergroup') if self.templateparamlist: self.templateparamlist.export(outfile, level, namespace_, name_='templateparamlist') for sectiondef_ in self.sectiondef: sectiondef_.export(outfile, level, namespace_, name_='sectiondef') if self.briefdescription: self.briefdescription.export(outfile, level, namespace_, name_='briefdescription') if self.detaileddescription: self.detaileddescription.export(outfile, level, namespace_, name_='detaileddescription') if self.inheritancegraph: self.inheritancegraph.export(outfile, level, namespace_, name_='inheritancegraph') if self.collaborationgraph: self.collaborationgraph.export(outfile, level, namespace_, name_='collaborationgraph') if self.programlisting: self.programlisting.export(outfile, level, namespace_, name_='programlisting') if self.location: self.location.export(outfile, level, namespace_, name_='location') if self.listofallmembers: self.listofallmembers.export(outfile, level, namespace_, name_='listofallmembers') def hasContent_(self): if ( self.compoundname is not None or self.title is not None or self.basecompoundref is not None or self.derivedcompoundref is not None or self.includes is not None or self.includedby is not None or self.incdepgraph is not None or self.invincdepgraph is not None or self.innerdir is not None or self.innerfile is not None or self.innerclass is not None or self.innernamespace is not None or self.innerpage is not None or self.innergroup is not None or self.templateparamlist is not None or self.sectiondef is not None or self.briefdescription is not None or self.detaileddescription is not None or self.inheritancegraph is not None or self.collaborationgraph is not None or self.programlisting is not None or self.location is not None or self.listofallmembers is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='compounddefType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.kind is not None: showIndent(outfile, level) outfile.write('kind = "%s",\n' % (self.kind,)) if self.prot is not None: showIndent(outfile, level) outfile.write('prot = "%s",\n' % (self.prot,)) if self.id is not None: showIndent(outfile, level) outfile.write('id = %s,\n' % (self.id,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('compoundname=%s,\n' % quote_python(self.compoundname).encode(ExternalEncoding)) if self.title: showIndent(outfile, level) outfile.write('title=model_.xsd_string(\n') self.title.exportLiteral(outfile, level, name_='title') showIndent(outfile, level) outfile.write('),\n') showIndent(outfile, level) outfile.write('basecompoundref=[\n') level += 1 for basecompoundref in self.basecompoundref: showIndent(outfile, level) outfile.write('model_.basecompoundref(\n') basecompoundref.exportLiteral(outfile, level, name_='basecompoundref') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('derivedcompoundref=[\n') level += 1 for derivedcompoundref in self.derivedcompoundref: showIndent(outfile, level) outfile.write('model_.derivedcompoundref(\n') derivedcompoundref.exportLiteral(outfile, level, name_='derivedcompoundref') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('includes=[\n') level += 1 for includes in self.includes: showIndent(outfile, level) outfile.write('model_.includes(\n') includes.exportLiteral(outfile, level, name_='includes') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('includedby=[\n') level += 1 for includedby in self.includedby: showIndent(outfile, level) outfile.write('model_.includedby(\n') includedby.exportLiteral(outfile, level, name_='includedby') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') if self.incdepgraph: showIndent(outfile, level) outfile.write('incdepgraph=model_.graphType(\n') self.incdepgraph.exportLiteral(outfile, level, name_='incdepgraph') showIndent(outfile, level) outfile.write('),\n') if self.invincdepgraph: showIndent(outfile, level) outfile.write('invincdepgraph=model_.graphType(\n') self.invincdepgraph.exportLiteral(outfile, level, name_='invincdepgraph') showIndent(outfile, level) outfile.write('),\n') showIndent(outfile, level) outfile.write('innerdir=[\n') level += 1 for innerdir in self.innerdir: showIndent(outfile, level) outfile.write('model_.innerdir(\n') innerdir.exportLiteral(outfile, level, name_='innerdir') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('innerfile=[\n') level += 1 for innerfile in self.innerfile: showIndent(outfile, level) outfile.write('model_.innerfile(\n') innerfile.exportLiteral(outfile, level, name_='innerfile') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('innerclass=[\n') level += 1 for innerclass in self.innerclass: showIndent(outfile, level) outfile.write('model_.innerclass(\n') innerclass.exportLiteral(outfile, level, name_='innerclass') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('innernamespace=[\n') level += 1 for innernamespace in self.innernamespace: showIndent(outfile, level) outfile.write('model_.innernamespace(\n') innernamespace.exportLiteral(outfile, level, name_='innernamespace') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('innerpage=[\n') level += 1 for innerpage in self.innerpage: showIndent(outfile, level) outfile.write('model_.innerpage(\n') innerpage.exportLiteral(outfile, level, name_='innerpage') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('innergroup=[\n') level += 1 for innergroup in self.innergroup: showIndent(outfile, level) outfile.write('model_.innergroup(\n') innergroup.exportLiteral(outfile, level, name_='innergroup') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') if self.templateparamlist: showIndent(outfile, level) outfile.write('templateparamlist=model_.templateparamlistType(\n') self.templateparamlist.exportLiteral(outfile, level, name_='templateparamlist') showIndent(outfile, level) outfile.write('),\n') showIndent(outfile, level) outfile.write('sectiondef=[\n') level += 1 for sectiondef in self.sectiondef: showIndent(outfile, level) outfile.write('model_.sectiondef(\n') sectiondef.exportLiteral(outfile, level, name_='sectiondef') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') if self.briefdescription: showIndent(outfile, level) outfile.write('briefdescription=model_.descriptionType(\n') self.briefdescription.exportLiteral(outfile, level, name_='briefdescription') showIndent(outfile, level) outfile.write('),\n') if self.detaileddescription: showIndent(outfile, level) outfile.write('detaileddescription=model_.descriptionType(\n') self.detaileddescription.exportLiteral(outfile, level, name_='detaileddescription') showIndent(outfile, level) outfile.write('),\n') if self.inheritancegraph: showIndent(outfile, level) outfile.write('inheritancegraph=model_.graphType(\n') self.inheritancegraph.exportLiteral(outfile, level, name_='inheritancegraph') showIndent(outfile, level) outfile.write('),\n') if self.collaborationgraph: showIndent(outfile, level) outfile.write('collaborationgraph=model_.graphType(\n') self.collaborationgraph.exportLiteral(outfile, level, name_='collaborationgraph') showIndent(outfile, level) outfile.write('),\n') if self.programlisting: showIndent(outfile, level) outfile.write('programlisting=model_.listingType(\n') self.programlisting.exportLiteral(outfile, level, name_='programlisting') showIndent(outfile, level) outfile.write('),\n') if self.location: showIndent(outfile, level) outfile.write('location=model_.locationType(\n') self.location.exportLiteral(outfile, level, name_='location') showIndent(outfile, level) outfile.write('),\n') if self.listofallmembers: showIndent(outfile, level) outfile.write('listofallmembers=model_.listofallmembersType(\n') self.listofallmembers.exportLiteral(outfile, level, name_='listofallmembers') showIndent(outfile, level) outfile.write('),\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('kind'): self.kind = attrs.get('kind').value if attrs.get('prot'): self.prot = attrs.get('prot').value if attrs.get('id'): self.id = attrs.get('id').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'compoundname': compoundname_ = '' for text__content_ in child_.childNodes: compoundname_ += text__content_.nodeValue self.compoundname = compoundname_ elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'title': obj_ = docTitleType.factory() obj_.build(child_) self.set_title(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'basecompoundref': obj_ = compoundRefType.factory() obj_.build(child_) self.basecompoundref.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'derivedcompoundref': obj_ = compoundRefType.factory() obj_.build(child_) self.derivedcompoundref.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'includes': obj_ = incType.factory() obj_.build(child_) self.includes.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'includedby': obj_ = incType.factory() obj_.build(child_) self.includedby.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'incdepgraph': obj_ = graphType.factory() obj_.build(child_) self.set_incdepgraph(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'invincdepgraph': obj_ = graphType.factory() obj_.build(child_) self.set_invincdepgraph(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'innerdir': obj_ = refType.factory() obj_.build(child_) self.innerdir.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'innerfile': obj_ = refType.factory() obj_.build(child_) self.innerfile.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'innerclass': obj_ = refType.factory() obj_.build(child_) self.innerclass.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'innernamespace': obj_ = refType.factory() obj_.build(child_) self.innernamespace.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'innerpage': obj_ = refType.factory() obj_.build(child_) self.innerpage.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'innergroup': obj_ = refType.factory() obj_.build(child_) self.innergroup.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'templateparamlist': obj_ = templateparamlistType.factory() obj_.build(child_) self.set_templateparamlist(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'sectiondef': obj_ = sectiondefType.factory() obj_.build(child_) self.sectiondef.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'briefdescription': obj_ = descriptionType.factory() obj_.build(child_) self.set_briefdescription(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'detaileddescription': obj_ = descriptionType.factory() obj_.build(child_) self.set_detaileddescription(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'inheritancegraph': obj_ = graphType.factory() obj_.build(child_) self.set_inheritancegraph(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'collaborationgraph': obj_ = graphType.factory() obj_.build(child_) self.set_collaborationgraph(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'programlisting': obj_ = listingType.factory() obj_.build(child_) self.set_programlisting(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'location': obj_ = locationType.factory() obj_.build(child_) self.set_location(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'listofallmembers': obj_ = listofallmembersType.factory() obj_.build(child_) self.set_listofallmembers(obj_) # end class compounddefType class listofallmembersType(GeneratedsSuper): subclass = None superclass = None def __init__(self, member=None): if member is None: self.member = [] else: self.member = member def factory(*args_, **kwargs_): if listofallmembersType.subclass: return listofallmembersType.subclass(*args_, **kwargs_) else: return listofallmembersType(*args_, **kwargs_) factory = staticmethod(factory) def get_member(self): return self.member def set_member(self, member): self.member = member def add_member(self, value): self.member.append(value) def insert_member(self, index, value): self.member[index] = value def export(self, outfile, level, namespace_='', name_='listofallmembersType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='listofallmembersType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='listofallmembersType'): pass def exportChildren(self, outfile, level, namespace_='', name_='listofallmembersType'): for member_ in self.member: member_.export(outfile, level, namespace_, name_='member') def hasContent_(self): if ( self.member is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='listofallmembersType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('member=[\n') level += 1 for member in self.member: showIndent(outfile, level) outfile.write('model_.member(\n') member.exportLiteral(outfile, level, name_='member') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'member': obj_ = memberRefType.factory() obj_.build(child_) self.member.append(obj_) # end class listofallmembersType class memberRefType(GeneratedsSuper): subclass = None superclass = None def __init__(self, virt=None, prot=None, refid=None, ambiguityscope=None, scope=None, name=None): self.virt = virt self.prot = prot self.refid = refid self.ambiguityscope = ambiguityscope self.scope = scope self.name = name def factory(*args_, **kwargs_): if memberRefType.subclass: return memberRefType.subclass(*args_, **kwargs_) else: return memberRefType(*args_, **kwargs_) factory = staticmethod(factory) def get_scope(self): return self.scope def set_scope(self, scope): self.scope = scope def get_name(self): return self.name def set_name(self, name): self.name = name def get_virt(self): return self.virt def set_virt(self, virt): self.virt = virt def get_prot(self): return self.prot def set_prot(self, prot): self.prot = prot def get_refid(self): return self.refid def set_refid(self, refid): self.refid = refid def get_ambiguityscope(self): return self.ambiguityscope def set_ambiguityscope(self, ambiguityscope): self.ambiguityscope = ambiguityscope def export(self, outfile, level, namespace_='', name_='memberRefType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='memberRefType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='memberRefType'): if self.virt is not None: outfile.write(' virt=%s' % (quote_attrib(self.virt), )) if self.prot is not None: outfile.write(' prot=%s' % (quote_attrib(self.prot), )) if self.refid is not None: outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), )) if self.ambiguityscope is not None: outfile.write(' ambiguityscope=%s' % (self.format_string(quote_attrib(self.ambiguityscope).encode(ExternalEncoding), input_name='ambiguityscope'), )) def exportChildren(self, outfile, level, namespace_='', name_='memberRefType'): if self.scope is not None: showIndent(outfile, level) outfile.write('<%sscope>%s\n' % (namespace_, self.format_string(quote_xml(self.scope).encode(ExternalEncoding), input_name='scope'), namespace_)) if self.name is not None: showIndent(outfile, level) outfile.write('<%sname>%s\n' % (namespace_, self.format_string(quote_xml(self.name).encode(ExternalEncoding), input_name='name'), namespace_)) def hasContent_(self): if ( self.scope is not None or self.name is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='memberRefType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.virt is not None: showIndent(outfile, level) outfile.write('virt = "%s",\n' % (self.virt,)) if self.prot is not None: showIndent(outfile, level) outfile.write('prot = "%s",\n' % (self.prot,)) if self.refid is not None: showIndent(outfile, level) outfile.write('refid = %s,\n' % (self.refid,)) if self.ambiguityscope is not None: showIndent(outfile, level) outfile.write('ambiguityscope = %s,\n' % (self.ambiguityscope,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('scope=%s,\n' % quote_python(self.scope).encode(ExternalEncoding)) showIndent(outfile, level) outfile.write('name=%s,\n' % quote_python(self.name).encode(ExternalEncoding)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('virt'): self.virt = attrs.get('virt').value if attrs.get('prot'): self.prot = attrs.get('prot').value if attrs.get('refid'): self.refid = attrs.get('refid').value if attrs.get('ambiguityscope'): self.ambiguityscope = attrs.get('ambiguityscope').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'scope': scope_ = '' for text__content_ in child_.childNodes: scope_ += text__content_.nodeValue self.scope = scope_ elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'name': name_ = '' for text__content_ in child_.childNodes: name_ += text__content_.nodeValue self.name = name_ # end class memberRefType class scope(GeneratedsSuper): subclass = None superclass = None def __init__(self, valueOf_=''): self.valueOf_ = valueOf_ def factory(*args_, **kwargs_): if scope.subclass: return scope.subclass(*args_, **kwargs_) else: return scope(*args_, **kwargs_) factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='scope', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='scope') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='scope'): pass def exportChildren(self, outfile, level, namespace_='', name_='scope'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='scope'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class scope class name(GeneratedsSuper): subclass = None superclass = None def __init__(self, valueOf_=''): self.valueOf_ = valueOf_ def factory(*args_, **kwargs_): if name.subclass: return name.subclass(*args_, **kwargs_) else: return name(*args_, **kwargs_) factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='name', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='name') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='name'): pass def exportChildren(self, outfile, level, namespace_='', name_='name'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='name'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class name class compoundRefType(GeneratedsSuper): subclass = None superclass = None def __init__(self, virt=None, prot=None, refid=None, valueOf_='', mixedclass_=None, content_=None): self.virt = virt self.prot = prot self.refid = refid if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if compoundRefType.subclass: return compoundRefType.subclass(*args_, **kwargs_) else: return compoundRefType(*args_, **kwargs_) factory = staticmethod(factory) def get_virt(self): return self.virt def set_virt(self, virt): self.virt = virt def get_prot(self): return self.prot def set_prot(self, prot): self.prot = prot def get_refid(self): return self.refid def set_refid(self, refid): self.refid = refid def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='compoundRefType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='compoundRefType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='compoundRefType'): if self.virt is not None: outfile.write(' virt=%s' % (quote_attrib(self.virt), )) if self.prot is not None: outfile.write(' prot=%s' % (quote_attrib(self.prot), )) if self.refid is not None: outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), )) def exportChildren(self, outfile, level, namespace_='', name_='compoundRefType'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='compoundRefType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.virt is not None: showIndent(outfile, level) outfile.write('virt = "%s",\n' % (self.virt,)) if self.prot is not None: showIndent(outfile, level) outfile.write('prot = "%s",\n' % (self.prot,)) if self.refid is not None: showIndent(outfile, level) outfile.write('refid = %s,\n' % (self.refid,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('virt'): self.virt = attrs.get('virt').value if attrs.get('prot'): self.prot = attrs.get('prot').value if attrs.get('refid'): self.refid = attrs.get('refid').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class compoundRefType class reimplementType(GeneratedsSuper): subclass = None superclass = None def __init__(self, refid=None, valueOf_='', mixedclass_=None, content_=None): self.refid = refid if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if reimplementType.subclass: return reimplementType.subclass(*args_, **kwargs_) else: return reimplementType(*args_, **kwargs_) factory = staticmethod(factory) def get_refid(self): return self.refid def set_refid(self, refid): self.refid = refid def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='reimplementType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='reimplementType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='reimplementType'): if self.refid is not None: outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), )) def exportChildren(self, outfile, level, namespace_='', name_='reimplementType'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='reimplementType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.refid is not None: showIndent(outfile, level) outfile.write('refid = %s,\n' % (self.refid,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('refid'): self.refid = attrs.get('refid').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class reimplementType class incType(GeneratedsSuper): subclass = None superclass = None def __init__(self, local=None, refid=None, valueOf_='', mixedclass_=None, content_=None): self.local = local self.refid = refid if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if incType.subclass: return incType.subclass(*args_, **kwargs_) else: return incType(*args_, **kwargs_) factory = staticmethod(factory) def get_local(self): return self.local def set_local(self, local): self.local = local def get_refid(self): return self.refid def set_refid(self, refid): self.refid = refid def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='incType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='incType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='incType'): if self.local is not None: outfile.write(' local=%s' % (quote_attrib(self.local), )) if self.refid is not None: outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), )) def exportChildren(self, outfile, level, namespace_='', name_='incType'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='incType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.local is not None: showIndent(outfile, level) outfile.write('local = "%s",\n' % (self.local,)) if self.refid is not None: showIndent(outfile, level) outfile.write('refid = %s,\n' % (self.refid,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('local'): self.local = attrs.get('local').value if attrs.get('refid'): self.refid = attrs.get('refid').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class incType class refType(GeneratedsSuper): subclass = None superclass = None def __init__(self, prot=None, refid=None, valueOf_='', mixedclass_=None, content_=None): self.prot = prot self.refid = refid if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if refType.subclass: return refType.subclass(*args_, **kwargs_) else: return refType(*args_, **kwargs_) factory = staticmethod(factory) def get_prot(self): return self.prot def set_prot(self, prot): self.prot = prot def get_refid(self): return self.refid def set_refid(self, refid): self.refid = refid def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='refType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='refType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='refType'): if self.prot is not None: outfile.write(' prot=%s' % (quote_attrib(self.prot), )) if self.refid is not None: outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), )) def exportChildren(self, outfile, level, namespace_='', name_='refType'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='refType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.prot is not None: showIndent(outfile, level) outfile.write('prot = "%s",\n' % (self.prot,)) if self.refid is not None: showIndent(outfile, level) outfile.write('refid = %s,\n' % (self.refid,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('prot'): self.prot = attrs.get('prot').value if attrs.get('refid'): self.refid = attrs.get('refid').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class refType class refTextType(GeneratedsSuper): subclass = None superclass = None def __init__(self, refid=None, kindref=None, external=None, valueOf_='', mixedclass_=None, content_=None): self.refid = refid self.kindref = kindref self.external = external if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if refTextType.subclass: return refTextType.subclass(*args_, **kwargs_) else: return refTextType(*args_, **kwargs_) factory = staticmethod(factory) def get_refid(self): return self.refid def set_refid(self, refid): self.refid = refid def get_kindref(self): return self.kindref def set_kindref(self, kindref): self.kindref = kindref def get_external(self): return self.external def set_external(self, external): self.external = external def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='refTextType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='refTextType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='refTextType'): if self.refid is not None: outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), )) if self.kindref is not None: outfile.write(' kindref=%s' % (quote_attrib(self.kindref), )) if self.external is not None: outfile.write(' external=%s' % (self.format_string(quote_attrib(self.external).encode(ExternalEncoding), input_name='external'), )) def exportChildren(self, outfile, level, namespace_='', name_='refTextType'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='refTextType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.refid is not None: showIndent(outfile, level) outfile.write('refid = %s,\n' % (self.refid,)) if self.kindref is not None: showIndent(outfile, level) outfile.write('kindref = "%s",\n' % (self.kindref,)) if self.external is not None: showIndent(outfile, level) outfile.write('external = %s,\n' % (self.external,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('refid'): self.refid = attrs.get('refid').value if attrs.get('kindref'): self.kindref = attrs.get('kindref').value if attrs.get('external'): self.external = attrs.get('external').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class refTextType class sectiondefType(GeneratedsSuper): subclass = None superclass = None def __init__(self, kind=None, header=None, description=None, memberdef=None): self.kind = kind self.header = header self.description = description if memberdef is None: self.memberdef = [] else: self.memberdef = memberdef def factory(*args_, **kwargs_): if sectiondefType.subclass: return sectiondefType.subclass(*args_, **kwargs_) else: return sectiondefType(*args_, **kwargs_) factory = staticmethod(factory) def get_header(self): return self.header def set_header(self, header): self.header = header def get_description(self): return self.description def set_description(self, description): self.description = description def get_memberdef(self): return self.memberdef def set_memberdef(self, memberdef): self.memberdef = memberdef def add_memberdef(self, value): self.memberdef.append(value) def insert_memberdef(self, index, value): self.memberdef[index] = value def get_kind(self): return self.kind def set_kind(self, kind): self.kind = kind def export(self, outfile, level, namespace_='', name_='sectiondefType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='sectiondefType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='sectiondefType'): if self.kind is not None: outfile.write(' kind=%s' % (quote_attrib(self.kind), )) def exportChildren(self, outfile, level, namespace_='', name_='sectiondefType'): if self.header is not None: showIndent(outfile, level) outfile.write('<%sheader>%s\n' % (namespace_, self.format_string(quote_xml(self.header).encode(ExternalEncoding), input_name='header'), namespace_)) if self.description: self.description.export(outfile, level, namespace_, name_='description') for memberdef_ in self.memberdef: memberdef_.export(outfile, level, namespace_, name_='memberdef') def hasContent_(self): if ( self.header is not None or self.description is not None or self.memberdef is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='sectiondefType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.kind is not None: showIndent(outfile, level) outfile.write('kind = "%s",\n' % (self.kind,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('header=%s,\n' % quote_python(self.header).encode(ExternalEncoding)) if self.description: showIndent(outfile, level) outfile.write('description=model_.descriptionType(\n') self.description.exportLiteral(outfile, level, name_='description') showIndent(outfile, level) outfile.write('),\n') showIndent(outfile, level) outfile.write('memberdef=[\n') level += 1 for memberdef in self.memberdef: showIndent(outfile, level) outfile.write('model_.memberdef(\n') memberdef.exportLiteral(outfile, level, name_='memberdef') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('kind'): self.kind = attrs.get('kind').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'header': header_ = '' for text__content_ in child_.childNodes: header_ += text__content_.nodeValue self.header = header_ elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'description': obj_ = descriptionType.factory() obj_.build(child_) self.set_description(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'memberdef': obj_ = memberdefType.factory() obj_.build(child_) self.memberdef.append(obj_) # end class sectiondefType class memberdefType(GeneratedsSuper): subclass = None superclass = None def __init__(self, initonly=None, kind=None, volatile=None, const=None, raisexx=None, virt=None, readable=None, prot=None, explicit=None, new=None, final=None, writable=None, add=None, static=None, remove=None, sealed=None, mutable=None, gettable=None, inline=None, settable=None, id=None, templateparamlist=None, type_=None, definition=None, argsstring=None, name=None, read=None, write=None, bitfield=None, reimplements=None, reimplementedby=None, param=None, enumvalue=None, initializer=None, exceptions=None, briefdescription=None, detaileddescription=None, inbodydescription=None, location=None, references=None, referencedby=None): self.initonly = initonly self.kind = kind self.volatile = volatile self.const = const self.raisexx = raisexx self.virt = virt self.readable = readable self.prot = prot self.explicit = explicit self.new = new self.final = final self.writable = writable self.add = add self.static = static self.remove = remove self.sealed = sealed self.mutable = mutable self.gettable = gettable self.inline = inline self.settable = settable self.id = id self.templateparamlist = templateparamlist self.type_ = type_ self.definition = definition self.argsstring = argsstring self.name = name self.read = read self.write = write self.bitfield = bitfield if reimplements is None: self.reimplements = [] else: self.reimplements = reimplements if reimplementedby is None: self.reimplementedby = [] else: self.reimplementedby = reimplementedby if param is None: self.param = [] else: self.param = param if enumvalue is None: self.enumvalue = [] else: self.enumvalue = enumvalue self.initializer = initializer self.exceptions = exceptions self.briefdescription = briefdescription self.detaileddescription = detaileddescription self.inbodydescription = inbodydescription self.location = location if references is None: self.references = [] else: self.references = references if referencedby is None: self.referencedby = [] else: self.referencedby = referencedby def factory(*args_, **kwargs_): if memberdefType.subclass: return memberdefType.subclass(*args_, **kwargs_) else: return memberdefType(*args_, **kwargs_) factory = staticmethod(factory) def get_templateparamlist(self): return self.templateparamlist def set_templateparamlist(self, templateparamlist): self.templateparamlist = templateparamlist def get_type(self): return self.type_ def set_type(self, type_): self.type_ = type_ def get_definition(self): return self.definition def set_definition(self, definition): self.definition = definition def get_argsstring(self): return self.argsstring def set_argsstring(self, argsstring): self.argsstring = argsstring def get_name(self): return self.name def set_name(self, name): self.name = name def get_read(self): return self.read def set_read(self, read): self.read = read def get_write(self): return self.write def set_write(self, write): self.write = write def get_bitfield(self): return self.bitfield def set_bitfield(self, bitfield): self.bitfield = bitfield def get_reimplements(self): return self.reimplements def set_reimplements(self, reimplements): self.reimplements = reimplements def add_reimplements(self, value): self.reimplements.append(value) def insert_reimplements(self, index, value): self.reimplements[index] = value def get_reimplementedby(self): return self.reimplementedby def set_reimplementedby(self, reimplementedby): self.reimplementedby = reimplementedby def add_reimplementedby(self, value): self.reimplementedby.append(value) def insert_reimplementedby(self, index, value): self.reimplementedby[index] = value def get_param(self): return self.param def set_param(self, param): self.param = param def add_param(self, value): self.param.append(value) def insert_param(self, index, value): self.param[index] = value def get_enumvalue(self): return self.enumvalue def set_enumvalue(self, enumvalue): self.enumvalue = enumvalue def add_enumvalue(self, value): self.enumvalue.append(value) def insert_enumvalue(self, index, value): self.enumvalue[index] = value def get_initializer(self): return self.initializer def set_initializer(self, initializer): self.initializer = initializer def get_exceptions(self): return self.exceptions def set_exceptions(self, exceptions): self.exceptions = exceptions def get_briefdescription(self): return self.briefdescription def set_briefdescription(self, briefdescription): self.briefdescription = briefdescription def get_detaileddescription(self): return self.detaileddescription def set_detaileddescription(self, detaileddescription): self.detaileddescription = detaileddescription def get_inbodydescription(self): return self.inbodydescription def set_inbodydescription(self, inbodydescription): self.inbodydescription = inbodydescription def get_location(self): return self.location def set_location(self, location): self.location = location def get_references(self): return self.references def set_references(self, references): self.references = references def add_references(self, value): self.references.append(value) def insert_references(self, index, value): self.references[index] = value def get_referencedby(self): return self.referencedby def set_referencedby(self, referencedby): self.referencedby = referencedby def add_referencedby(self, value): self.referencedby.append(value) def insert_referencedby(self, index, value): self.referencedby[index] = value def get_initonly(self): return self.initonly def set_initonly(self, initonly): self.initonly = initonly def get_kind(self): return self.kind def set_kind(self, kind): self.kind = kind def get_volatile(self): return self.volatile def set_volatile(self, volatile): self.volatile = volatile def get_const(self): return self.const def set_const(self, const): self.const = const def get_raise(self): return self.raisexx def set_raise(self, raisexx): self.raisexx = raisexx def get_virt(self): return self.virt def set_virt(self, virt): self.virt = virt def get_readable(self): return self.readable def set_readable(self, readable): self.readable = readable def get_prot(self): return self.prot def set_prot(self, prot): self.prot = prot def get_explicit(self): return self.explicit def set_explicit(self, explicit): self.explicit = explicit def get_new(self): return self.new def set_new(self, new): self.new = new def get_final(self): return self.final def set_final(self, final): self.final = final def get_writable(self): return self.writable def set_writable(self, writable): self.writable = writable def get_add(self): return self.add def set_add(self, add): self.add = add def get_static(self): return self.static def set_static(self, static): self.static = static def get_remove(self): return self.remove def set_remove(self, remove): self.remove = remove def get_sealed(self): return self.sealed def set_sealed(self, sealed): self.sealed = sealed def get_mutable(self): return self.mutable def set_mutable(self, mutable): self.mutable = mutable def get_gettable(self): return self.gettable def set_gettable(self, gettable): self.gettable = gettable def get_inline(self): return self.inline def set_inline(self, inline): self.inline = inline def get_settable(self): return self.settable def set_settable(self, settable): self.settable = settable def get_id(self): return self.id def set_id(self, id): self.id = id def export(self, outfile, level, namespace_='', name_='memberdefType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='memberdefType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='memberdefType'): if self.initonly is not None: outfile.write(' initonly=%s' % (quote_attrib(self.initonly), )) if self.kind is not None: outfile.write(' kind=%s' % (quote_attrib(self.kind), )) if self.volatile is not None: outfile.write(' volatile=%s' % (quote_attrib(self.volatile), )) if self.const is not None: outfile.write(' const=%s' % (quote_attrib(self.const), )) if self.raisexx is not None: outfile.write(' raise=%s' % (quote_attrib(self.raisexx), )) if self.virt is not None: outfile.write(' virt=%s' % (quote_attrib(self.virt), )) if self.readable is not None: outfile.write(' readable=%s' % (quote_attrib(self.readable), )) if self.prot is not None: outfile.write(' prot=%s' % (quote_attrib(self.prot), )) if self.explicit is not None: outfile.write(' explicit=%s' % (quote_attrib(self.explicit), )) if self.new is not None: outfile.write(' new=%s' % (quote_attrib(self.new), )) if self.final is not None: outfile.write(' final=%s' % (quote_attrib(self.final), )) if self.writable is not None: outfile.write(' writable=%s' % (quote_attrib(self.writable), )) if self.add is not None: outfile.write(' add=%s' % (quote_attrib(self.add), )) if self.static is not None: outfile.write(' static=%s' % (quote_attrib(self.static), )) if self.remove is not None: outfile.write(' remove=%s' % (quote_attrib(self.remove), )) if self.sealed is not None: outfile.write(' sealed=%s' % (quote_attrib(self.sealed), )) if self.mutable is not None: outfile.write(' mutable=%s' % (quote_attrib(self.mutable), )) if self.gettable is not None: outfile.write(' gettable=%s' % (quote_attrib(self.gettable), )) if self.inline is not None: outfile.write(' inline=%s' % (quote_attrib(self.inline), )) if self.settable is not None: outfile.write(' settable=%s' % (quote_attrib(self.settable), )) if self.id is not None: outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) def exportChildren(self, outfile, level, namespace_='', name_='memberdefType'): if self.templateparamlist: self.templateparamlist.export(outfile, level, namespace_, name_='templateparamlist') if self.type_: self.type_.export(outfile, level, namespace_, name_='type') if self.definition is not None: showIndent(outfile, level) outfile.write('<%sdefinition>%s\n' % (namespace_, self.format_string(quote_xml(self.definition).encode(ExternalEncoding), input_name='definition'), namespace_)) if self.argsstring is not None: showIndent(outfile, level) outfile.write('<%sargsstring>%s\n' % (namespace_, self.format_string(quote_xml(self.argsstring).encode(ExternalEncoding), input_name='argsstring'), namespace_)) if self.name is not None: showIndent(outfile, level) outfile.write('<%sname>%s\n' % (namespace_, self.format_string(quote_xml(self.name).encode(ExternalEncoding), input_name='name'), namespace_)) if self.read is not None: showIndent(outfile, level) outfile.write('<%sread>%s\n' % (namespace_, self.format_string(quote_xml(self.read).encode(ExternalEncoding), input_name='read'), namespace_)) if self.write is not None: showIndent(outfile, level) outfile.write('<%swrite>%s\n' % (namespace_, self.format_string(quote_xml(self.write).encode(ExternalEncoding), input_name='write'), namespace_)) if self.bitfield is not None: showIndent(outfile, level) outfile.write('<%sbitfield>%s\n' % (namespace_, self.format_string(quote_xml(self.bitfield).encode(ExternalEncoding), input_name='bitfield'), namespace_)) for reimplements_ in self.reimplements: reimplements_.export(outfile, level, namespace_, name_='reimplements') for reimplementedby_ in self.reimplementedby: reimplementedby_.export(outfile, level, namespace_, name_='reimplementedby') for param_ in self.param: param_.export(outfile, level, namespace_, name_='param') for enumvalue_ in self.enumvalue: enumvalue_.export(outfile, level, namespace_, name_='enumvalue') if self.initializer: self.initializer.export(outfile, level, namespace_, name_='initializer') if self.exceptions: self.exceptions.export(outfile, level, namespace_, name_='exceptions') if self.briefdescription: self.briefdescription.export(outfile, level, namespace_, name_='briefdescription') if self.detaileddescription: self.detaileddescription.export(outfile, level, namespace_, name_='detaileddescription') if self.inbodydescription: self.inbodydescription.export(outfile, level, namespace_, name_='inbodydescription') if self.location: self.location.export(outfile, level, namespace_, name_='location', ) for references_ in self.references: references_.export(outfile, level, namespace_, name_='references') for referencedby_ in self.referencedby: referencedby_.export(outfile, level, namespace_, name_='referencedby') def hasContent_(self): if ( self.templateparamlist is not None or self.type_ is not None or self.definition is not None or self.argsstring is not None or self.name is not None or self.read is not None or self.write is not None or self.bitfield is not None or self.reimplements is not None or self.reimplementedby is not None or self.param is not None or self.enumvalue is not None or self.initializer is not None or self.exceptions is not None or self.briefdescription is not None or self.detaileddescription is not None or self.inbodydescription is not None or self.location is not None or self.references is not None or self.referencedby is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='memberdefType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.initonly is not None: showIndent(outfile, level) outfile.write('initonly = "%s",\n' % (self.initonly,)) if self.kind is not None: showIndent(outfile, level) outfile.write('kind = "%s",\n' % (self.kind,)) if self.volatile is not None: showIndent(outfile, level) outfile.write('volatile = "%s",\n' % (self.volatile,)) if self.const is not None: showIndent(outfile, level) outfile.write('const = "%s",\n' % (self.const,)) if self.raisexx is not None: showIndent(outfile, level) outfile.write('raisexx = "%s",\n' % (self.raisexx,)) if self.virt is not None: showIndent(outfile, level) outfile.write('virt = "%s",\n' % (self.virt,)) if self.readable is not None: showIndent(outfile, level) outfile.write('readable = "%s",\n' % (self.readable,)) if self.prot is not None: showIndent(outfile, level) outfile.write('prot = "%s",\n' % (self.prot,)) if self.explicit is not None: showIndent(outfile, level) outfile.write('explicit = "%s",\n' % (self.explicit,)) if self.new is not None: showIndent(outfile, level) outfile.write('new = "%s",\n' % (self.new,)) if self.final is not None: showIndent(outfile, level) outfile.write('final = "%s",\n' % (self.final,)) if self.writable is not None: showIndent(outfile, level) outfile.write('writable = "%s",\n' % (self.writable,)) if self.add is not None: showIndent(outfile, level) outfile.write('add = "%s",\n' % (self.add,)) if self.static is not None: showIndent(outfile, level) outfile.write('static = "%s",\n' % (self.static,)) if self.remove is not None: showIndent(outfile, level) outfile.write('remove = "%s",\n' % (self.remove,)) if self.sealed is not None: showIndent(outfile, level) outfile.write('sealed = "%s",\n' % (self.sealed,)) if self.mutable is not None: showIndent(outfile, level) outfile.write('mutable = "%s",\n' % (self.mutable,)) if self.gettable is not None: showIndent(outfile, level) outfile.write('gettable = "%s",\n' % (self.gettable,)) if self.inline is not None: showIndent(outfile, level) outfile.write('inline = "%s",\n' % (self.inline,)) if self.settable is not None: showIndent(outfile, level) outfile.write('settable = "%s",\n' % (self.settable,)) if self.id is not None: showIndent(outfile, level) outfile.write('id = %s,\n' % (self.id,)) def exportLiteralChildren(self, outfile, level, name_): if self.templateparamlist: showIndent(outfile, level) outfile.write('templateparamlist=model_.templateparamlistType(\n') self.templateparamlist.exportLiteral(outfile, level, name_='templateparamlist') showIndent(outfile, level) outfile.write('),\n') if self.type_: showIndent(outfile, level) outfile.write('type_=model_.linkedTextType(\n') self.type_.exportLiteral(outfile, level, name_='type') showIndent(outfile, level) outfile.write('),\n') showIndent(outfile, level) outfile.write('definition=%s,\n' % quote_python(self.definition).encode(ExternalEncoding)) showIndent(outfile, level) outfile.write('argsstring=%s,\n' % quote_python(self.argsstring).encode(ExternalEncoding)) showIndent(outfile, level) outfile.write('name=%s,\n' % quote_python(self.name).encode(ExternalEncoding)) showIndent(outfile, level) outfile.write('read=%s,\n' % quote_python(self.read).encode(ExternalEncoding)) showIndent(outfile, level) outfile.write('write=%s,\n' % quote_python(self.write).encode(ExternalEncoding)) showIndent(outfile, level) outfile.write('bitfield=%s,\n' % quote_python(self.bitfield).encode(ExternalEncoding)) showIndent(outfile, level) outfile.write('reimplements=[\n') level += 1 for reimplements in self.reimplements: showIndent(outfile, level) outfile.write('model_.reimplements(\n') reimplements.exportLiteral(outfile, level, name_='reimplements') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('reimplementedby=[\n') level += 1 for reimplementedby in self.reimplementedby: showIndent(outfile, level) outfile.write('model_.reimplementedby(\n') reimplementedby.exportLiteral(outfile, level, name_='reimplementedby') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('param=[\n') level += 1 for param in self.param: showIndent(outfile, level) outfile.write('model_.param(\n') param.exportLiteral(outfile, level, name_='param') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('enumvalue=[\n') level += 1 for enumvalue in self.enumvalue: showIndent(outfile, level) outfile.write('model_.enumvalue(\n') enumvalue.exportLiteral(outfile, level, name_='enumvalue') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') if self.initializer: showIndent(outfile, level) outfile.write('initializer=model_.linkedTextType(\n') self.initializer.exportLiteral(outfile, level, name_='initializer') showIndent(outfile, level) outfile.write('),\n') if self.exceptions: showIndent(outfile, level) outfile.write('exceptions=model_.linkedTextType(\n') self.exceptions.exportLiteral(outfile, level, name_='exceptions') showIndent(outfile, level) outfile.write('),\n') if self.briefdescription: showIndent(outfile, level) outfile.write('briefdescription=model_.descriptionType(\n') self.briefdescription.exportLiteral(outfile, level, name_='briefdescription') showIndent(outfile, level) outfile.write('),\n') if self.detaileddescription: showIndent(outfile, level) outfile.write('detaileddescription=model_.descriptionType(\n') self.detaileddescription.exportLiteral(outfile, level, name_='detaileddescription') showIndent(outfile, level) outfile.write('),\n') if self.inbodydescription: showIndent(outfile, level) outfile.write('inbodydescription=model_.descriptionType(\n') self.inbodydescription.exportLiteral(outfile, level, name_='inbodydescription') showIndent(outfile, level) outfile.write('),\n') if self.location: showIndent(outfile, level) outfile.write('location=model_.locationType(\n') self.location.exportLiteral(outfile, level, name_='location') showIndent(outfile, level) outfile.write('),\n') showIndent(outfile, level) outfile.write('references=[\n') level += 1 for references in self.references: showIndent(outfile, level) outfile.write('model_.references(\n') references.exportLiteral(outfile, level, name_='references') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('referencedby=[\n') level += 1 for referencedby in self.referencedby: showIndent(outfile, level) outfile.write('model_.referencedby(\n') referencedby.exportLiteral(outfile, level, name_='referencedby') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('initonly'): self.initonly = attrs.get('initonly').value if attrs.get('kind'): self.kind = attrs.get('kind').value if attrs.get('volatile'): self.volatile = attrs.get('volatile').value if attrs.get('const'): self.const = attrs.get('const').value if attrs.get('raise'): self.raisexx = attrs.get('raise').value if attrs.get('virt'): self.virt = attrs.get('virt').value if attrs.get('readable'): self.readable = attrs.get('readable').value if attrs.get('prot'): self.prot = attrs.get('prot').value if attrs.get('explicit'): self.explicit = attrs.get('explicit').value if attrs.get('new'): self.new = attrs.get('new').value if attrs.get('final'): self.final = attrs.get('final').value if attrs.get('writable'): self.writable = attrs.get('writable').value if attrs.get('add'): self.add = attrs.get('add').value if attrs.get('static'): self.static = attrs.get('static').value if attrs.get('remove'): self.remove = attrs.get('remove').value if attrs.get('sealed'): self.sealed = attrs.get('sealed').value if attrs.get('mutable'): self.mutable = attrs.get('mutable').value if attrs.get('gettable'): self.gettable = attrs.get('gettable').value if attrs.get('inline'): self.inline = attrs.get('inline').value if attrs.get('settable'): self.settable = attrs.get('settable').value if attrs.get('id'): self.id = attrs.get('id').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'templateparamlist': obj_ = templateparamlistType.factory() obj_.build(child_) self.set_templateparamlist(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'type': obj_ = linkedTextType.factory() obj_.build(child_) self.set_type(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'definition': definition_ = '' for text__content_ in child_.childNodes: definition_ += text__content_.nodeValue self.definition = definition_ elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'argsstring': argsstring_ = '' for text__content_ in child_.childNodes: argsstring_ += text__content_.nodeValue self.argsstring = argsstring_ elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'name': name_ = '' for text__content_ in child_.childNodes: name_ += text__content_.nodeValue self.name = name_ elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'read': read_ = '' for text__content_ in child_.childNodes: read_ += text__content_.nodeValue self.read = read_ elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'write': write_ = '' for text__content_ in child_.childNodes: write_ += text__content_.nodeValue self.write = write_ elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'bitfield': bitfield_ = '' for text__content_ in child_.childNodes: bitfield_ += text__content_.nodeValue self.bitfield = bitfield_ elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'reimplements': obj_ = reimplementType.factory() obj_.build(child_) self.reimplements.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'reimplementedby': obj_ = reimplementType.factory() obj_.build(child_) self.reimplementedby.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'param': obj_ = paramType.factory() obj_.build(child_) self.param.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'enumvalue': obj_ = enumvalueType.factory() obj_.build(child_) self.enumvalue.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'initializer': obj_ = linkedTextType.factory() obj_.build(child_) self.set_initializer(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'exceptions': obj_ = linkedTextType.factory() obj_.build(child_) self.set_exceptions(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'briefdescription': obj_ = descriptionType.factory() obj_.build(child_) self.set_briefdescription(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'detaileddescription': obj_ = descriptionType.factory() obj_.build(child_) self.set_detaileddescription(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'inbodydescription': obj_ = descriptionType.factory() obj_.build(child_) self.set_inbodydescription(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'location': obj_ = locationType.factory() obj_.build(child_) self.set_location(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'references': obj_ = referenceType.factory() obj_.build(child_) self.references.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'referencedby': obj_ = referenceType.factory() obj_.build(child_) self.referencedby.append(obj_) # end class memberdefType class definition(GeneratedsSuper): subclass = None superclass = None def __init__(self, valueOf_=''): self.valueOf_ = valueOf_ def factory(*args_, **kwargs_): if definition.subclass: return definition.subclass(*args_, **kwargs_) else: return definition(*args_, **kwargs_) factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='definition', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='definition') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='definition'): pass def exportChildren(self, outfile, level, namespace_='', name_='definition'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='definition'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class definition class argsstring(GeneratedsSuper): subclass = None superclass = None def __init__(self, valueOf_=''): self.valueOf_ = valueOf_ def factory(*args_, **kwargs_): if argsstring.subclass: return argsstring.subclass(*args_, **kwargs_) else: return argsstring(*args_, **kwargs_) factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='argsstring', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='argsstring') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='argsstring'): pass def exportChildren(self, outfile, level, namespace_='', name_='argsstring'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='argsstring'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class argsstring class read(GeneratedsSuper): subclass = None superclass = None def __init__(self, valueOf_=''): self.valueOf_ = valueOf_ def factory(*args_, **kwargs_): if read.subclass: return read.subclass(*args_, **kwargs_) else: return read(*args_, **kwargs_) factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='read', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='read') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='read'): pass def exportChildren(self, outfile, level, namespace_='', name_='read'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='read'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class read class write(GeneratedsSuper): subclass = None superclass = None def __init__(self, valueOf_=''): self.valueOf_ = valueOf_ def factory(*args_, **kwargs_): if write.subclass: return write.subclass(*args_, **kwargs_) else: return write(*args_, **kwargs_) factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='write', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='write') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='write'): pass def exportChildren(self, outfile, level, namespace_='', name_='write'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='write'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class write class bitfield(GeneratedsSuper): subclass = None superclass = None def __init__(self, valueOf_=''): self.valueOf_ = valueOf_ def factory(*args_, **kwargs_): if bitfield.subclass: return bitfield.subclass(*args_, **kwargs_) else: return bitfield(*args_, **kwargs_) factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='bitfield', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='bitfield') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='bitfield'): pass def exportChildren(self, outfile, level, namespace_='', name_='bitfield'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='bitfield'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class bitfield class descriptionType(GeneratedsSuper): subclass = None superclass = None def __init__(self, title=None, para=None, sect1=None, internal=None, mixedclass_=None, content_=None): if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if descriptionType.subclass: return descriptionType.subclass(*args_, **kwargs_) else: return descriptionType(*args_, **kwargs_) factory = staticmethod(factory) def get_title(self): return self.title def set_title(self, title): self.title = title def get_para(self): return self.para def set_para(self, para): self.para = para def add_para(self, value): self.para.append(value) def insert_para(self, index, value): self.para[index] = value def get_sect1(self): return self.sect1 def set_sect1(self, sect1): self.sect1 = sect1 def add_sect1(self, value): self.sect1.append(value) def insert_sect1(self, index, value): self.sect1[index] = value def get_internal(self): return self.internal def set_internal(self, internal): self.internal = internal def export(self, outfile, level, namespace_='', name_='descriptionType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='descriptionType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='descriptionType'): pass def exportChildren(self, outfile, level, namespace_='', name_='descriptionType'): for item_ in self.content_: item_.export(outfile, level, item_.name, namespace_) def hasContent_(self): if ( self.title is not None or self.para is not None or self.sect1 is not None or self.internal is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='descriptionType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'title': childobj_ = docTitleType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'title', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'para': childobj_ = docParaType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'para', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'sect1': childobj_ = docSect1Type.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'sect1', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'internal': childobj_ = docInternalType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'internal', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) # end class descriptionType class enumvalueType(GeneratedsSuper): subclass = None superclass = None def __init__(self, prot=None, id=None, name=None, initializer=None, briefdescription=None, detaileddescription=None, mixedclass_=None, content_=None): self.prot = prot self.id = id if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if enumvalueType.subclass: return enumvalueType.subclass(*args_, **kwargs_) else: return enumvalueType(*args_, **kwargs_) factory = staticmethod(factory) def get_name(self): return self.name def set_name(self, name): self.name = name def get_initializer(self): return self.initializer def set_initializer(self, initializer): self.initializer = initializer def get_briefdescription(self): return self.briefdescription def set_briefdescription(self, briefdescription): self.briefdescription = briefdescription def get_detaileddescription(self): return self.detaileddescription def set_detaileddescription(self, detaileddescription): self.detaileddescription = detaileddescription def get_prot(self): return self.prot def set_prot(self, prot): self.prot = prot def get_id(self): return self.id def set_id(self, id): self.id = id def export(self, outfile, level, namespace_='', name_='enumvalueType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='enumvalueType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='enumvalueType'): if self.prot is not None: outfile.write(' prot=%s' % (quote_attrib(self.prot), )) if self.id is not None: outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) def exportChildren(self, outfile, level, namespace_='', name_='enumvalueType'): for item_ in self.content_: item_.export(outfile, level, item_.name, namespace_) def hasContent_(self): if ( self.name is not None or self.initializer is not None or self.briefdescription is not None or self.detaileddescription is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='enumvalueType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.prot is not None: showIndent(outfile, level) outfile.write('prot = "%s",\n' % (self.prot,)) if self.id is not None: showIndent(outfile, level) outfile.write('id = %s,\n' % (self.id,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('prot'): self.prot = attrs.get('prot').value if attrs.get('id'): self.id = attrs.get('id').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'name': value_ = [] for text_ in child_.childNodes: value_.append(text_.nodeValue) valuestr_ = ''.join(value_) obj_ = self.mixedclass_(MixedContainer.CategorySimple, MixedContainer.TypeString, 'name', valuestr_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'initializer': childobj_ = linkedTextType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'initializer', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'briefdescription': childobj_ = descriptionType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'briefdescription', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'detaileddescription': childobj_ = descriptionType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'detaileddescription', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) # end class enumvalueType class templateparamlistType(GeneratedsSuper): subclass = None superclass = None def __init__(self, param=None): if param is None: self.param = [] else: self.param = param def factory(*args_, **kwargs_): if templateparamlistType.subclass: return templateparamlistType.subclass(*args_, **kwargs_) else: return templateparamlistType(*args_, **kwargs_) factory = staticmethod(factory) def get_param(self): return self.param def set_param(self, param): self.param = param def add_param(self, value): self.param.append(value) def insert_param(self, index, value): self.param[index] = value def export(self, outfile, level, namespace_='', name_='templateparamlistType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='templateparamlistType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='templateparamlistType'): pass def exportChildren(self, outfile, level, namespace_='', name_='templateparamlistType'): for param_ in self.param: param_.export(outfile, level, namespace_, name_='param') def hasContent_(self): if ( self.param is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='templateparamlistType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('param=[\n') level += 1 for param in self.param: showIndent(outfile, level) outfile.write('model_.param(\n') param.exportLiteral(outfile, level, name_='param') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'param': obj_ = paramType.factory() obj_.build(child_) self.param.append(obj_) # end class templateparamlistType class paramType(GeneratedsSuper): subclass = None superclass = None def __init__(self, type_=None, declname=None, defname=None, array=None, defval=None, briefdescription=None): self.type_ = type_ self.declname = declname self.defname = defname self.array = array self.defval = defval self.briefdescription = briefdescription def factory(*args_, **kwargs_): if paramType.subclass: return paramType.subclass(*args_, **kwargs_) else: return paramType(*args_, **kwargs_) factory = staticmethod(factory) def get_type(self): return self.type_ def set_type(self, type_): self.type_ = type_ def get_declname(self): return self.declname def set_declname(self, declname): self.declname = declname def get_defname(self): return self.defname def set_defname(self, defname): self.defname = defname def get_array(self): return self.array def set_array(self, array): self.array = array def get_defval(self): return self.defval def set_defval(self, defval): self.defval = defval def get_briefdescription(self): return self.briefdescription def set_briefdescription(self, briefdescription): self.briefdescription = briefdescription def export(self, outfile, level, namespace_='', name_='paramType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='paramType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='paramType'): pass def exportChildren(self, outfile, level, namespace_='', name_='paramType'): if self.type_: self.type_.export(outfile, level, namespace_, name_='type') if self.declname is not None: showIndent(outfile, level) outfile.write('<%sdeclname>%s\n' % (namespace_, self.format_string(quote_xml(self.declname).encode(ExternalEncoding), input_name='declname'), namespace_)) if self.defname is not None: showIndent(outfile, level) outfile.write('<%sdefname>%s\n' % (namespace_, self.format_string(quote_xml(self.defname).encode(ExternalEncoding), input_name='defname'), namespace_)) if self.array is not None: showIndent(outfile, level) outfile.write('<%sarray>%s\n' % (namespace_, self.format_string(quote_xml(self.array).encode(ExternalEncoding), input_name='array'), namespace_)) if self.defval: self.defval.export(outfile, level, namespace_, name_='defval') if self.briefdescription: self.briefdescription.export(outfile, level, namespace_, name_='briefdescription') def hasContent_(self): if ( self.type_ is not None or self.declname is not None or self.defname is not None or self.array is not None or self.defval is not None or self.briefdescription is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='paramType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): if self.type_: showIndent(outfile, level) outfile.write('type_=model_.linkedTextType(\n') self.type_.exportLiteral(outfile, level, name_='type') showIndent(outfile, level) outfile.write('),\n') showIndent(outfile, level) outfile.write('declname=%s,\n' % quote_python(self.declname).encode(ExternalEncoding)) showIndent(outfile, level) outfile.write('defname=%s,\n' % quote_python(self.defname).encode(ExternalEncoding)) showIndent(outfile, level) outfile.write('array=%s,\n' % quote_python(self.array).encode(ExternalEncoding)) if self.defval: showIndent(outfile, level) outfile.write('defval=model_.linkedTextType(\n') self.defval.exportLiteral(outfile, level, name_='defval') showIndent(outfile, level) outfile.write('),\n') if self.briefdescription: showIndent(outfile, level) outfile.write('briefdescription=model_.descriptionType(\n') self.briefdescription.exportLiteral(outfile, level, name_='briefdescription') showIndent(outfile, level) outfile.write('),\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'type': obj_ = linkedTextType.factory() obj_.build(child_) self.set_type(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'declname': declname_ = '' for text__content_ in child_.childNodes: declname_ += text__content_.nodeValue self.declname = declname_ elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'defname': defname_ = '' for text__content_ in child_.childNodes: defname_ += text__content_.nodeValue self.defname = defname_ elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'array': array_ = '' for text__content_ in child_.childNodes: array_ += text__content_.nodeValue self.array = array_ elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'defval': obj_ = linkedTextType.factory() obj_.build(child_) self.set_defval(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'briefdescription': obj_ = descriptionType.factory() obj_.build(child_) self.set_briefdescription(obj_) # end class paramType class declname(GeneratedsSuper): subclass = None superclass = None def __init__(self, valueOf_=''): self.valueOf_ = valueOf_ def factory(*args_, **kwargs_): if declname.subclass: return declname.subclass(*args_, **kwargs_) else: return declname(*args_, **kwargs_) factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='declname', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='declname') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='declname'): pass def exportChildren(self, outfile, level, namespace_='', name_='declname'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='declname'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class declname class defname(GeneratedsSuper): subclass = None superclass = None def __init__(self, valueOf_=''): self.valueOf_ = valueOf_ def factory(*args_, **kwargs_): if defname.subclass: return defname.subclass(*args_, **kwargs_) else: return defname(*args_, **kwargs_) factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='defname', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='defname') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='defname'): pass def exportChildren(self, outfile, level, namespace_='', name_='defname'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='defname'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class defname class array(GeneratedsSuper): subclass = None superclass = None def __init__(self, valueOf_=''): self.valueOf_ = valueOf_ def factory(*args_, **kwargs_): if array.subclass: return array.subclass(*args_, **kwargs_) else: return array(*args_, **kwargs_) factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='array', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='array') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='array'): pass def exportChildren(self, outfile, level, namespace_='', name_='array'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='array'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class array class linkedTextType(GeneratedsSuper): subclass = None superclass = None def __init__(self, ref=None, mixedclass_=None, content_=None): if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if linkedTextType.subclass: return linkedTextType.subclass(*args_, **kwargs_) else: return linkedTextType(*args_, **kwargs_) factory = staticmethod(factory) def get_ref(self): return self.ref def set_ref(self, ref): self.ref = ref def add_ref(self, value): self.ref.append(value) def insert_ref(self, index, value): self.ref[index] = value def export(self, outfile, level, namespace_='', name_='linkedTextType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='linkedTextType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='linkedTextType'): pass def exportChildren(self, outfile, level, namespace_='', name_='linkedTextType'): for item_ in self.content_: item_.export(outfile, level, item_.name, namespace_) def hasContent_(self): if ( self.ref is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='linkedTextType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'ref': childobj_ = docRefTextType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'ref', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) # end class linkedTextType class graphType(GeneratedsSuper): subclass = None superclass = None def __init__(self, node=None): if node is None: self.node = [] else: self.node = node def factory(*args_, **kwargs_): if graphType.subclass: return graphType.subclass(*args_, **kwargs_) else: return graphType(*args_, **kwargs_) factory = staticmethod(factory) def get_node(self): return self.node def set_node(self, node): self.node = node def add_node(self, value): self.node.append(value) def insert_node(self, index, value): self.node[index] = value def export(self, outfile, level, namespace_='', name_='graphType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='graphType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='graphType'): pass def exportChildren(self, outfile, level, namespace_='', name_='graphType'): for node_ in self.node: node_.export(outfile, level, namespace_, name_='node') def hasContent_(self): if ( self.node is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='graphType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('node=[\n') level += 1 for node in self.node: showIndent(outfile, level) outfile.write('model_.node(\n') node.exportLiteral(outfile, level, name_='node') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'node': obj_ = nodeType.factory() obj_.build(child_) self.node.append(obj_) # end class graphType class nodeType(GeneratedsSuper): subclass = None superclass = None def __init__(self, id=None, label=None, link=None, childnode=None): self.id = id self.label = label self.link = link if childnode is None: self.childnode = [] else: self.childnode = childnode def factory(*args_, **kwargs_): if nodeType.subclass: return nodeType.subclass(*args_, **kwargs_) else: return nodeType(*args_, **kwargs_) factory = staticmethod(factory) def get_label(self): return self.label def set_label(self, label): self.label = label def get_link(self): return self.link def set_link(self, link): self.link = link def get_childnode(self): return self.childnode def set_childnode(self, childnode): self.childnode = childnode def add_childnode(self, value): self.childnode.append(value) def insert_childnode(self, index, value): self.childnode[index] = value def get_id(self): return self.id def set_id(self, id): self.id = id def export(self, outfile, level, namespace_='', name_='nodeType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='nodeType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='nodeType'): if self.id is not None: outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) def exportChildren(self, outfile, level, namespace_='', name_='nodeType'): if self.label is not None: showIndent(outfile, level) outfile.write('<%slabel>%s\n' % (namespace_, self.format_string(quote_xml(self.label).encode(ExternalEncoding), input_name='label'), namespace_)) if self.link: self.link.export(outfile, level, namespace_, name_='link') for childnode_ in self.childnode: childnode_.export(outfile, level, namespace_, name_='childnode') def hasContent_(self): if ( self.label is not None or self.link is not None or self.childnode is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='nodeType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.id is not None: showIndent(outfile, level) outfile.write('id = %s,\n' % (self.id,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('label=%s,\n' % quote_python(self.label).encode(ExternalEncoding)) if self.link: showIndent(outfile, level) outfile.write('link=model_.linkType(\n') self.link.exportLiteral(outfile, level, name_='link') showIndent(outfile, level) outfile.write('),\n') showIndent(outfile, level) outfile.write('childnode=[\n') level += 1 for childnode in self.childnode: showIndent(outfile, level) outfile.write('model_.childnode(\n') childnode.exportLiteral(outfile, level, name_='childnode') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('id'): self.id = attrs.get('id').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'label': label_ = '' for text__content_ in child_.childNodes: label_ += text__content_.nodeValue self.label = label_ elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'link': obj_ = linkType.factory() obj_.build(child_) self.set_link(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'childnode': obj_ = childnodeType.factory() obj_.build(child_) self.childnode.append(obj_) # end class nodeType class label(GeneratedsSuper): subclass = None superclass = None def __init__(self, valueOf_=''): self.valueOf_ = valueOf_ def factory(*args_, **kwargs_): if label.subclass: return label.subclass(*args_, **kwargs_) else: return label(*args_, **kwargs_) factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='label', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='label') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='label'): pass def exportChildren(self, outfile, level, namespace_='', name_='label'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='label'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class label class childnodeType(GeneratedsSuper): subclass = None superclass = None def __init__(self, relation=None, refid=None, edgelabel=None): self.relation = relation self.refid = refid if edgelabel is None: self.edgelabel = [] else: self.edgelabel = edgelabel def factory(*args_, **kwargs_): if childnodeType.subclass: return childnodeType.subclass(*args_, **kwargs_) else: return childnodeType(*args_, **kwargs_) factory = staticmethod(factory) def get_edgelabel(self): return self.edgelabel def set_edgelabel(self, edgelabel): self.edgelabel = edgelabel def add_edgelabel(self, value): self.edgelabel.append(value) def insert_edgelabel(self, index, value): self.edgelabel[index] = value def get_relation(self): return self.relation def set_relation(self, relation): self.relation = relation def get_refid(self): return self.refid def set_refid(self, refid): self.refid = refid def export(self, outfile, level, namespace_='', name_='childnodeType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='childnodeType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='childnodeType'): if self.relation is not None: outfile.write(' relation=%s' % (quote_attrib(self.relation), )) if self.refid is not None: outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), )) def exportChildren(self, outfile, level, namespace_='', name_='childnodeType'): for edgelabel_ in self.edgelabel: showIndent(outfile, level) outfile.write('<%sedgelabel>%s\n' % (namespace_, self.format_string(quote_xml(edgelabel_).encode(ExternalEncoding), input_name='edgelabel'), namespace_)) def hasContent_(self): if ( self.edgelabel is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='childnodeType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.relation is not None: showIndent(outfile, level) outfile.write('relation = "%s",\n' % (self.relation,)) if self.refid is not None: showIndent(outfile, level) outfile.write('refid = %s,\n' % (self.refid,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('edgelabel=[\n') level += 1 for edgelabel in self.edgelabel: showIndent(outfile, level) outfile.write('%s,\n' % quote_python(edgelabel).encode(ExternalEncoding)) level -= 1 showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('relation'): self.relation = attrs.get('relation').value if attrs.get('refid'): self.refid = attrs.get('refid').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'edgelabel': edgelabel_ = '' for text__content_ in child_.childNodes: edgelabel_ += text__content_.nodeValue self.edgelabel.append(edgelabel_) # end class childnodeType class edgelabel(GeneratedsSuper): subclass = None superclass = None def __init__(self, valueOf_=''): self.valueOf_ = valueOf_ def factory(*args_, **kwargs_): if edgelabel.subclass: return edgelabel.subclass(*args_, **kwargs_) else: return edgelabel(*args_, **kwargs_) factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='edgelabel', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='edgelabel') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='edgelabel'): pass def exportChildren(self, outfile, level, namespace_='', name_='edgelabel'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='edgelabel'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class edgelabel class linkType(GeneratedsSuper): subclass = None superclass = None def __init__(self, refid=None, external=None, valueOf_=''): self.refid = refid self.external = external self.valueOf_ = valueOf_ def factory(*args_, **kwargs_): if linkType.subclass: return linkType.subclass(*args_, **kwargs_) else: return linkType(*args_, **kwargs_) factory = staticmethod(factory) def get_refid(self): return self.refid def set_refid(self, refid): self.refid = refid def get_external(self): return self.external def set_external(self, external): self.external = external def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='linkType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='linkType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='linkType'): if self.refid is not None: outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), )) if self.external is not None: outfile.write(' external=%s' % (self.format_string(quote_attrib(self.external).encode(ExternalEncoding), input_name='external'), )) def exportChildren(self, outfile, level, namespace_='', name_='linkType'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='linkType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.refid is not None: showIndent(outfile, level) outfile.write('refid = %s,\n' % (self.refid,)) if self.external is not None: showIndent(outfile, level) outfile.write('external = %s,\n' % (self.external,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('refid'): self.refid = attrs.get('refid').value if attrs.get('external'): self.external = attrs.get('external').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class linkType class listingType(GeneratedsSuper): subclass = None superclass = None def __init__(self, codeline=None): if codeline is None: self.codeline = [] else: self.codeline = codeline def factory(*args_, **kwargs_): if listingType.subclass: return listingType.subclass(*args_, **kwargs_) else: return listingType(*args_, **kwargs_) factory = staticmethod(factory) def get_codeline(self): return self.codeline def set_codeline(self, codeline): self.codeline = codeline def add_codeline(self, value): self.codeline.append(value) def insert_codeline(self, index, value): self.codeline[index] = value def export(self, outfile, level, namespace_='', name_='listingType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='listingType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='listingType'): pass def exportChildren(self, outfile, level, namespace_='', name_='listingType'): for codeline_ in self.codeline: codeline_.export(outfile, level, namespace_, name_='codeline') def hasContent_(self): if ( self.codeline is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='listingType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('codeline=[\n') level += 1 for codeline in self.codeline: showIndent(outfile, level) outfile.write('model_.codeline(\n') codeline.exportLiteral(outfile, level, name_='codeline') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'codeline': obj_ = codelineType.factory() obj_.build(child_) self.codeline.append(obj_) # end class listingType class codelineType(GeneratedsSuper): subclass = None superclass = None def __init__(self, external=None, lineno=None, refkind=None, refid=None, highlight=None): self.external = external self.lineno = lineno self.refkind = refkind self.refid = refid if highlight is None: self.highlight = [] else: self.highlight = highlight def factory(*args_, **kwargs_): if codelineType.subclass: return codelineType.subclass(*args_, **kwargs_) else: return codelineType(*args_, **kwargs_) factory = staticmethod(factory) def get_highlight(self): return self.highlight def set_highlight(self, highlight): self.highlight = highlight def add_highlight(self, value): self.highlight.append(value) def insert_highlight(self, index, value): self.highlight[index] = value def get_external(self): return self.external def set_external(self, external): self.external = external def get_lineno(self): return self.lineno def set_lineno(self, lineno): self.lineno = lineno def get_refkind(self): return self.refkind def set_refkind(self, refkind): self.refkind = refkind def get_refid(self): return self.refid def set_refid(self, refid): self.refid = refid def export(self, outfile, level, namespace_='', name_='codelineType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='codelineType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='codelineType'): if self.external is not None: outfile.write(' external=%s' % (quote_attrib(self.external), )) if self.lineno is not None: outfile.write(' lineno="%s"' % self.format_integer(self.lineno, input_name='lineno')) if self.refkind is not None: outfile.write(' refkind=%s' % (quote_attrib(self.refkind), )) if self.refid is not None: outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), )) def exportChildren(self, outfile, level, namespace_='', name_='codelineType'): for highlight_ in self.highlight: highlight_.export(outfile, level, namespace_, name_='highlight') def hasContent_(self): if ( self.highlight is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='codelineType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.external is not None: showIndent(outfile, level) outfile.write('external = "%s",\n' % (self.external,)) if self.lineno is not None: showIndent(outfile, level) outfile.write('lineno = %s,\n' % (self.lineno,)) if self.refkind is not None: showIndent(outfile, level) outfile.write('refkind = "%s",\n' % (self.refkind,)) if self.refid is not None: showIndent(outfile, level) outfile.write('refid = %s,\n' % (self.refid,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('highlight=[\n') level += 1 for highlight in self.highlight: showIndent(outfile, level) outfile.write('model_.highlight(\n') highlight.exportLiteral(outfile, level, name_='highlight') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('external'): self.external = attrs.get('external').value if attrs.get('lineno'): try: self.lineno = int(attrs.get('lineno').value) except ValueError, exp: raise ValueError('Bad integer attribute (lineno): %s' % exp) if attrs.get('refkind'): self.refkind = attrs.get('refkind').value if attrs.get('refid'): self.refid = attrs.get('refid').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'highlight': obj_ = highlightType.factory() obj_.build(child_) self.highlight.append(obj_) # end class codelineType class highlightType(GeneratedsSuper): subclass = None superclass = None def __init__(self, classxx=None, sp=None, ref=None, mixedclass_=None, content_=None): self.classxx = classxx if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if highlightType.subclass: return highlightType.subclass(*args_, **kwargs_) else: return highlightType(*args_, **kwargs_) factory = staticmethod(factory) def get_sp(self): return self.sp def set_sp(self, sp): self.sp = sp def add_sp(self, value): self.sp.append(value) def insert_sp(self, index, value): self.sp[index] = value def get_ref(self): return self.ref def set_ref(self, ref): self.ref = ref def add_ref(self, value): self.ref.append(value) def insert_ref(self, index, value): self.ref[index] = value def get_class(self): return self.classxx def set_class(self, classxx): self.classxx = classxx def export(self, outfile, level, namespace_='', name_='highlightType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='highlightType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='highlightType'): if self.classxx is not None: outfile.write(' class=%s' % (quote_attrib(self.classxx), )) def exportChildren(self, outfile, level, namespace_='', name_='highlightType'): for item_ in self.content_: item_.export(outfile, level, item_.name, namespace_) def hasContent_(self): if ( self.sp is not None or self.ref is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='highlightType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.classxx is not None: showIndent(outfile, level) outfile.write('classxx = "%s",\n' % (self.classxx,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('class'): self.classxx = attrs.get('class').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'sp': value_ = [] for text_ in child_.childNodes: value_.append(text_.nodeValue) valuestr_ = ''.join(value_) obj_ = self.mixedclass_(MixedContainer.CategorySimple, MixedContainer.TypeString, 'sp', valuestr_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'ref': childobj_ = docRefTextType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'ref', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) # end class highlightType class sp(GeneratedsSuper): subclass = None superclass = None def __init__(self, valueOf_=''): self.valueOf_ = valueOf_ def factory(*args_, **kwargs_): if sp.subclass: return sp.subclass(*args_, **kwargs_) else: return sp(*args_, **kwargs_) factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='sp', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='sp') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='sp'): pass def exportChildren(self, outfile, level, namespace_='', name_='sp'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='sp'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class sp class referenceType(GeneratedsSuper): subclass = None superclass = None def __init__(self, endline=None, startline=None, refid=None, compoundref=None, valueOf_='', mixedclass_=None, content_=None): self.endline = endline self.startline = startline self.refid = refid self.compoundref = compoundref if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if referenceType.subclass: return referenceType.subclass(*args_, **kwargs_) else: return referenceType(*args_, **kwargs_) factory = staticmethod(factory) def get_endline(self): return self.endline def set_endline(self, endline): self.endline = endline def get_startline(self): return self.startline def set_startline(self, startline): self.startline = startline def get_refid(self): return self.refid def set_refid(self, refid): self.refid = refid def get_compoundref(self): return self.compoundref def set_compoundref(self, compoundref): self.compoundref = compoundref def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='referenceType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='referenceType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='referenceType'): if self.endline is not None: outfile.write(' endline="%s"' % self.format_integer(self.endline, input_name='endline')) if self.startline is not None: outfile.write(' startline="%s"' % self.format_integer(self.startline, input_name='startline')) if self.refid is not None: outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), )) if self.compoundref is not None: outfile.write(' compoundref=%s' % (self.format_string(quote_attrib(self.compoundref).encode(ExternalEncoding), input_name='compoundref'), )) def exportChildren(self, outfile, level, namespace_='', name_='referenceType'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='referenceType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.endline is not None: showIndent(outfile, level) outfile.write('endline = %s,\n' % (self.endline,)) if self.startline is not None: showIndent(outfile, level) outfile.write('startline = %s,\n' % (self.startline,)) if self.refid is not None: showIndent(outfile, level) outfile.write('refid = %s,\n' % (self.refid,)) if self.compoundref is not None: showIndent(outfile, level) outfile.write('compoundref = %s,\n' % (self.compoundref,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('endline'): try: self.endline = int(attrs.get('endline').value) except ValueError, exp: raise ValueError('Bad integer attribute (endline): %s' % exp) if attrs.get('startline'): try: self.startline = int(attrs.get('startline').value) except ValueError, exp: raise ValueError('Bad integer attribute (startline): %s' % exp) if attrs.get('refid'): self.refid = attrs.get('refid').value if attrs.get('compoundref'): self.compoundref = attrs.get('compoundref').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class referenceType class locationType(GeneratedsSuper): subclass = None superclass = None def __init__(self, bodystart=None, line=None, bodyend=None, bodyfile=None, file=None, valueOf_=''): self.bodystart = bodystart self.line = line self.bodyend = bodyend self.bodyfile = bodyfile self.file = file self.valueOf_ = valueOf_ def factory(*args_, **kwargs_): if locationType.subclass: return locationType.subclass(*args_, **kwargs_) else: return locationType(*args_, **kwargs_) factory = staticmethod(factory) def get_bodystart(self): return self.bodystart def set_bodystart(self, bodystart): self.bodystart = bodystart def get_line(self): return self.line def set_line(self, line): self.line = line def get_bodyend(self): return self.bodyend def set_bodyend(self, bodyend): self.bodyend = bodyend def get_bodyfile(self): return self.bodyfile def set_bodyfile(self, bodyfile): self.bodyfile = bodyfile def get_file(self): return self.file def set_file(self, file): self.file = file def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='locationType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='locationType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='locationType'): if self.bodystart is not None: outfile.write(' bodystart="%s"' % self.format_integer(self.bodystart, input_name='bodystart')) if self.line is not None: outfile.write(' line="%s"' % self.format_integer(self.line, input_name='line')) if self.bodyend is not None: outfile.write(' bodyend="%s"' % self.format_integer(self.bodyend, input_name='bodyend')) if self.bodyfile is not None: outfile.write(' bodyfile=%s' % (self.format_string(quote_attrib(self.bodyfile).encode(ExternalEncoding), input_name='bodyfile'), )) if self.file is not None: outfile.write(' file=%s' % (self.format_string(quote_attrib(self.file).encode(ExternalEncoding), input_name='file'), )) def exportChildren(self, outfile, level, namespace_='', name_='locationType'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='locationType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.bodystart is not None: showIndent(outfile, level) outfile.write('bodystart = %s,\n' % (self.bodystart,)) if self.line is not None: showIndent(outfile, level) outfile.write('line = %s,\n' % (self.line,)) if self.bodyend is not None: showIndent(outfile, level) outfile.write('bodyend = %s,\n' % (self.bodyend,)) if self.bodyfile is not None: showIndent(outfile, level) outfile.write('bodyfile = %s,\n' % (self.bodyfile,)) if self.file is not None: showIndent(outfile, level) outfile.write('file = %s,\n' % (self.file,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('bodystart'): try: self.bodystart = int(attrs.get('bodystart').value) except ValueError, exp: raise ValueError('Bad integer attribute (bodystart): %s' % exp) if attrs.get('line'): try: self.line = int(attrs.get('line').value) except ValueError, exp: raise ValueError('Bad integer attribute (line): %s' % exp) if attrs.get('bodyend'): try: self.bodyend = int(attrs.get('bodyend').value) except ValueError, exp: raise ValueError('Bad integer attribute (bodyend): %s' % exp) if attrs.get('bodyfile'): self.bodyfile = attrs.get('bodyfile').value if attrs.get('file'): self.file = attrs.get('file').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class locationType class docSect1Type(GeneratedsSuper): subclass = None superclass = None def __init__(self, id=None, title=None, para=None, sect2=None, internal=None, mixedclass_=None, content_=None): self.id = id if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if docSect1Type.subclass: return docSect1Type.subclass(*args_, **kwargs_) else: return docSect1Type(*args_, **kwargs_) factory = staticmethod(factory) def get_title(self): return self.title def set_title(self, title): self.title = title def get_para(self): return self.para def set_para(self, para): self.para = para def add_para(self, value): self.para.append(value) def insert_para(self, index, value): self.para[index] = value def get_sect2(self): return self.sect2 def set_sect2(self, sect2): self.sect2 = sect2 def add_sect2(self, value): self.sect2.append(value) def insert_sect2(self, index, value): self.sect2[index] = value def get_internal(self): return self.internal def set_internal(self, internal): self.internal = internal def get_id(self): return self.id def set_id(self, id): self.id = id def export(self, outfile, level, namespace_='', name_='docSect1Type', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docSect1Type') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='docSect1Type'): if self.id is not None: outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) def exportChildren(self, outfile, level, namespace_='', name_='docSect1Type'): for item_ in self.content_: item_.export(outfile, level, item_.name, namespace_) def hasContent_(self): if ( self.title is not None or self.para is not None or self.sect2 is not None or self.internal is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docSect1Type'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.id is not None: showIndent(outfile, level) outfile.write('id = %s,\n' % (self.id,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('id'): self.id = attrs.get('id').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'title': childobj_ = docTitleType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'title', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'para': childobj_ = docParaType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'para', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'sect2': childobj_ = docSect2Type.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'sect2', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'internal': childobj_ = docInternalS1Type.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'internal', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) # end class docSect1Type class docSect2Type(GeneratedsSuper): subclass = None superclass = None def __init__(self, id=None, title=None, para=None, sect3=None, internal=None, mixedclass_=None, content_=None): self.id = id if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if docSect2Type.subclass: return docSect2Type.subclass(*args_, **kwargs_) else: return docSect2Type(*args_, **kwargs_) factory = staticmethod(factory) def get_title(self): return self.title def set_title(self, title): self.title = title def get_para(self): return self.para def set_para(self, para): self.para = para def add_para(self, value): self.para.append(value) def insert_para(self, index, value): self.para[index] = value def get_sect3(self): return self.sect3 def set_sect3(self, sect3): self.sect3 = sect3 def add_sect3(self, value): self.sect3.append(value) def insert_sect3(self, index, value): self.sect3[index] = value def get_internal(self): return self.internal def set_internal(self, internal): self.internal = internal def get_id(self): return self.id def set_id(self, id): self.id = id def export(self, outfile, level, namespace_='', name_='docSect2Type', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docSect2Type') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='docSect2Type'): if self.id is not None: outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) def exportChildren(self, outfile, level, namespace_='', name_='docSect2Type'): for item_ in self.content_: item_.export(outfile, level, item_.name, namespace_) def hasContent_(self): if ( self.title is not None or self.para is not None or self.sect3 is not None or self.internal is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docSect2Type'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.id is not None: showIndent(outfile, level) outfile.write('id = %s,\n' % (self.id,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('id'): self.id = attrs.get('id').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'title': childobj_ = docTitleType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'title', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'para': childobj_ = docParaType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'para', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'sect3': childobj_ = docSect3Type.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'sect3', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'internal': childobj_ = docInternalS2Type.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'internal', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) # end class docSect2Type class docSect3Type(GeneratedsSuper): subclass = None superclass = None def __init__(self, id=None, title=None, para=None, sect4=None, internal=None, mixedclass_=None, content_=None): self.id = id if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if docSect3Type.subclass: return docSect3Type.subclass(*args_, **kwargs_) else: return docSect3Type(*args_, **kwargs_) factory = staticmethod(factory) def get_title(self): return self.title def set_title(self, title): self.title = title def get_para(self): return self.para def set_para(self, para): self.para = para def add_para(self, value): self.para.append(value) def insert_para(self, index, value): self.para[index] = value def get_sect4(self): return self.sect4 def set_sect4(self, sect4): self.sect4 = sect4 def add_sect4(self, value): self.sect4.append(value) def insert_sect4(self, index, value): self.sect4[index] = value def get_internal(self): return self.internal def set_internal(self, internal): self.internal = internal def get_id(self): return self.id def set_id(self, id): self.id = id def export(self, outfile, level, namespace_='', name_='docSect3Type', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docSect3Type') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='docSect3Type'): if self.id is not None: outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) def exportChildren(self, outfile, level, namespace_='', name_='docSect3Type'): for item_ in self.content_: item_.export(outfile, level, item_.name, namespace_) def hasContent_(self): if ( self.title is not None or self.para is not None or self.sect4 is not None or self.internal is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docSect3Type'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.id is not None: showIndent(outfile, level) outfile.write('id = %s,\n' % (self.id,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('id'): self.id = attrs.get('id').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'title': childobj_ = docTitleType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'title', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'para': childobj_ = docParaType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'para', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'sect4': childobj_ = docSect4Type.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'sect4', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'internal': childobj_ = docInternalS3Type.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'internal', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) # end class docSect3Type class docSect4Type(GeneratedsSuper): subclass = None superclass = None def __init__(self, id=None, title=None, para=None, internal=None, mixedclass_=None, content_=None): self.id = id if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if docSect4Type.subclass: return docSect4Type.subclass(*args_, **kwargs_) else: return docSect4Type(*args_, **kwargs_) factory = staticmethod(factory) def get_title(self): return self.title def set_title(self, title): self.title = title def get_para(self): return self.para def set_para(self, para): self.para = para def add_para(self, value): self.para.append(value) def insert_para(self, index, value): self.para[index] = value def get_internal(self): return self.internal def set_internal(self, internal): self.internal = internal def get_id(self): return self.id def set_id(self, id): self.id = id def export(self, outfile, level, namespace_='', name_='docSect4Type', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docSect4Type') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='docSect4Type'): if self.id is not None: outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) def exportChildren(self, outfile, level, namespace_='', name_='docSect4Type'): for item_ in self.content_: item_.export(outfile, level, item_.name, namespace_) def hasContent_(self): if ( self.title is not None or self.para is not None or self.internal is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docSect4Type'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.id is not None: showIndent(outfile, level) outfile.write('id = %s,\n' % (self.id,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('id'): self.id = attrs.get('id').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'title': childobj_ = docTitleType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'title', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'para': childobj_ = docParaType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'para', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'internal': childobj_ = docInternalS4Type.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'internal', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) # end class docSect4Type class docInternalType(GeneratedsSuper): subclass = None superclass = None def __init__(self, para=None, sect1=None, mixedclass_=None, content_=None): if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if docInternalType.subclass: return docInternalType.subclass(*args_, **kwargs_) else: return docInternalType(*args_, **kwargs_) factory = staticmethod(factory) def get_para(self): return self.para def set_para(self, para): self.para = para def add_para(self, value): self.para.append(value) def insert_para(self, index, value): self.para[index] = value def get_sect1(self): return self.sect1 def set_sect1(self, sect1): self.sect1 = sect1 def add_sect1(self, value): self.sect1.append(value) def insert_sect1(self, index, value): self.sect1[index] = value def export(self, outfile, level, namespace_='', name_='docInternalType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docInternalType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='docInternalType'): pass def exportChildren(self, outfile, level, namespace_='', name_='docInternalType'): for item_ in self.content_: item_.export(outfile, level, item_.name, namespace_) def hasContent_(self): if ( self.para is not None or self.sect1 is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docInternalType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'para': childobj_ = docParaType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'para', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'sect1': childobj_ = docSect1Type.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'sect1', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) # end class docInternalType class docInternalS1Type(GeneratedsSuper): subclass = None superclass = None def __init__(self, para=None, sect2=None, mixedclass_=None, content_=None): if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if docInternalS1Type.subclass: return docInternalS1Type.subclass(*args_, **kwargs_) else: return docInternalS1Type(*args_, **kwargs_) factory = staticmethod(factory) def get_para(self): return self.para def set_para(self, para): self.para = para def add_para(self, value): self.para.append(value) def insert_para(self, index, value): self.para[index] = value def get_sect2(self): return self.sect2 def set_sect2(self, sect2): self.sect2 = sect2 def add_sect2(self, value): self.sect2.append(value) def insert_sect2(self, index, value): self.sect2[index] = value def export(self, outfile, level, namespace_='', name_='docInternalS1Type', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docInternalS1Type') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='docInternalS1Type'): pass def exportChildren(self, outfile, level, namespace_='', name_='docInternalS1Type'): for item_ in self.content_: item_.export(outfile, level, item_.name, namespace_) def hasContent_(self): if ( self.para is not None or self.sect2 is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docInternalS1Type'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'para': childobj_ = docParaType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'para', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'sect2': childobj_ = docSect2Type.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'sect2', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) # end class docInternalS1Type class docInternalS2Type(GeneratedsSuper): subclass = None superclass = None def __init__(self, para=None, sect3=None, mixedclass_=None, content_=None): if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if docInternalS2Type.subclass: return docInternalS2Type.subclass(*args_, **kwargs_) else: return docInternalS2Type(*args_, **kwargs_) factory = staticmethod(factory) def get_para(self): return self.para def set_para(self, para): self.para = para def add_para(self, value): self.para.append(value) def insert_para(self, index, value): self.para[index] = value def get_sect3(self): return self.sect3 def set_sect3(self, sect3): self.sect3 = sect3 def add_sect3(self, value): self.sect3.append(value) def insert_sect3(self, index, value): self.sect3[index] = value def export(self, outfile, level, namespace_='', name_='docInternalS2Type', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docInternalS2Type') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='docInternalS2Type'): pass def exportChildren(self, outfile, level, namespace_='', name_='docInternalS2Type'): for item_ in self.content_: item_.export(outfile, level, item_.name, namespace_) def hasContent_(self): if ( self.para is not None or self.sect3 is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docInternalS2Type'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'para': childobj_ = docParaType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'para', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'sect3': childobj_ = docSect3Type.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'sect3', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) # end class docInternalS2Type class docInternalS3Type(GeneratedsSuper): subclass = None superclass = None def __init__(self, para=None, sect3=None, mixedclass_=None, content_=None): if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if docInternalS3Type.subclass: return docInternalS3Type.subclass(*args_, **kwargs_) else: return docInternalS3Type(*args_, **kwargs_) factory = staticmethod(factory) def get_para(self): return self.para def set_para(self, para): self.para = para def add_para(self, value): self.para.append(value) def insert_para(self, index, value): self.para[index] = value def get_sect3(self): return self.sect3 def set_sect3(self, sect3): self.sect3 = sect3 def add_sect3(self, value): self.sect3.append(value) def insert_sect3(self, index, value): self.sect3[index] = value def export(self, outfile, level, namespace_='', name_='docInternalS3Type', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docInternalS3Type') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='docInternalS3Type'): pass def exportChildren(self, outfile, level, namespace_='', name_='docInternalS3Type'): for item_ in self.content_: item_.export(outfile, level, item_.name, namespace_) def hasContent_(self): if ( self.para is not None or self.sect3 is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docInternalS3Type'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'para': childobj_ = docParaType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'para', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'sect3': childobj_ = docSect4Type.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'sect3', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) # end class docInternalS3Type class docInternalS4Type(GeneratedsSuper): subclass = None superclass = None def __init__(self, para=None, mixedclass_=None, content_=None): if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if docInternalS4Type.subclass: return docInternalS4Type.subclass(*args_, **kwargs_) else: return docInternalS4Type(*args_, **kwargs_) factory = staticmethod(factory) def get_para(self): return self.para def set_para(self, para): self.para = para def add_para(self, value): self.para.append(value) def insert_para(self, index, value): self.para[index] = value def export(self, outfile, level, namespace_='', name_='docInternalS4Type', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docInternalS4Type') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='docInternalS4Type'): pass def exportChildren(self, outfile, level, namespace_='', name_='docInternalS4Type'): for item_ in self.content_: item_.export(outfile, level, item_.name, namespace_) def hasContent_(self): if ( self.para is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docInternalS4Type'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'para': childobj_ = docParaType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'para', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) # end class docInternalS4Type class docTitleType(GeneratedsSuper): subclass = None superclass = None def __init__(self, valueOf_='', mixedclass_=None, content_=None): if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if docTitleType.subclass: return docTitleType.subclass(*args_, **kwargs_) else: return docTitleType(*args_, **kwargs_) factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='docTitleType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docTitleType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='docTitleType'): pass def exportChildren(self, outfile, level, namespace_='', name_='docTitleType'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docTitleType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class docTitleType class docParaType(GeneratedsSuper): subclass = None superclass = None def __init__(self, valueOf_='', mixedclass_=None, content_=None): if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if docParaType.subclass: return docParaType.subclass(*args_, **kwargs_) else: return docParaType(*args_, **kwargs_) factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='docParaType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docParaType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='docParaType'): pass def exportChildren(self, outfile, level, namespace_='', name_='docParaType'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docParaType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class docParaType class docMarkupType(GeneratedsSuper): subclass = None superclass = None def __init__(self, valueOf_='', mixedclass_=None, content_=None): if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if docMarkupType.subclass: return docMarkupType.subclass(*args_, **kwargs_) else: return docMarkupType(*args_, **kwargs_) factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='docMarkupType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docMarkupType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='docMarkupType'): pass def exportChildren(self, outfile, level, namespace_='', name_='docMarkupType'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docMarkupType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class docMarkupType class docURLLink(GeneratedsSuper): subclass = None superclass = None def __init__(self, url=None, valueOf_='', mixedclass_=None, content_=None): self.url = url if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if docURLLink.subclass: return docURLLink.subclass(*args_, **kwargs_) else: return docURLLink(*args_, **kwargs_) factory = staticmethod(factory) def get_url(self): return self.url def set_url(self, url): self.url = url def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='docURLLink', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docURLLink') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='docURLLink'): if self.url is not None: outfile.write(' url=%s' % (self.format_string(quote_attrib(self.url).encode(ExternalEncoding), input_name='url'), )) def exportChildren(self, outfile, level, namespace_='', name_='docURLLink'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docURLLink'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.url is not None: showIndent(outfile, level) outfile.write('url = %s,\n' % (self.url,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('url'): self.url = attrs.get('url').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class docURLLink class docAnchorType(GeneratedsSuper): subclass = None superclass = None def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None): self.id = id if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if docAnchorType.subclass: return docAnchorType.subclass(*args_, **kwargs_) else: return docAnchorType(*args_, **kwargs_) factory = staticmethod(factory) def get_id(self): return self.id def set_id(self, id): self.id = id def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='docAnchorType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docAnchorType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='docAnchorType'): if self.id is not None: outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) def exportChildren(self, outfile, level, namespace_='', name_='docAnchorType'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docAnchorType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.id is not None: showIndent(outfile, level) outfile.write('id = %s,\n' % (self.id,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('id'): self.id = attrs.get('id').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class docAnchorType class docFormulaType(GeneratedsSuper): subclass = None superclass = None def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None): self.id = id if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if docFormulaType.subclass: return docFormulaType.subclass(*args_, **kwargs_) else: return docFormulaType(*args_, **kwargs_) factory = staticmethod(factory) def get_id(self): return self.id def set_id(self, id): self.id = id def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='docFormulaType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docFormulaType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='docFormulaType'): if self.id is not None: outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) def exportChildren(self, outfile, level, namespace_='', name_='docFormulaType'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docFormulaType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.id is not None: showIndent(outfile, level) outfile.write('id = %s,\n' % (self.id,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('id'): self.id = attrs.get('id').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class docFormulaType class docIndexEntryType(GeneratedsSuper): subclass = None superclass = None def __init__(self, primaryie=None, secondaryie=None): self.primaryie = primaryie self.secondaryie = secondaryie def factory(*args_, **kwargs_): if docIndexEntryType.subclass: return docIndexEntryType.subclass(*args_, **kwargs_) else: return docIndexEntryType(*args_, **kwargs_) factory = staticmethod(factory) def get_primaryie(self): return self.primaryie def set_primaryie(self, primaryie): self.primaryie = primaryie def get_secondaryie(self): return self.secondaryie def set_secondaryie(self, secondaryie): self.secondaryie = secondaryie def export(self, outfile, level, namespace_='', name_='docIndexEntryType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docIndexEntryType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='docIndexEntryType'): pass def exportChildren(self, outfile, level, namespace_='', name_='docIndexEntryType'): if self.primaryie is not None: showIndent(outfile, level) outfile.write('<%sprimaryie>%s\n' % (namespace_, self.format_string(quote_xml(self.primaryie).encode(ExternalEncoding), input_name='primaryie'), namespace_)) if self.secondaryie is not None: showIndent(outfile, level) outfile.write('<%ssecondaryie>%s\n' % (namespace_, self.format_string(quote_xml(self.secondaryie).encode(ExternalEncoding), input_name='secondaryie'), namespace_)) def hasContent_(self): if ( self.primaryie is not None or self.secondaryie is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docIndexEntryType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('primaryie=%s,\n' % quote_python(self.primaryie).encode(ExternalEncoding)) showIndent(outfile, level) outfile.write('secondaryie=%s,\n' % quote_python(self.secondaryie).encode(ExternalEncoding)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'primaryie': primaryie_ = '' for text__content_ in child_.childNodes: primaryie_ += text__content_.nodeValue self.primaryie = primaryie_ elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'secondaryie': secondaryie_ = '' for text__content_ in child_.childNodes: secondaryie_ += text__content_.nodeValue self.secondaryie = secondaryie_ # end class docIndexEntryType class docListType(GeneratedsSuper): subclass = None superclass = None def __init__(self, listitem=None): if listitem is None: self.listitem = [] else: self.listitem = listitem def factory(*args_, **kwargs_): if docListType.subclass: return docListType.subclass(*args_, **kwargs_) else: return docListType(*args_, **kwargs_) factory = staticmethod(factory) def get_listitem(self): return self.listitem def set_listitem(self, listitem): self.listitem = listitem def add_listitem(self, value): self.listitem.append(value) def insert_listitem(self, index, value): self.listitem[index] = value def export(self, outfile, level, namespace_='', name_='docListType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docListType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='docListType'): pass def exportChildren(self, outfile, level, namespace_='', name_='docListType'): for listitem_ in self.listitem: listitem_.export(outfile, level, namespace_, name_='listitem') def hasContent_(self): if ( self.listitem is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docListType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('listitem=[\n') level += 1 for listitem in self.listitem: showIndent(outfile, level) outfile.write('model_.listitem(\n') listitem.exportLiteral(outfile, level, name_='listitem') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'listitem': obj_ = docListItemType.factory() obj_.build(child_) self.listitem.append(obj_) # end class docListType class docListItemType(GeneratedsSuper): subclass = None superclass = None def __init__(self, para=None): if para is None: self.para = [] else: self.para = para def factory(*args_, **kwargs_): if docListItemType.subclass: return docListItemType.subclass(*args_, **kwargs_) else: return docListItemType(*args_, **kwargs_) factory = staticmethod(factory) def get_para(self): return self.para def set_para(self, para): self.para = para def add_para(self, value): self.para.append(value) def insert_para(self, index, value): self.para[index] = value def export(self, outfile, level, namespace_='', name_='docListItemType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docListItemType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='docListItemType'): pass def exportChildren(self, outfile, level, namespace_='', name_='docListItemType'): for para_ in self.para: para_.export(outfile, level, namespace_, name_='para') def hasContent_(self): if ( self.para is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docListItemType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('para=[\n') level += 1 for para in self.para: showIndent(outfile, level) outfile.write('model_.para(\n') para.exportLiteral(outfile, level, name_='para') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'para': obj_ = docParaType.factory() obj_.build(child_) self.para.append(obj_) # end class docListItemType class docSimpleSectType(GeneratedsSuper): subclass = None superclass = None def __init__(self, kind=None, title=None, para=None): self.kind = kind self.title = title if para is None: self.para = [] else: self.para = para def factory(*args_, **kwargs_): if docSimpleSectType.subclass: return docSimpleSectType.subclass(*args_, **kwargs_) else: return docSimpleSectType(*args_, **kwargs_) factory = staticmethod(factory) def get_title(self): return self.title def set_title(self, title): self.title = title def get_para(self): return self.para def set_para(self, para): self.para = para def add_para(self, value): self.para.append(value) def insert_para(self, index, value): self.para[index] = value def get_kind(self): return self.kind def set_kind(self, kind): self.kind = kind def export(self, outfile, level, namespace_='', name_='docSimpleSectType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docSimpleSectType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='docSimpleSectType'): if self.kind is not None: outfile.write(' kind=%s' % (quote_attrib(self.kind), )) def exportChildren(self, outfile, level, namespace_='', name_='docSimpleSectType'): if self.title: self.title.export(outfile, level, namespace_, name_='title') for para_ in self.para: para_.export(outfile, level, namespace_, name_='para') def hasContent_(self): if ( self.title is not None or self.para is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docSimpleSectType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.kind is not None: showIndent(outfile, level) outfile.write('kind = "%s",\n' % (self.kind,)) def exportLiteralChildren(self, outfile, level, name_): if self.title: showIndent(outfile, level) outfile.write('title=model_.docTitleType(\n') self.title.exportLiteral(outfile, level, name_='title') showIndent(outfile, level) outfile.write('),\n') showIndent(outfile, level) outfile.write('para=[\n') level += 1 for para in self.para: showIndent(outfile, level) outfile.write('model_.para(\n') para.exportLiteral(outfile, level, name_='para') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('kind'): self.kind = attrs.get('kind').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'title': obj_ = docTitleType.factory() obj_.build(child_) self.set_title(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'para': obj_ = docParaType.factory() obj_.build(child_) self.para.append(obj_) # end class docSimpleSectType class docVarListEntryType(GeneratedsSuper): subclass = None superclass = None def __init__(self, term=None): self.term = term def factory(*args_, **kwargs_): if docVarListEntryType.subclass: return docVarListEntryType.subclass(*args_, **kwargs_) else: return docVarListEntryType(*args_, **kwargs_) factory = staticmethod(factory) def get_term(self): return self.term def set_term(self, term): self.term = term def export(self, outfile, level, namespace_='', name_='docVarListEntryType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docVarListEntryType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='docVarListEntryType'): pass def exportChildren(self, outfile, level, namespace_='', name_='docVarListEntryType'): if self.term: self.term.export(outfile, level, namespace_, name_='term', ) def hasContent_(self): if ( self.term is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docVarListEntryType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): if self.term: showIndent(outfile, level) outfile.write('term=model_.docTitleType(\n') self.term.exportLiteral(outfile, level, name_='term') showIndent(outfile, level) outfile.write('),\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'term': obj_ = docTitleType.factory() obj_.build(child_) self.set_term(obj_) # end class docVarListEntryType class docVariableListType(GeneratedsSuper): subclass = None superclass = None def __init__(self, valueOf_=''): self.valueOf_ = valueOf_ def factory(*args_, **kwargs_): if docVariableListType.subclass: return docVariableListType.subclass(*args_, **kwargs_) else: return docVariableListType(*args_, **kwargs_) factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='docVariableListType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docVariableListType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='docVariableListType'): pass def exportChildren(self, outfile, level, namespace_='', name_='docVariableListType'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docVariableListType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class docVariableListType class docRefTextType(GeneratedsSuper): subclass = None superclass = None def __init__(self, refid=None, kindref=None, external=None, valueOf_='', mixedclass_=None, content_=None): self.refid = refid self.kindref = kindref self.external = external if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if docRefTextType.subclass: return docRefTextType.subclass(*args_, **kwargs_) else: return docRefTextType(*args_, **kwargs_) factory = staticmethod(factory) def get_refid(self): return self.refid def set_refid(self, refid): self.refid = refid def get_kindref(self): return self.kindref def set_kindref(self, kindref): self.kindref = kindref def get_external(self): return self.external def set_external(self, external): self.external = external def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='docRefTextType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docRefTextType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='docRefTextType'): if self.refid is not None: outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), )) if self.kindref is not None: outfile.write(' kindref=%s' % (quote_attrib(self.kindref), )) if self.external is not None: outfile.write(' external=%s' % (self.format_string(quote_attrib(self.external).encode(ExternalEncoding), input_name='external'), )) def exportChildren(self, outfile, level, namespace_='', name_='docRefTextType'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docRefTextType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.refid is not None: showIndent(outfile, level) outfile.write('refid = %s,\n' % (self.refid,)) if self.kindref is not None: showIndent(outfile, level) outfile.write('kindref = "%s",\n' % (self.kindref,)) if self.external is not None: showIndent(outfile, level) outfile.write('external = %s,\n' % (self.external,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('refid'): self.refid = attrs.get('refid').value if attrs.get('kindref'): self.kindref = attrs.get('kindref').value if attrs.get('external'): self.external = attrs.get('external').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class docRefTextType class docTableType(GeneratedsSuper): subclass = None superclass = None def __init__(self, rows=None, cols=None, row=None, caption=None): self.rows = rows self.cols = cols if row is None: self.row = [] else: self.row = row self.caption = caption def factory(*args_, **kwargs_): if docTableType.subclass: return docTableType.subclass(*args_, **kwargs_) else: return docTableType(*args_, **kwargs_) factory = staticmethod(factory) def get_row(self): return self.row def set_row(self, row): self.row = row def add_row(self, value): self.row.append(value) def insert_row(self, index, value): self.row[index] = value def get_caption(self): return self.caption def set_caption(self, caption): self.caption = caption def get_rows(self): return self.rows def set_rows(self, rows): self.rows = rows def get_cols(self): return self.cols def set_cols(self, cols): self.cols = cols def export(self, outfile, level, namespace_='', name_='docTableType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docTableType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='docTableType'): if self.rows is not None: outfile.write(' rows="%s"' % self.format_integer(self.rows, input_name='rows')) if self.cols is not None: outfile.write(' cols="%s"' % self.format_integer(self.cols, input_name='cols')) def exportChildren(self, outfile, level, namespace_='', name_='docTableType'): for row_ in self.row: row_.export(outfile, level, namespace_, name_='row') if self.caption: self.caption.export(outfile, level, namespace_, name_='caption') def hasContent_(self): if ( self.row is not None or self.caption is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docTableType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.rows is not None: showIndent(outfile, level) outfile.write('rows = %s,\n' % (self.rows,)) if self.cols is not None: showIndent(outfile, level) outfile.write('cols = %s,\n' % (self.cols,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('row=[\n') level += 1 for row in self.row: showIndent(outfile, level) outfile.write('model_.row(\n') row.exportLiteral(outfile, level, name_='row') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') if self.caption: showIndent(outfile, level) outfile.write('caption=model_.docCaptionType(\n') self.caption.exportLiteral(outfile, level, name_='caption') showIndent(outfile, level) outfile.write('),\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('rows'): try: self.rows = int(attrs.get('rows').value) except ValueError, exp: raise ValueError('Bad integer attribute (rows): %s' % exp) if attrs.get('cols'): try: self.cols = int(attrs.get('cols').value) except ValueError, exp: raise ValueError('Bad integer attribute (cols): %s' % exp) def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'row': obj_ = docRowType.factory() obj_.build(child_) self.row.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'caption': obj_ = docCaptionType.factory() obj_.build(child_) self.set_caption(obj_) # end class docTableType class docRowType(GeneratedsSuper): subclass = None superclass = None def __init__(self, entry=None): if entry is None: self.entry = [] else: self.entry = entry def factory(*args_, **kwargs_): if docRowType.subclass: return docRowType.subclass(*args_, **kwargs_) else: return docRowType(*args_, **kwargs_) factory = staticmethod(factory) def get_entry(self): return self.entry def set_entry(self, entry): self.entry = entry def add_entry(self, value): self.entry.append(value) def insert_entry(self, index, value): self.entry[index] = value def export(self, outfile, level, namespace_='', name_='docRowType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docRowType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='docRowType'): pass def exportChildren(self, outfile, level, namespace_='', name_='docRowType'): for entry_ in self.entry: entry_.export(outfile, level, namespace_, name_='entry') def hasContent_(self): if ( self.entry is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docRowType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('entry=[\n') level += 1 for entry in self.entry: showIndent(outfile, level) outfile.write('model_.entry(\n') entry.exportLiteral(outfile, level, name_='entry') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'entry': obj_ = docEntryType.factory() obj_.build(child_) self.entry.append(obj_) # end class docRowType class docEntryType(GeneratedsSuper): subclass = None superclass = None def __init__(self, thead=None, para=None): self.thead = thead if para is None: self.para = [] else: self.para = para def factory(*args_, **kwargs_): if docEntryType.subclass: return docEntryType.subclass(*args_, **kwargs_) else: return docEntryType(*args_, **kwargs_) factory = staticmethod(factory) def get_para(self): return self.para def set_para(self, para): self.para = para def add_para(self, value): self.para.append(value) def insert_para(self, index, value): self.para[index] = value def get_thead(self): return self.thead def set_thead(self, thead): self.thead = thead def export(self, outfile, level, namespace_='', name_='docEntryType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docEntryType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='docEntryType'): if self.thead is not None: outfile.write(' thead=%s' % (quote_attrib(self.thead), )) def exportChildren(self, outfile, level, namespace_='', name_='docEntryType'): for para_ in self.para: para_.export(outfile, level, namespace_, name_='para') def hasContent_(self): if ( self.para is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docEntryType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.thead is not None: showIndent(outfile, level) outfile.write('thead = "%s",\n' % (self.thead,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('para=[\n') level += 1 for para in self.para: showIndent(outfile, level) outfile.write('model_.para(\n') para.exportLiteral(outfile, level, name_='para') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('thead'): self.thead = attrs.get('thead').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'para': obj_ = docParaType.factory() obj_.build(child_) self.para.append(obj_) # end class docEntryType class docCaptionType(GeneratedsSuper): subclass = None superclass = None def __init__(self, valueOf_='', mixedclass_=None, content_=None): if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if docCaptionType.subclass: return docCaptionType.subclass(*args_, **kwargs_) else: return docCaptionType(*args_, **kwargs_) factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='docCaptionType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docCaptionType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='docCaptionType'): pass def exportChildren(self, outfile, level, namespace_='', name_='docCaptionType'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docCaptionType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class docCaptionType class docHeadingType(GeneratedsSuper): subclass = None superclass = None def __init__(self, level=None, valueOf_='', mixedclass_=None, content_=None): self.level = level if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if docHeadingType.subclass: return docHeadingType.subclass(*args_, **kwargs_) else: return docHeadingType(*args_, **kwargs_) factory = staticmethod(factory) def get_level(self): return self.level def set_level(self, level): self.level = level def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='docHeadingType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docHeadingType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='docHeadingType'): if self.level is not None: outfile.write(' level="%s"' % self.format_integer(self.level, input_name='level')) def exportChildren(self, outfile, level, namespace_='', name_='docHeadingType'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docHeadingType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.level is not None: showIndent(outfile, level) outfile.write('level = %s,\n' % (self.level,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('level'): try: self.level = int(attrs.get('level').value) except ValueError, exp: raise ValueError('Bad integer attribute (level): %s' % exp) def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class docHeadingType class docImageType(GeneratedsSuper): subclass = None superclass = None def __init__(self, width=None, type_=None, name=None, height=None, valueOf_='', mixedclass_=None, content_=None): self.width = width self.type_ = type_ self.name = name self.height = height if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if docImageType.subclass: return docImageType.subclass(*args_, **kwargs_) else: return docImageType(*args_, **kwargs_) factory = staticmethod(factory) def get_width(self): return self.width def set_width(self, width): self.width = width def get_type(self): return self.type_ def set_type(self, type_): self.type_ = type_ def get_name(self): return self.name def set_name(self, name): self.name = name def get_height(self): return self.height def set_height(self, height): self.height = height def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='docImageType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docImageType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='docImageType'): if self.width is not None: outfile.write(' width=%s' % (self.format_string(quote_attrib(self.width).encode(ExternalEncoding), input_name='width'), )) if self.type_ is not None: outfile.write(' type=%s' % (quote_attrib(self.type_), )) if self.name is not None: outfile.write(' name=%s' % (self.format_string(quote_attrib(self.name).encode(ExternalEncoding), input_name='name'), )) if self.height is not None: outfile.write(' height=%s' % (self.format_string(quote_attrib(self.height).encode(ExternalEncoding), input_name='height'), )) def exportChildren(self, outfile, level, namespace_='', name_='docImageType'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docImageType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.width is not None: showIndent(outfile, level) outfile.write('width = %s,\n' % (self.width,)) if self.type_ is not None: showIndent(outfile, level) outfile.write('type_ = "%s",\n' % (self.type_,)) if self.name is not None: showIndent(outfile, level) outfile.write('name = %s,\n' % (self.name,)) if self.height is not None: showIndent(outfile, level) outfile.write('height = %s,\n' % (self.height,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('width'): self.width = attrs.get('width').value if attrs.get('type'): self.type_ = attrs.get('type').value if attrs.get('name'): self.name = attrs.get('name').value if attrs.get('height'): self.height = attrs.get('height').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class docImageType class docDotFileType(GeneratedsSuper): subclass = None superclass = None def __init__(self, name=None, valueOf_='', mixedclass_=None, content_=None): self.name = name if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if docDotFileType.subclass: return docDotFileType.subclass(*args_, **kwargs_) else: return docDotFileType(*args_, **kwargs_) factory = staticmethod(factory) def get_name(self): return self.name def set_name(self, name): self.name = name def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='docDotFileType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docDotFileType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='docDotFileType'): if self.name is not None: outfile.write(' name=%s' % (self.format_string(quote_attrib(self.name).encode(ExternalEncoding), input_name='name'), )) def exportChildren(self, outfile, level, namespace_='', name_='docDotFileType'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docDotFileType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.name is not None: showIndent(outfile, level) outfile.write('name = %s,\n' % (self.name,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('name'): self.name = attrs.get('name').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class docDotFileType class docTocItemType(GeneratedsSuper): subclass = None superclass = None def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None): self.id = id if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if docTocItemType.subclass: return docTocItemType.subclass(*args_, **kwargs_) else: return docTocItemType(*args_, **kwargs_) factory = staticmethod(factory) def get_id(self): return self.id def set_id(self, id): self.id = id def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='docTocItemType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docTocItemType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='docTocItemType'): if self.id is not None: outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) def exportChildren(self, outfile, level, namespace_='', name_='docTocItemType'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docTocItemType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.id is not None: showIndent(outfile, level) outfile.write('id = %s,\n' % (self.id,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('id'): self.id = attrs.get('id').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class docTocItemType class docTocListType(GeneratedsSuper): subclass = None superclass = None def __init__(self, tocitem=None): if tocitem is None: self.tocitem = [] else: self.tocitem = tocitem def factory(*args_, **kwargs_): if docTocListType.subclass: return docTocListType.subclass(*args_, **kwargs_) else: return docTocListType(*args_, **kwargs_) factory = staticmethod(factory) def get_tocitem(self): return self.tocitem def set_tocitem(self, tocitem): self.tocitem = tocitem def add_tocitem(self, value): self.tocitem.append(value) def insert_tocitem(self, index, value): self.tocitem[index] = value def export(self, outfile, level, namespace_='', name_='docTocListType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docTocListType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='docTocListType'): pass def exportChildren(self, outfile, level, namespace_='', name_='docTocListType'): for tocitem_ in self.tocitem: tocitem_.export(outfile, level, namespace_, name_='tocitem') def hasContent_(self): if ( self.tocitem is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docTocListType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('tocitem=[\n') level += 1 for tocitem in self.tocitem: showIndent(outfile, level) outfile.write('model_.tocitem(\n') tocitem.exportLiteral(outfile, level, name_='tocitem') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'tocitem': obj_ = docTocItemType.factory() obj_.build(child_) self.tocitem.append(obj_) # end class docTocListType class docLanguageType(GeneratedsSuper): subclass = None superclass = None def __init__(self, langid=None, para=None): self.langid = langid if para is None: self.para = [] else: self.para = para def factory(*args_, **kwargs_): if docLanguageType.subclass: return docLanguageType.subclass(*args_, **kwargs_) else: return docLanguageType(*args_, **kwargs_) factory = staticmethod(factory) def get_para(self): return self.para def set_para(self, para): self.para = para def add_para(self, value): self.para.append(value) def insert_para(self, index, value): self.para[index] = value def get_langid(self): return self.langid def set_langid(self, langid): self.langid = langid def export(self, outfile, level, namespace_='', name_='docLanguageType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docLanguageType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='docLanguageType'): if self.langid is not None: outfile.write(' langid=%s' % (self.format_string(quote_attrib(self.langid).encode(ExternalEncoding), input_name='langid'), )) def exportChildren(self, outfile, level, namespace_='', name_='docLanguageType'): for para_ in self.para: para_.export(outfile, level, namespace_, name_='para') def hasContent_(self): if ( self.para is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docLanguageType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.langid is not None: showIndent(outfile, level) outfile.write('langid = %s,\n' % (self.langid,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('para=[\n') level += 1 for para in self.para: showIndent(outfile, level) outfile.write('model_.para(\n') para.exportLiteral(outfile, level, name_='para') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('langid'): self.langid = attrs.get('langid').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'para': obj_ = docParaType.factory() obj_.build(child_) self.para.append(obj_) # end class docLanguageType class docParamListType(GeneratedsSuper): subclass = None superclass = None def __init__(self, kind=None, parameteritem=None): self.kind = kind if parameteritem is None: self.parameteritem = [] else: self.parameteritem = parameteritem def factory(*args_, **kwargs_): if docParamListType.subclass: return docParamListType.subclass(*args_, **kwargs_) else: return docParamListType(*args_, **kwargs_) factory = staticmethod(factory) def get_parameteritem(self): return self.parameteritem def set_parameteritem(self, parameteritem): self.parameteritem = parameteritem def add_parameteritem(self, value): self.parameteritem.append(value) def insert_parameteritem(self, index, value): self.parameteritem[index] = value def get_kind(self): return self.kind def set_kind(self, kind): self.kind = kind def export(self, outfile, level, namespace_='', name_='docParamListType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docParamListType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='docParamListType'): if self.kind is not None: outfile.write(' kind=%s' % (quote_attrib(self.kind), )) def exportChildren(self, outfile, level, namespace_='', name_='docParamListType'): for parameteritem_ in self.parameteritem: parameteritem_.export(outfile, level, namespace_, name_='parameteritem') def hasContent_(self): if ( self.parameteritem is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docParamListType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.kind is not None: showIndent(outfile, level) outfile.write('kind = "%s",\n' % (self.kind,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('parameteritem=[\n') level += 1 for parameteritem in self.parameteritem: showIndent(outfile, level) outfile.write('model_.parameteritem(\n') parameteritem.exportLiteral(outfile, level, name_='parameteritem') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('kind'): self.kind = attrs.get('kind').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'parameteritem': obj_ = docParamListItem.factory() obj_.build(child_) self.parameteritem.append(obj_) # end class docParamListType class docParamListItem(GeneratedsSuper): subclass = None superclass = None def __init__(self, parameternamelist=None, parameterdescription=None): if parameternamelist is None: self.parameternamelist = [] else: self.parameternamelist = parameternamelist self.parameterdescription = parameterdescription def factory(*args_, **kwargs_): if docParamListItem.subclass: return docParamListItem.subclass(*args_, **kwargs_) else: return docParamListItem(*args_, **kwargs_) factory = staticmethod(factory) def get_parameternamelist(self): return self.parameternamelist def set_parameternamelist(self, parameternamelist): self.parameternamelist = parameternamelist def add_parameternamelist(self, value): self.parameternamelist.append(value) def insert_parameternamelist(self, index, value): self.parameternamelist[index] = value def get_parameterdescription(self): return self.parameterdescription def set_parameterdescription(self, parameterdescription): self.parameterdescription = parameterdescription def export(self, outfile, level, namespace_='', name_='docParamListItem', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docParamListItem') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='docParamListItem'): pass def exportChildren(self, outfile, level, namespace_='', name_='docParamListItem'): for parameternamelist_ in self.parameternamelist: parameternamelist_.export(outfile, level, namespace_, name_='parameternamelist') if self.parameterdescription: self.parameterdescription.export(outfile, level, namespace_, name_='parameterdescription', ) def hasContent_(self): if ( self.parameternamelist is not None or self.parameterdescription is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docParamListItem'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('parameternamelist=[\n') level += 1 for parameternamelist in self.parameternamelist: showIndent(outfile, level) outfile.write('model_.parameternamelist(\n') parameternamelist.exportLiteral(outfile, level, name_='parameternamelist') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') if self.parameterdescription: showIndent(outfile, level) outfile.write('parameterdescription=model_.descriptionType(\n') self.parameterdescription.exportLiteral(outfile, level, name_='parameterdescription') showIndent(outfile, level) outfile.write('),\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'parameternamelist': obj_ = docParamNameList.factory() obj_.build(child_) self.parameternamelist.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'parameterdescription': obj_ = descriptionType.factory() obj_.build(child_) self.set_parameterdescription(obj_) # end class docParamListItem class docParamNameList(GeneratedsSuper): subclass = None superclass = None def __init__(self, parametername=None): if parametername is None: self.parametername = [] else: self.parametername = parametername def factory(*args_, **kwargs_): if docParamNameList.subclass: return docParamNameList.subclass(*args_, **kwargs_) else: return docParamNameList(*args_, **kwargs_) factory = staticmethod(factory) def get_parametername(self): return self.parametername def set_parametername(self, parametername): self.parametername = parametername def add_parametername(self, value): self.parametername.append(value) def insert_parametername(self, index, value): self.parametername[index] = value def export(self, outfile, level, namespace_='', name_='docParamNameList', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docParamNameList') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='docParamNameList'): pass def exportChildren(self, outfile, level, namespace_='', name_='docParamNameList'): for parametername_ in self.parametername: parametername_.export(outfile, level, namespace_, name_='parametername') def hasContent_(self): if ( self.parametername is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docParamNameList'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('parametername=[\n') level += 1 for parametername in self.parametername: showIndent(outfile, level) outfile.write('model_.parametername(\n') parametername.exportLiteral(outfile, level, name_='parametername') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'parametername': obj_ = docParamName.factory() obj_.build(child_) self.parametername.append(obj_) # end class docParamNameList class docParamName(GeneratedsSuper): subclass = None superclass = None def __init__(self, direction=None, ref=None, mixedclass_=None, content_=None): self.direction = direction if mixedclass_ is None: self.mixedclass_ = MixedContainer else: self.mixedclass_ = mixedclass_ if content_ is None: self.content_ = [] else: self.content_ = content_ def factory(*args_, **kwargs_): if docParamName.subclass: return docParamName.subclass(*args_, **kwargs_) else: return docParamName(*args_, **kwargs_) factory = staticmethod(factory) def get_ref(self): return self.ref def set_ref(self, ref): self.ref = ref def get_direction(self): return self.direction def set_direction(self, direction): self.direction = direction def export(self, outfile, level, namespace_='', name_='docParamName', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docParamName') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('\n' % (namespace_, name_)) def exportAttributes(self, outfile, level, namespace_='', name_='docParamName'): if self.direction is not None: outfile.write(' direction=%s' % (quote_attrib(self.direction), )) def exportChildren(self, outfile, level, namespace_='', name_='docParamName'): for item_ in self.content_: item_.export(outfile, level, item_.name, namespace_) def hasContent_(self): if ( self.ref is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docParamName'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.direction is not None: showIndent(outfile, level) outfile.write('direction = "%s",\n' % (self.direction,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('content_ = [\n') for item_ in self.content_: item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('direction'): self.direction = attrs.get('direction').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'ref': childobj_ = docRefTextType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'ref', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) # end class docParamName class docXRefSectType(GeneratedsSuper): subclass = None superclass = None def __init__(self, id=None, xreftitle=None, xrefdescription=None): self.id = id if xreftitle is None: self.xreftitle = [] else: self.xreftitle = xreftitle self.xrefdescription = xrefdescription def factory(*args_, **kwargs_): if docXRefSectType.subclass: return docXRefSectType.subclass(*args_, **kwargs_) else: return docXRefSectType(*args_, **kwargs_) factory = staticmethod(factory) def get_xreftitle(self): return self.xreftitle def set_xreftitle(self, xreftitle): self.xreftitle = xreftitle def add_xreftitle(self, value): self.xreftitle.append(value) def insert_xreftitle(self, index, value): self.xreftitle[index] = value def get_xrefdescription(self): return self.xrefdescription def set_xrefdescription(self, xrefdescription): self.xrefdescription = xrefdescription def get_id(self): return self.id def set_id(self, id): self.id = id def export(self, outfile, level, namespace_='', name_='docXRefSectType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docXRefSectType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='docXRefSectType'): if self.id is not None: outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) def exportChildren(self, outfile, level, namespace_='', name_='docXRefSectType'): for xreftitle_ in self.xreftitle: showIndent(outfile, level) outfile.write('<%sxreftitle>%s\n' % (namespace_, self.format_string(quote_xml(xreftitle_).encode(ExternalEncoding), input_name='xreftitle'), namespace_)) if self.xrefdescription: self.xrefdescription.export(outfile, level, namespace_, name_='xrefdescription', ) def hasContent_(self): if ( self.xreftitle is not None or self.xrefdescription is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docXRefSectType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.id is not None: showIndent(outfile, level) outfile.write('id = %s,\n' % (self.id,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('xreftitle=[\n') level += 1 for xreftitle in self.xreftitle: showIndent(outfile, level) outfile.write('%s,\n' % quote_python(xreftitle).encode(ExternalEncoding)) level -= 1 showIndent(outfile, level) outfile.write('],\n') if self.xrefdescription: showIndent(outfile, level) outfile.write('xrefdescription=model_.descriptionType(\n') self.xrefdescription.exportLiteral(outfile, level, name_='xrefdescription') showIndent(outfile, level) outfile.write('),\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('id'): self.id = attrs.get('id').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'xreftitle': xreftitle_ = '' for text__content_ in child_.childNodes: xreftitle_ += text__content_.nodeValue self.xreftitle.append(xreftitle_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'xrefdescription': obj_ = descriptionType.factory() obj_.build(child_) self.set_xrefdescription(obj_) # end class docXRefSectType class docCopyType(GeneratedsSuper): subclass = None superclass = None def __init__(self, link=None, para=None, sect1=None, internal=None): self.link = link if para is None: self.para = [] else: self.para = para if sect1 is None: self.sect1 = [] else: self.sect1 = sect1 self.internal = internal def factory(*args_, **kwargs_): if docCopyType.subclass: return docCopyType.subclass(*args_, **kwargs_) else: return docCopyType(*args_, **kwargs_) factory = staticmethod(factory) def get_para(self): return self.para def set_para(self, para): self.para = para def add_para(self, value): self.para.append(value) def insert_para(self, index, value): self.para[index] = value def get_sect1(self): return self.sect1 def set_sect1(self, sect1): self.sect1 = sect1 def add_sect1(self, value): self.sect1.append(value) def insert_sect1(self, index, value): self.sect1[index] = value def get_internal(self): return self.internal def set_internal(self, internal): self.internal = internal def get_link(self): return self.link def set_link(self, link): self.link = link def export(self, outfile, level, namespace_='', name_='docCopyType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docCopyType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='docCopyType'): if self.link is not None: outfile.write(' link=%s' % (self.format_string(quote_attrib(self.link).encode(ExternalEncoding), input_name='link'), )) def exportChildren(self, outfile, level, namespace_='', name_='docCopyType'): for para_ in self.para: para_.export(outfile, level, namespace_, name_='para') for sect1_ in self.sect1: sect1_.export(outfile, level, namespace_, name_='sect1') if self.internal: self.internal.export(outfile, level, namespace_, name_='internal') def hasContent_(self): if ( self.para is not None or self.sect1 is not None or self.internal is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docCopyType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.link is not None: showIndent(outfile, level) outfile.write('link = %s,\n' % (self.link,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('para=[\n') level += 1 for para in self.para: showIndent(outfile, level) outfile.write('model_.para(\n') para.exportLiteral(outfile, level, name_='para') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') showIndent(outfile, level) outfile.write('sect1=[\n') level += 1 for sect1 in self.sect1: showIndent(outfile, level) outfile.write('model_.sect1(\n') sect1.exportLiteral(outfile, level, name_='sect1') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') if self.internal: showIndent(outfile, level) outfile.write('internal=model_.docInternalType(\n') self.internal.exportLiteral(outfile, level, name_='internal') showIndent(outfile, level) outfile.write('),\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('link'): self.link = attrs.get('link').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'para': obj_ = docParaType.factory() obj_.build(child_) self.para.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'sect1': obj_ = docSect1Type.factory() obj_.build(child_) self.sect1.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'internal': obj_ = docInternalType.factory() obj_.build(child_) self.set_internal(obj_) # end class docCopyType class docCharType(GeneratedsSuper): subclass = None superclass = None def __init__(self, char=None, valueOf_=''): self.char = char self.valueOf_ = valueOf_ def factory(*args_, **kwargs_): if docCharType.subclass: return docCharType.subclass(*args_, **kwargs_) else: return docCharType(*args_, **kwargs_) factory = staticmethod(factory) def get_char(self): return self.char def set_char(self, char): self.char = char def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='docCharType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docCharType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='docCharType'): if self.char is not None: outfile.write(' char=%s' % (quote_attrib(self.char), )) def exportChildren(self, outfile, level, namespace_='', name_='docCharType'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docCharType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.char is not None: showIndent(outfile, level) outfile.write('char = "%s",\n' % (self.char,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('char'): self.char = attrs.get('char').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class docCharType class docEmptyType(GeneratedsSuper): subclass = None superclass = None def __init__(self, valueOf_=''): self.valueOf_ = valueOf_ def factory(*args_, **kwargs_): if docEmptyType.subclass: return docEmptyType.subclass(*args_, **kwargs_) else: return docEmptyType(*args_, **kwargs_) factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ def export(self, outfile, level, namespace_='', name_='docEmptyType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='docEmptyType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='docEmptyType'): pass def exportChildren(self, outfile, level, namespace_='', name_='docEmptyType'): if self.valueOf_.find('![CDATA')>-1: value=quote_xml('%s' % self.valueOf_) value=value.replace('![CDATA','') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) def hasContent_(self): if ( self.valueOf_ is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='docEmptyType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): pass def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) self.valueOf_ = '' for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): pass def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: self.valueOf_ += '![CDATA['+child_.nodeValue+']]' # end class docEmptyType USAGE_TEXT = """ Usage: python .py [ -s ] Options: -s Use the SAX parser, not the minidom parser. """ def usage(): print USAGE_TEXT sys.exit(1) def parse(inFileName): doc = minidom.parse(inFileName) rootNode = doc.documentElement rootObj = DoxygenType.factory() rootObj.build(rootNode) # Enable Python to collect the space used by the DOM. doc = None sys.stdout.write('\n') rootObj.export(sys.stdout, 0, name_="doxygen", namespacedef_='') return rootObj def parseString(inString): doc = minidom.parseString(inString) rootNode = doc.documentElement rootObj = DoxygenType.factory() rootObj.build(rootNode) # Enable Python to collect the space used by the DOM. doc = None sys.stdout.write('\n') rootObj.export(sys.stdout, 0, name_="doxygen", namespacedef_='') return rootObj def parseLiteral(inFileName): doc = minidom.parse(inFileName) rootNode = doc.documentElement rootObj = DoxygenType.factory() rootObj.build(rootNode) # Enable Python to collect the space used by the DOM. doc = None sys.stdout.write('from compound import *\n\n') sys.stdout.write('rootObj = doxygen(\n') rootObj.exportLiteral(sys.stdout, 0, name_="doxygen") sys.stdout.write(')\n') return rootObj def main(): args = sys.argv[1:] if len(args) == 1: parse(args[0]) else: usage() if __name__ == '__main__': main() #import pdb #pdb.run('main()') gr-gsm-0.41.2/docs/doxygen/doxyxml/generated/index.py000066400000000000000000000035171316153413000225250ustar00rootroot00000000000000#!/usr/bin/env python """ Generated Mon Feb 9 19:08:05 2009 by generateDS.py. """ from xml.dom import minidom import os import sys import compound import indexsuper as supermod class DoxygenTypeSub(supermod.DoxygenType): def __init__(self, version=None, compound=None): supermod.DoxygenType.__init__(self, version, compound) def find_compounds_and_members(self, details): """ Returns a list of all compounds and their members which match details """ results = [] for compound in self.compound: members = compound.find_members(details) if members: results.append([compound, members]) else: if details.match(compound): results.append([compound, []]) return results supermod.DoxygenType.subclass = DoxygenTypeSub # end class DoxygenTypeSub class CompoundTypeSub(supermod.CompoundType): def __init__(self, kind=None, refid=None, name='', member=None): supermod.CompoundType.__init__(self, kind, refid, name, member) def find_members(self, details): """ Returns a list of all members which match details """ results = [] for member in self.member: if details.match(member): results.append(member) return results supermod.CompoundType.subclass = CompoundTypeSub # end class CompoundTypeSub class MemberTypeSub(supermod.MemberType): def __init__(self, kind=None, refid=None, name=''): supermod.MemberType.__init__(self, kind, refid, name) supermod.MemberType.subclass = MemberTypeSub # end class MemberTypeSub def parse(inFilename): doc = minidom.parse(inFilename) rootNode = doc.documentElement rootObj = supermod.DoxygenType.factory() rootObj.build(rootNode) return rootObj gr-gsm-0.41.2/docs/doxygen/doxyxml/generated/indexsuper.py000066400000000000000000000455261316153413000236120ustar00rootroot00000000000000#!/usr/bin/env python # # Generated Thu Jun 11 18:43:54 2009 by generateDS.py. # import sys import getopt from string import lower as str_lower from xml.dom import minidom from xml.dom import Node # # User methods # # Calls to the methods in these classes are generated by generateDS.py. # You can replace these methods by re-implementing the following class # in a module named generatedssuper.py. try: from generatedssuper import GeneratedsSuper except ImportError, exp: class GeneratedsSuper: def format_string(self, input_data, input_name=''): return input_data def format_integer(self, input_data, input_name=''): return '%d' % input_data def format_float(self, input_data, input_name=''): return '%f' % input_data def format_double(self, input_data, input_name=''): return '%e' % input_data def format_boolean(self, input_data, input_name=''): return '%s' % input_data # # If you have installed IPython you can uncomment and use the following. # IPython is available from http://ipython.scipy.org/. # ## from IPython.Shell import IPShellEmbed ## args = '' ## ipshell = IPShellEmbed(args, ## banner = 'Dropping into IPython', ## exit_msg = 'Leaving Interpreter, back to program.') # Then use the following line where and when you want to drop into the # IPython shell: # ipshell(' -- Entering ipshell.\nHit Ctrl-D to exit') # # Globals # ExternalEncoding = 'ascii' # # Support/utility functions. # def showIndent(outfile, level): for idx in range(level): outfile.write(' ') def quote_xml(inStr): s1 = (isinstance(inStr, basestring) and inStr or '%s' % inStr) s1 = s1.replace('&', '&') s1 = s1.replace('<', '<') s1 = s1.replace('>', '>') return s1 def quote_attrib(inStr): s1 = (isinstance(inStr, basestring) and inStr or '%s' % inStr) s1 = s1.replace('&', '&') s1 = s1.replace('<', '<') s1 = s1.replace('>', '>') if '"' in s1: if "'" in s1: s1 = '"%s"' % s1.replace('"', """) else: s1 = "'%s'" % s1 else: s1 = '"%s"' % s1 return s1 def quote_python(inStr): s1 = inStr if s1.find("'") == -1: if s1.find('\n') == -1: return "'%s'" % s1 else: return "'''%s'''" % s1 else: if s1.find('"') != -1: s1 = s1.replace('"', '\\"') if s1.find('\n') == -1: return '"%s"' % s1 else: return '"""%s"""' % s1 class MixedContainer: # Constants for category: CategoryNone = 0 CategoryText = 1 CategorySimple = 2 CategoryComplex = 3 # Constants for content_type: TypeNone = 0 TypeText = 1 TypeString = 2 TypeInteger = 3 TypeFloat = 4 TypeDecimal = 5 TypeDouble = 6 TypeBoolean = 7 def __init__(self, category, content_type, name, value): self.category = category self.content_type = content_type self.name = name self.value = value def getCategory(self): return self.category def getContenttype(self, content_type): return self.content_type def getValue(self): return self.value def getName(self): return self.name def export(self, outfile, level, name, namespace): if self.category == MixedContainer.CategoryText: outfile.write(self.value) elif self.category == MixedContainer.CategorySimple: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export(outfile, level, namespace,name) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s' % (self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeInteger or \ self.content_type == MixedContainer.TypeBoolean: outfile.write('<%s>%d' % (self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeFloat or \ self.content_type == MixedContainer.TypeDecimal: outfile.write('<%s>%f' % (self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeDouble: outfile.write('<%s>%g' % (self.name, self.value, self.name)) def exportLiteral(self, outfile, level, name): if self.category == MixedContainer.CategoryText: showIndent(outfile, level) outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' % \ (self.category, self.content_type, self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' % \ (self.category, self.content_type, self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write('MixedContainer(%d, %d, "%s",\n' % \ (self.category, self.content_type, self.name,)) self.value.exportLiteral(outfile, level + 1) showIndent(outfile, level) outfile.write(')\n') class _MemberSpec(object): def __init__(self, name='', data_type='', container=0): self.name = name self.data_type = data_type self.container = container def set_name(self, name): self.name = name def get_name(self): return self.name def set_data_type(self, data_type): self.data_type = data_type def get_data_type(self): return self.data_type def set_container(self, container): self.container = container def get_container(self): return self.container # # Data representation classes. # class DoxygenType(GeneratedsSuper): subclass = None superclass = None def __init__(self, version=None, compound=None): self.version = version if compound is None: self.compound = [] else: self.compound = compound def factory(*args_, **kwargs_): if DoxygenType.subclass: return DoxygenType.subclass(*args_, **kwargs_) else: return DoxygenType(*args_, **kwargs_) factory = staticmethod(factory) def get_compound(self): return self.compound def set_compound(self, compound): self.compound = compound def add_compound(self, value): self.compound.append(value) def insert_compound(self, index, value): self.compound[index] = value def get_version(self): return self.version def set_version(self, version): self.version = version def export(self, outfile, level, namespace_='', name_='DoxygenType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='DoxygenType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='DoxygenType'): outfile.write(' version=%s' % (self.format_string(quote_attrib(self.version).encode(ExternalEncoding), input_name='version'), )) def exportChildren(self, outfile, level, namespace_='', name_='DoxygenType'): for compound_ in self.compound: compound_.export(outfile, level, namespace_, name_='compound') def hasContent_(self): if ( self.compound is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='DoxygenType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.version is not None: showIndent(outfile, level) outfile.write('version = %s,\n' % (self.version,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('compound=[\n') level += 1 for compound in self.compound: showIndent(outfile, level) outfile.write('model_.compound(\n') compound.exportLiteral(outfile, level, name_='compound') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('version'): self.version = attrs.get('version').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'compound': obj_ = CompoundType.factory() obj_.build(child_) self.compound.append(obj_) # end class DoxygenType class CompoundType(GeneratedsSuper): subclass = None superclass = None def __init__(self, kind=None, refid=None, name=None, member=None): self.kind = kind self.refid = refid self.name = name if member is None: self.member = [] else: self.member = member def factory(*args_, **kwargs_): if CompoundType.subclass: return CompoundType.subclass(*args_, **kwargs_) else: return CompoundType(*args_, **kwargs_) factory = staticmethod(factory) def get_name(self): return self.name def set_name(self, name): self.name = name def get_member(self): return self.member def set_member(self, member): self.member = member def add_member(self, value): self.member.append(value) def insert_member(self, index, value): self.member[index] = value def get_kind(self): return self.kind def set_kind(self, kind): self.kind = kind def get_refid(self): return self.refid def set_refid(self, refid): self.refid = refid def export(self, outfile, level, namespace_='', name_='CompoundType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='CompoundType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='CompoundType'): outfile.write(' kind=%s' % (quote_attrib(self.kind), )) outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), )) def exportChildren(self, outfile, level, namespace_='', name_='CompoundType'): if self.name is not None: showIndent(outfile, level) outfile.write('<%sname>%s\n' % (namespace_, self.format_string(quote_xml(self.name).encode(ExternalEncoding), input_name='name'), namespace_)) for member_ in self.member: member_.export(outfile, level, namespace_, name_='member') def hasContent_(self): if ( self.name is not None or self.member is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='CompoundType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.kind is not None: showIndent(outfile, level) outfile.write('kind = "%s",\n' % (self.kind,)) if self.refid is not None: showIndent(outfile, level) outfile.write('refid = %s,\n' % (self.refid,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('name=%s,\n' % quote_python(self.name).encode(ExternalEncoding)) showIndent(outfile, level) outfile.write('member=[\n') level += 1 for member in self.member: showIndent(outfile, level) outfile.write('model_.member(\n') member.exportLiteral(outfile, level, name_='member') showIndent(outfile, level) outfile.write('),\n') level -= 1 showIndent(outfile, level) outfile.write('],\n') def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('kind'): self.kind = attrs.get('kind').value if attrs.get('refid'): self.refid = attrs.get('refid').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'name': name_ = '' for text__content_ in child_.childNodes: name_ += text__content_.nodeValue self.name = name_ elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'member': obj_ = MemberType.factory() obj_.build(child_) self.member.append(obj_) # end class CompoundType class MemberType(GeneratedsSuper): subclass = None superclass = None def __init__(self, kind=None, refid=None, name=None): self.kind = kind self.refid = refid self.name = name def factory(*args_, **kwargs_): if MemberType.subclass: return MemberType.subclass(*args_, **kwargs_) else: return MemberType(*args_, **kwargs_) factory = staticmethod(factory) def get_name(self): return self.name def set_name(self, name): self.name = name def get_kind(self): return self.kind def set_kind(self, kind): self.kind = kind def get_refid(self): return self.refid def set_refid(self, refid): self.refid = refid def export(self, outfile, level, namespace_='', name_='MemberType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) self.exportAttributes(outfile, level, namespace_, name_='MemberType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) showIndent(outfile, level) outfile.write('\n' % (namespace_, name_)) else: outfile.write(' />\n') def exportAttributes(self, outfile, level, namespace_='', name_='MemberType'): outfile.write(' kind=%s' % (quote_attrib(self.kind), )) outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), )) def exportChildren(self, outfile, level, namespace_='', name_='MemberType'): if self.name is not None: showIndent(outfile, level) outfile.write('<%sname>%s\n' % (namespace_, self.format_string(quote_xml(self.name).encode(ExternalEncoding), input_name='name'), namespace_)) def hasContent_(self): if ( self.name is not None ): return True else: return False def exportLiteral(self, outfile, level, name_='MemberType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) def exportLiteralAttributes(self, outfile, level, name_): if self.kind is not None: showIndent(outfile, level) outfile.write('kind = "%s",\n' % (self.kind,)) if self.refid is not None: showIndent(outfile, level) outfile.write('refid = %s,\n' % (self.refid,)) def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('name=%s,\n' % quote_python(self.name).encode(ExternalEncoding)) def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) def buildAttributes(self, attrs): if attrs.get('kind'): self.kind = attrs.get('kind').value if attrs.get('refid'): self.refid = attrs.get('refid').value def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'name': name_ = '' for text__content_ in child_.childNodes: name_ += text__content_.nodeValue self.name = name_ # end class MemberType USAGE_TEXT = """ Usage: python .py [ -s ] Options: -s Use the SAX parser, not the minidom parser. """ def usage(): print USAGE_TEXT sys.exit(1) def parse(inFileName): doc = minidom.parse(inFileName) rootNode = doc.documentElement rootObj = DoxygenType.factory() rootObj.build(rootNode) # Enable Python to collect the space used by the DOM. doc = None sys.stdout.write('\n') rootObj.export(sys.stdout, 0, name_="doxygenindex", namespacedef_='') return rootObj def parseString(inString): doc = minidom.parseString(inString) rootNode = doc.documentElement rootObj = DoxygenType.factory() rootObj.build(rootNode) # Enable Python to collect the space used by the DOM. doc = None sys.stdout.write('\n') rootObj.export(sys.stdout, 0, name_="doxygenindex", namespacedef_='') return rootObj def parseLiteral(inFileName): doc = minidom.parse(inFileName) rootNode = doc.documentElement rootObj = DoxygenType.factory() rootObj.build(rootNode) # Enable Python to collect the space used by the DOM. doc = None sys.stdout.write('from index import *\n\n') sys.stdout.write('rootObj = doxygenindex(\n') rootObj.exportLiteral(sys.stdout, 0, name_="doxygenindex") sys.stdout.write(')\n') return rootObj def main(): args = sys.argv[1:] if len(args) == 1: parse(args[0]) else: usage() if __name__ == '__main__': main() #import pdb #pdb.run('main()') gr-gsm-0.41.2/docs/doxygen/doxyxml/text.py000066400000000000000000000034501316153413000204400ustar00rootroot00000000000000# # Copyright 2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # """ Utilities for extracting text from generated classes. """ def is_string(txt): if isinstance(txt, str): return True try: if isinstance(txt, unicode): return True except NameError: pass return False def description(obj): if obj is None: return None return description_bit(obj).strip() def description_bit(obj): if hasattr(obj, 'content'): contents = [description_bit(item) for item in obj.content] result = ''.join(contents) elif hasattr(obj, 'content_'): contents = [description_bit(item) for item in obj.content_] result = ''.join(contents) elif hasattr(obj, 'value'): result = description_bit(obj.value) elif is_string(obj): return obj else: raise StandardError('Expecting a string or something with content, content_ or value attribute') # If this bit is a paragraph then add one some line breaks. if hasattr(obj, 'name') and obj.name == 'para': result += "\n\n" return result gr-gsm-0.41.2/docs/doxygen/other/000077500000000000000000000000001316153413000165155ustar00rootroot00000000000000gr-gsm-0.41.2/docs/doxygen/other/group_defs.dox000066400000000000000000000003131316153413000213630ustar00rootroot00000000000000/*! * \defgroup block GNU Radio GSM C++ Signal Processing Blocks * \brief All C++ blocks that can be used from the GSM GNU Radio * module are listed here or in the subcategories below. * */ gr-gsm-0.41.2/docs/doxygen/other/main_page.dox000066400000000000000000000004131316153413000211470ustar00rootroot00000000000000/*! \mainpage Welcome to the GNU Radio GSM Block This is the intro page for the Doxygen manual generated for the GSM block (docs/doxygen/other/main_page.dox). Edit it to add more detailed documentation about the new GNU Radio modules contained in this project. */ gr-gsm-0.41.2/docs/doxygen/swig_doc.py000066400000000000000000000207211316153413000175460ustar00rootroot00000000000000# # Copyright 2010,2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # """ Creates the swig_doc.i SWIG interface file. Execute using: python swig_doc.py xml_path outputfilename The file instructs SWIG to transfer the doxygen comments into the python docstrings. """ import sys try: from doxyxml import DoxyIndex, DoxyClass, DoxyFriend, DoxyFunction, DoxyFile, base except ImportError: from gnuradio.doxyxml import DoxyIndex, DoxyClass, DoxyFriend, DoxyFunction, DoxyFile, base def py_name(name): bits = name.split('_') return '_'.join(bits[1:]) def make_name(name): bits = name.split('_') return bits[0] + '_make_' + '_'.join(bits[1:]) class Block(object): """ Checks if doxyxml produced objects correspond to a gnuradio block. """ @classmethod def includes(cls, item): if not isinstance(item, DoxyClass): return False # Check for a parsing error. if item.error(): return False return item.has_member(make_name(item.name()), DoxyFriend) def utoascii(text): """ Convert unicode text into ascii and escape quotes. """ if text is None: return '' out = text.encode('ascii', 'replace') out = out.replace('"', '\\"') return out def combine_descriptions(obj): """ Combines the brief and detailed descriptions of an object together. """ description = [] bd = obj.brief_description.strip() dd = obj.detailed_description.strip() if bd: description.append(bd) if dd: description.append(dd) return utoascii('\n\n'.join(description)).strip() entry_templ = '%feature("docstring") {name} "{docstring}"' def make_entry(obj, name=None, templ="{description}", description=None): """ Create a docstring entry for a swig interface file. obj - a doxyxml object from which documentation will be extracted. name - the name of the C object (defaults to obj.name()) templ - an optional template for the docstring containing only one variable named 'description'. description - if this optional variable is set then it's value is used as the description instead of extracting it from obj. """ if name is None: name=obj.name() if "operator " in name: return '' if description is None: description = combine_descriptions(obj) docstring = templ.format(description=description) if not docstring: return '' return entry_templ.format( name=name, docstring=docstring, ) def make_func_entry(func, name=None, description=None, params=None): """ Create a function docstring entry for a swig interface file. func - a doxyxml object from which documentation will be extracted. name - the name of the C object (defaults to func.name()) description - if this optional variable is set then it's value is used as the description instead of extracting it from func. params - a parameter list that overrides using func.params. """ if params is None: params = func.params params = [prm.declname for prm in params] if params: sig = "Params: (%s)" % ", ".join(params) else: sig = "Params: (NONE)" templ = "{description}\n\n" + sig return make_entry(func, name=name, templ=utoascii(templ), description=description) def make_class_entry(klass, description=None): """ Create a class docstring for a swig interface file. """ output = [] output.append(make_entry(klass, description=description)) for func in klass.in_category(DoxyFunction): name = klass.name() + '::' + func.name() output.append(make_func_entry(func, name=name)) return "\n\n".join(output) def make_block_entry(di, block): """ Create class and function docstrings of a gnuradio block for a swig interface file. """ descriptions = [] # Get the documentation associated with the class. class_desc = combine_descriptions(block) if class_desc: descriptions.append(class_desc) # Get the documentation associated with the make function make_func = di.get_member(make_name(block.name()), DoxyFunction) make_func_desc = combine_descriptions(make_func) if make_func_desc: descriptions.append(make_func_desc) # Get the documentation associated with the file try: block_file = di.get_member(block.name() + ".h", DoxyFile) file_desc = combine_descriptions(block_file) if file_desc: descriptions.append(file_desc) except base.Base.NoSuchMember: # Don't worry if we can't find a matching file. pass # And join them all together to make a super duper description. super_description = "\n\n".join(descriptions) # Associate the combined description with the class and # the make function. output = [] output.append(make_class_entry(block, description=super_description)) creator = block.get_member(block.name(), DoxyFunction) output.append(make_func_entry(make_func, description=super_description, params=creator.params)) return "\n\n".join(output) def make_swig_interface_file(di, swigdocfilename, custom_output=None): output = [""" /* * This file was automatically generated using swig_doc.py. * * Any changes to it will be lost next time it is regenerated. */ """] if custom_output is not None: output.append(custom_output) # Create docstrings for the blocks. blocks = di.in_category(Block) make_funcs = set([]) for block in blocks: try: make_func = di.get_member(make_name(block.name()), DoxyFunction) make_funcs.add(make_func.name()) output.append(make_block_entry(di, block)) except block.ParsingError: print('Parsing error for block %s' % block.name()) # Create docstrings for functions # Don't include the make functions since they have already been dealt with. funcs = [f for f in di.in_category(DoxyFunction) if f.name() not in make_funcs] for f in funcs: try: output.append(make_func_entry(f)) except f.ParsingError: print('Parsing error for function %s' % f.name()) # Create docstrings for classes block_names = [block.name() for block in blocks] klasses = [k for k in di.in_category(DoxyClass) if k.name() not in block_names] for k in klasses: try: output.append(make_class_entry(k)) except k.ParsingError: print('Parsing error for class %s' % k.name()) # Docstrings are not created for anything that is not a function or a class. # If this excludes anything important please add it here. output = "\n\n".join(output) swig_doc = file(swigdocfilename, 'w') swig_doc.write(output) swig_doc.close() if __name__ == "__main__": # Parse command line options and set up doxyxml. err_msg = "Execute using: python swig_doc.py xml_path outputfilename" if len(sys.argv) != 3: raise StandardError(err_msg) xml_path = sys.argv[1] swigdocfilename = sys.argv[2] di = DoxyIndex(xml_path) # gnuradio.gr.msq_queue.insert_tail and delete_head create errors unless docstrings are defined! # This is presumably a bug in SWIG. #msg_q = di.get_member(u'gr_msg_queue', DoxyClass) #insert_tail = msg_q.get_member(u'insert_tail', DoxyFunction) #delete_head = msg_q.get_member(u'delete_head', DoxyFunction) output = [] #output.append(make_func_entry(insert_tail, name='gr_py_msg_queue__insert_tail')) #output.append(make_func_entry(delete_head, name='gr_py_msg_queue__delete_head')) custom_output = "\n\n".join(output) # Generate the docstrings interface file. make_swig_interface_file(di, swigdocfilename, custom_output=custom_output) gr-gsm-0.41.2/docs/grgsm_livemon.rst000066400000000000000000000021631316153413000173230ustar00rootroot00000000000000============= grgsm_livemon ============= ------------------------------------------------------- GSM C0 monitor forwarding packages to network interface ------------------------------------------------------- :Author: Piotr Krysik - ptrkrysik@gmail.com :Date: 2017-08-21 :Copyright: public domain :Version: 0.0 :Manual section: 1 :Manual group: User Commands SYNOPSIS ======== grgsm_livemon [options] DESCRIPTION =========== Interactive monitor of a single C0 channel with analysis performed by Wireshark. Example command to run wireshark: sudo wireshark -k -f udp -Y gsmtap -i lo OPTIONS ======= -h, --help show this help message and exit --args=ARGS Set Device Arguments [default=] -g GAIN, --gain=GAIN Set gain [default=30] --osr=OSR Set OverSampling Ratio [default=4] -p PPM, --ppm=PPM Set ppm [default=0] -s SAMP_RATE, --samp-rate=SAMP_RATE Set samp_rate [default=2M] -o SHIFTOFF, --shiftoff=SHIFTOFF Set Frequency Shiftoff [default=400k] -f FC, --fc=FC Set GSM channel's central frequency [default=941.8M] SEE ALSO ======== * ``__ * ``grgsm_scanner(1)`` gr-gsm-0.41.2/examples/000077500000000000000000000000001316153413000146055ustar00rootroot00000000000000gr-gsm-0.41.2/grc/000077500000000000000000000000001316153413000135425ustar00rootroot00000000000000gr-gsm-0.41.2/grc/CMakeLists.txt000066400000000000000000000020031316153413000162750ustar00rootroot00000000000000# Copyright 2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. add_subdirectory(decoding) add_subdirectory(decryption) add_subdirectory(demapping) add_subdirectory(receiver) add_subdirectory(flow_control) add_subdirectory(misc_utils) install(FILES gsm_block_tree.xml DESTINATION share/gnuradio/grc/blocks ) gr-gsm-0.41.2/grc/decoding/000077500000000000000000000000001316153413000153165ustar00rootroot00000000000000gr-gsm-0.41.2/grc/decoding/CMakeLists.txt000066400000000000000000000016061316153413000200610ustar00rootroot00000000000000# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. install(FILES gsm_control_channels_decoder.xml gsm_tch_f_decoder.xml DESTINATION share/gnuradio/grc/blocks ) gr-gsm-0.41.2/grc/decoding/gsm_control_channels_decoder.xml000066400000000000000000000005561316153413000237340ustar00rootroot00000000000000 Control channels decoder gsm_control_channels_decoder import grgsm grgsm.control_channels_decoder() bursts message msgs message 1 gr-gsm-0.41.2/grc/decoding/gsm_tch_f_decoder.xml000066400000000000000000000040031316153413000214530ustar00rootroot00000000000000 TCH/F decoder gsm_tch_f_decoder import grgsm grgsm.tch_f_decoder($mode, $boundary_check) TCH coding mode mode enum Voice boundary detection boundary_check False bool bursts message msgs message 1 voice message 1 If "Voice boundary detection" is enabled, then only bursts are decoded as voice where - the framenumber is greater then the framenumber of a received "Connect" or "Connect Acknowlegde" message, and - the framenumber is less then the framenumber of a "Release" message gr-gsm-0.41.2/grc/decryption/000077500000000000000000000000001316153413000157225ustar00rootroot00000000000000gr-gsm-0.41.2/grc/decryption/CMakeLists.txt000066400000000000000000000015301316153413000204610ustar00rootroot00000000000000# Copyright 2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. install(FILES gsm_decryption.xml DESTINATION share/gnuradio/grc/blocks ) gr-gsm-0.41.2/grc/decryption/gsm_decryption.xml000066400000000000000000000012071316153413000214720ustar00rootroot00000000000000 Decryption gsm_decryption import grgsm grgsm.decryption($k_c, $a5_version) Kc session key k_c [0,0,0,0,0,0,0,0] int_vector A5 version a5_version 1 int $a5_version > 0 $a5_version < 5 bursts message bursts message gr-gsm-0.41.2/grc/demapping/000077500000000000000000000000001316153413000155065ustar00rootroot00000000000000gr-gsm-0.41.2/grc/demapping/CMakeLists.txt000066400000000000000000000017621316153413000202540ustar00rootroot00000000000000# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. install(FILES gsm_universal_ctrl_chans_demapper.xml gsm_bcch_ccch_demapper.xml gsm_bcch_ccch_sdcch4_demapper.xml gsm_sdcch8_demapper.xml gsm_tch_f_chans_demapper.xml DESTINATION share/gnuradio/grc/blocks ) gr-gsm-0.41.2/grc/demapping/gsm_bcch_ccch_demapper.xml000066400000000000000000000014641316153413000226370ustar00rootroot00000000000000 BCCH + CCCH Demapper gsm_bcch_ccch_demapper import grgsm grgsm.gsm_bcch_ccch_demapper( timeslot_nr=$timeslot_nr, ) set_timeslot_nr($timeslot_nr) timeslot_nr timeslot_nr 0 raw bursts message 1 bursts message 1 Piotr Krysik Demapper for BCCH + CCCH control channels. This corresponds to channel combination iv specified in GSM 05.02, section 6.4 gr-gsm/hier_blocks/demapping/gsm_bcch_ccch_demapper.grc gr-gsm-0.41.2/grc/demapping/gsm_bcch_ccch_sdcch4_demapper.xml000066400000000000000000000015471316153413000240710ustar00rootroot00000000000000 BCCH + CCCH + SDCCH/4 Demapper gsm_bcch_ccch_sdcch4_demapper import grgsm grgsm.gsm_bcch_ccch_sdcch4_demapper( timeslot_nr=$timeslot_nr, ) set_timeslot_nr($timeslot_nr) timeslot_nr timeslot_nr 0 raw bursts message 1 bursts message 1 Piotr Krysik Demapper for BCCH + CCCH + SDCCH/4 + SACCH/C4 control channels. This corresponds to channel combination v specified in GSM 05.02, section 6.4 gr-gsm/hier_blocks/demapping/gsm_bcch_ccch_sdcch4_demapper.grc gr-gsm-0.41.2/grc/demapping/gsm_sdcch8_demapper.xml000066400000000000000000000014571316153413000221360ustar00rootroot00000000000000 SDCCH/8 Demapper gsm_sdcch8_demapper import grgsm grgsm.gsm_sdcch8_demapper( timeslot_nr=$timeslot_nr, ) set_timeslot_nr($timeslot_nr) timeslot_nr timeslot_nr 1 raw bursts message 1 bursts message 1 Piotr Krysik Demapper for SDCCH/8 + SACCH/C8 control channels. This corresponds to channel combination vii specified in GSM 05.02, section 6.4 gr-gsm/hier_blocks/demapping/gsm_sdcch8_demapper.grc gr-gsm-0.41.2/grc/demapping/gsm_tch_f_chans_demapper.xml000066400000000000000000000012001316153413000232030ustar00rootroot00000000000000 TCH/F Demapper gsm_tch_f_chans_demapper import grgsm grgsm.tch_f_chans_demapper($timeslot_nr) timeslot_nr timeslot_nr 2 int part bursts message 1 tch_bursts message 1 acch_bursts message 1 gr-gsm-0.41.2/grc/demapping/gsm_universal_ctrl_chans_demapper.xml000066400000000000000000000045671316153413000251770ustar00rootroot00000000000000 Universal Control Channels Demapper gsm_universal_ctrl_chans_demapper import grgsm grgsm.universal_ctrl_chans_demapper($timeslot_nr, $downlink_starts_fn_mod51, $downlink_channel_types, $downlink_subslots, $uplink_starts_fn_mod51, $uplink_channel_types, $uplink_subslots) timeslot_nr timeslot_nr 0 int part downlink_starts_fn_mod51 downlink_starts_fn_mod51 [0,0,2,2,2,2,6,6,6,6,0,0,12,12,12,12,16,16,16,16,0,0,22,22,22,22,26,26,26,26,0,0,32,32,32,32,36,36,36,36,0,0,42,42,42,42,46,46,46,46,0,] int_vector part downlink_channel_types downlink_channel_types [0,0,1,1,1,1,2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,] int_vector part downlink_subslots downlink_subslots [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,] int_vector part uplink_starts_fn_mod51 uplink_starts_fn_mod51 [0,0,0,0,0,0,6,6,6,6,10,10,10,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,37,37,37,41,41,41,41,0,0,47,47,47,47] int_vector part uplink_channel_types uplink_channel_types [2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,0,0,2,2,2,2,] int_vector part uplink_subslots uplink_subslots [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,] int_vector part bursts message bursts message Universal demapper for control channels. Author: Piotr Krysik gr-gsm-0.41.2/grc/flow_control/000077500000000000000000000000001316153413000162515ustar00rootroot00000000000000gr-gsm-0.41.2/grc/flow_control/CMakeLists.txt000066400000000000000000000020761316153413000210160ustar00rootroot00000000000000# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. install(FILES gsm_burst_timeslot_splitter.xml gsm_burst_fnr_filter.xml gsm_burst_timeslot_filter.xml gsm_dummy_burst_filter.xml gsm_burst_sdcch_subslot_splitter.xml gsm_burst_sdcch_subslot_filter.xml gsm_uplink_downlink_splitter.xml DESTINATION share/gnuradio/grc/blocks ) gr-gsm-0.41.2/grc/flow_control/gsm_burst_fnr_filter.xml000066400000000000000000000017411316153413000232150ustar00rootroot00000000000000 Burst Framenumber Filter gsm_burst_fnr_filter import grgsm grgsm.burst_fnr_filter($mode, $fnr) Mode mode enum Framenumber fnr 1500123 int in message out message 1 Burst framenumber filter forwards only blocks with a framenumber satisfying the configured mode, i.e. if mode is "Less or equal", then only bursts with a smaller or equal framenumber are forwarded. gr-gsm-0.41.2/grc/flow_control/gsm_burst_sdcch_subslot_filter.xml000066400000000000000000000015621316153413000252700ustar00rootroot00000000000000 Burst SDCCH Subslot Filter gsm_burst_sdcch_subslot_filter import grgsm grgsm.burst_sdcch_subslot_filter($mode, $subslot) Mode mode enum Subslot subslot 0 int none in message out message 1 This block forwards only bursts in the subslot given by the parameter gr-gsm-0.41.2/grc/flow_control/gsm_burst_sdcch_subslot_splitter.xml000066400000000000000000000017131316153413000256470ustar00rootroot00000000000000 Burst SDCCH Subslot Splitter gsm_burst_sdcch_subslot_splitter import grgsm grgsm.burst_sdcch_subslot_splitter( #if int($ports())==4 # grgsm.SPLITTER_SDCCH4 #else grgsm.SPLITTER_SDCCH8 #end if ) Mode ports enum in message out message $ports 1 Burst SDCCH subslot splitter distributes bursts to eight different output ports depending on the subslots to which the bursts belong. This means subslot 0 bursts are sent to port out0, subslot 1 bursts on port out1, and so on. gr-gsm-0.41.2/grc/flow_control/gsm_burst_timeslot_filter.xml000066400000000000000000000011141316153413000242620ustar00rootroot00000000000000 Burst Timeslot Filter gsm_burst_timeslot_filter import grgsm grgsm.burst_timeslot_filter($timeslot) Timeslot timeslot 0 int none in message out message 1 This block forwards only bursts in the timeslot given by the parameter gr-gsm-0.41.2/grc/flow_control/gsm_burst_timeslot_splitter.xml000066400000000000000000000011461316153413000246500ustar00rootroot00000000000000 Burst Timeslot Splitter gsm_burst_timeslot_splitter import grgsm grgsm.burst_timeslot_splitter() in message out message 8 1 Burst timeslot splitter distributes bursts to eight different output ports depending on the timeslots of the bursts. This means timeslot 0 bursts are sent to port out0, timeslot 1 bursts on port out1, and so on. gr-gsm-0.41.2/grc/flow_control/gsm_dummy_burst_filter.xml000066400000000000000000000007031316153413000235600ustar00rootroot00000000000000 Dummy Burst Filter gsm_dummy_burst_filter import grgsm grgsm.dummy_burst_filter() in message out message 1 This block filters dummy bursts. For more information on dummy bursts, see GSM 05.02. gr-gsm-0.41.2/grc/flow_control/gsm_uplink_downlink_splitter.xml000066400000000000000000000007551316153413000250050ustar00rootroot00000000000000 Up/Down-link splitter gsm_uplink_downlink_splitter import grgsm grgsm.uplink_downlink_splitter() in message 1 downlink message 1 uplink message 1 gr-gsm-0.41.2/grc/gsm_block_tree.xml000066400000000000000000000043421316153413000172460ustar00rootroot00000000000000 GSM Receiver gsm_receiver gsm_receiver_with_uplink gsm_cx_channel_hopper gsm_fcch_burst_tagger gsm_sch_detector gsm_fcch_detector gsm_clock_offset_control gsm_input Logical channels demapping gsm_universal_ctrl_chans_demapper gsm_bcch_ccch_demapper gsm_bcch_ccch_sdcch4_demapper gsm_sdcch8_demapper gsm_tch_f_chans_demapper Decryption gsm_decryption Decoding gsm_control_channels_decoder gsm_tch_f_decoder Flow control gsm_burst_timeslot_splitter gsm_burst_sdcch_subslot_splitter gsm_burst_timeslot_filter gsm_burst_sdcch_subslot_filter gsm_burst_fnr_filter gsm_dummy_burst_filter gsm_uplink_downlink_splitter Utilities gsm_bursts_printer gsm_burst_file_sink gsm_burst_file_source gsm_collect_system_info gsm_message_file_sink gsm_message_file_source gsm_extract_system_info gsm_extract_immediate_assignment gsm_extract_cmc gsm_controlled_rotator_cc gsm_controlled_fractional_resampler_cc gsm_message_printer gsm_clock_offset_corrector_tagged gsm_msg_to_tag.xml gsm_tmsi_dumper gr-gsm-0.41.2/grc/misc_utils/000077500000000000000000000000001316153413000157155ustar00rootroot00000000000000gr-gsm-0.41.2/grc/misc_utils/CMakeLists.txt000066400000000000000000000024401316153413000204550ustar00rootroot00000000000000# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. install(FILES gsm_extract_system_info.xml gsm_extract_immediate_assignment.xml gsm_collect_system_info.xml gsm_extract_cmc.xml gsm_controlled_rotator_cc.xml gsm_message_printer.xml gsm_bursts_printer.xml gsm_clock_offset_corrector_tagged.xml gsm_tmsi_dumper.xml gsm_burst_file_sink.xml gsm_burst_file_source.xml gsm_message_file_sink.xml gsm_message_file_source.xml gsm_msg_to_tag.xml gsm_controlled_fractional_resampler_cc.xml DESTINATION share/gnuradio/grc/blocks ) gr-gsm-0.41.2/grc/misc_utils/gsm_burst_file_sink.xml000066400000000000000000000006021316153413000224650ustar00rootroot00000000000000 Burst File Sink gsm_burst_file_sink import grgsm grgsm.burst_file_sink($filename) Destination file filename /tmp/bursts file_open in message gr-gsm-0.41.2/grc/misc_utils/gsm_burst_file_source.xml000066400000000000000000000006101316153413000230200ustar00rootroot00000000000000 Burst File Source gsm_burst_file_source import grgsm grgsm.burst_file_source($filename) Source file filename /tmp/bursts file_open out message gr-gsm-0.41.2/grc/misc_utils/gsm_bursts_printer.xml000066400000000000000000000045761316153413000224060ustar00rootroot00000000000000 Bursts Printer gsm_bursts_printer import grgsm import pmt grgsm.bursts_printer(pmt.intern($prepend_string), $prepend_fnr, $prepend_frame_count, $print_payload_only, $ignore_dummy_bursts) Prepend String prepend_string string part Prepend Frame Number prepend_fnr False bool Prepend Frame Count prepend_frame_count False bool Print payload only print_payload_only False bool Ignore dummy bursts ignore_dummy_bursts False bool bursts message This block prints bursts to output. By default the whole burst including tail bits, stealing bits and training sequence is printed. If "Prepend Frame Number" is enabled, then the framenumber is prepended to each burst. If "Prepend Frame Count" is enabled, then the frame count for A5 is prependend to each burst. If "Print payload only" is enabled, then only the two data blocks of a burst are printed, tail bits, stealing bits and training sequence are omitted. If "Ignore dummy bursts" is enabled, then the burst printer will not print dummy bursts (see GSM 05.02) Enabling first three options (or all four options) results in an output that is similar to the output of airprobe, i.e. the format is "frame_nr frame_count: databits" gr-gsm-0.41.2/grc/misc_utils/gsm_clock_offset_corrector_tagged.xml000066400000000000000000000023321316153413000253430ustar00rootroot00000000000000 Clock Offset Corrector Tagged gsm_clock_offset_corrector_tagged import grgsm grgsm.clock_offset_corrector_tagged( fc=$fc, samp_rate_in=$samp_rate_in, ppm=$ppm, osr=$osr ) set_fc($fc) set_ppm($ppm) set_samp_rate_in($samp_rate_in) set_osr($osr) fc fc 936.6e6 raw ppm ppm 0 raw samp_rate_in samp_rate_in 1625000.0/6.0*4.0 raw OSR osr osr raw ctrl message 1 in complex 1 out complex 1 Piotr Krysik Clock offset corrector with blocks that use tags to switch offsets gr-gsm-0.41.2/grc/misc_utils/gsm_collect_system_info.xml000077500000000000000000000011551316153413000233560ustar00rootroot00000000000000 Collect System Info gsm_collect_system_info import grgsm grgsm.collect_system_info() msgs message This blocks collect System Information Messages, which can be retrieved using the following methods: get_framenumbers(): Get the list with the framenumbers of the System Information Messages get_system_information_type(): Get the types of the System Information Messages get_data(): Get the whole System Information Messages in Hex representation gr-gsm-0.41.2/grc/misc_utils/gsm_controlled_fractional_resampler_cc.xml000066400000000000000000000011521316153413000263720ustar00rootroot00000000000000 Controlled Fractional Resampler gsm_controlled_fractional_resampler_cc import grgsm grgsm.controlled_fractional_resampler_cc($phase_shift, $resamp_ratio) set_resamp_ratio($resamp_ratio) Phase Shift phase_shift real Resampling Ratio resamp_ratio real in complex out complex gr-gsm-0.41.2/grc/misc_utils/gsm_controlled_rotator_cc.xml000066400000000000000000000007621316153413000236760ustar00rootroot00000000000000 Controlled Rotator gsm_controlled_rotator_cc import grgsm grgsm.controlled_rotator_cc($phase_inc) set_phase_inc($phase_inc) phase_inc phase_inc 0 real in complex out complex gr-gsm-0.41.2/grc/misc_utils/gsm_extract_cmc.xml000077500000000000000000000007531316153413000216110ustar00rootroot00000000000000 Extract Cipher Mode Command gsm_extract_cmc import grgsm grgsm.extract_cmc() msgs message Extracts the framenumber and the assigned encryption algorithm from Cipher Mode Commands. Input: decoded control channel messages The information can be retrieved using following functions: get_frame_numbers(), get_a5_versions() gr-gsm-0.41.2/grc/misc_utils/gsm_extract_immediate_assignment.xml000066400000000000000000000036061316153413000252320ustar00rootroot00000000000000 Extract Immediate Assignment gsm_extract_immediate_assignment import grgsm grgsm.extract_immediate_assignment($print_immediate_assignments, $ignore_gprs, $unique_references) Print print_immediate_assignments False bool Ignore GPRS ignore_gprs False bool Unique per request ref unique_references False bool msgs message Extracts the assignment information from immediate assignments, i.e. timeslot, channel type, etc. Input: decoded control channel messages If "Print" is enabled, the information will be printed to output also, else the data can be retrieved using functions: get_frame_numbers(), get_channel_types(), get_timeslots(), get_subchannels(), get_hopping(), get_maios(), get_hsns(), get_arfcns(), get_timing_advances(), get_mobile_allocations() If "Ignore GPRS" is enabled, the extractor will ignore Immediate Assignments that assign GPRS channels. If "Unique per request ref" is enabled, the extractor will capture the first Immediate Assignment for every unique request reference, and ignore further duplicate assignments gr-gsm-0.41.2/grc/misc_utils/gsm_extract_system_info.xml000066400000000000000000000005051316153413000233760ustar00rootroot00000000000000 Extract System Info gsm_extract_system_info import grgsm grgsm.extract_system_info() msgs message bursts message gr-gsm-0.41.2/grc/misc_utils/gsm_message_file_sink.xml000066400000000000000000000007231316153413000227560ustar00rootroot00000000000000 Message File Sink gsm_message_file_sink import grgsm grgsm.message_file_sink($filename) Destination file filename /tmp/output.msg file_open in message This block stores incoming gsm messages to a file. gr-gsm-0.41.2/grc/misc_utils/gsm_message_file_source.xml000066400000000000000000000007301316153413000233100ustar00rootroot00000000000000 Message File Source gsm_message_file_source import grgsm grgsm.message_file_source($filename) Source file filename /tmp/output.msg file_open out message This block outputs gsm messages stored in a file. gr-gsm-0.41.2/grc/misc_utils/gsm_message_printer.xml000066400000000000000000000025271316153413000225020ustar00rootroot00000000000000 Message Printer gsm_message_printer import grgsm import pmt grgsm.message_printer(pmt.intern($prepend_string), $prepend_fnr, $prepend_frame_count, $print_gsmtap_header) Prepend String prepend_string string part Prepend Frame Number prepend_fnr False bool Prepend Frame Count prepend_frame_count False bool Print GSMTap header print_gsmtap_header False bool msgs message gr-gsm-0.41.2/grc/misc_utils/gsm_msg_to_tag.xml000066400000000000000000000006071316153413000214330ustar00rootroot00000000000000 Message To Tag gsm_msg_to_tag import grgsm grgsm.msg_to_tag() in complex msg message 1 out complex gr-gsm-0.41.2/grc/misc_utils/gsm_tmsi_dumper.xml000066400000000000000000000004031316153413000216320ustar00rootroot00000000000000 TMSI Dumper gsm_tmsi_dumper import grgsm import pmt grgsm.tmsi_dumper() msgs message gr-gsm-0.41.2/grc/qa_utils/000077500000000000000000000000001316153413000153635ustar00rootroot00000000000000gr-gsm-0.41.2/grc/qa_utils/CMakeLists.txt000066400000000000000000000016521316153413000201270ustar00rootroot00000000000000# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. install(FILES gsm_burst_source.xml gsm_burst_sink.xml gsm_message_source.xml gsm_message_sink.xml DESTINATION share/gnuradio/grc/blocks ) gr-gsm-0.41.2/grc/qa_utils/gsm_burst_sink.xml000066400000000000000000000003401316153413000211330ustar00rootroot00000000000000 Burst Sink gsm_burst_sink import grgsm grgsm.burst_sink() in message gr-gsm-0.41.2/grc/qa_utils/gsm_burst_source.xml000066400000000000000000000012521316153413000214720ustar00rootroot00000000000000 Burst Source gsm_burst_source import grgsm grgsm.burst_source($framenumbers, $timeslots, $bursts) Frame numbers framenumbers [] int_vector part Timeslots timeslots [] int_vector part Bursts bursts [[],] raw out message gr-gsm-0.41.2/grc/qa_utils/gsm_message_sink.xml000066400000000000000000000005471316153413000214310ustar00rootroot00000000000000 Message Sink gsm_message_sink import grgsm grgsm.message_sink() in message This block is a message sink for testing purposes. The data can be retrieved using function get_messages() gr-gsm-0.41.2/grc/qa_utils/gsm_message_source.xml000066400000000000000000000022741316153413000217640ustar00rootroot00000000000000 Message Source gsm_message_source import grgsm grgsm.message_source($messages) Messages messages ["02 04 01 00 00 00 c9 00 00 1d 3c e5 02 00 01 00 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b", "02 04 01 00 00 00 ca 00 00 1d 3c e9 02 00 02 00 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b", "02 04 01 00 00 00 cb 00 00 1d 3d 0e 01 00 00 00 59 06 1a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff e5 04 00", "02 04 01 00 00 00 cb 00 00 1d 3d 12 02 00 00 00 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b"] raw true msgs message This block is a basic message source for testing purposes. It takes a list of strings as input, where each string is a whitespace-separated list of hexadecimal values representing the data bytes of a message including the gsmtap header. Such strings can be obtained using the message printer with option "Print GSMTap header" gr-gsm-0.41.2/grc/receiver/000077500000000000000000000000001316153413000153465ustar00rootroot00000000000000gr-gsm-0.41.2/grc/receiver/CMakeLists.txt000066400000000000000000000020361316153413000201070ustar00rootroot00000000000000# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. install(FILES gsm_input.xml gsm_receiver.xml gsm_receiver_with_uplink.xml gsm_fcch_burst_tagger.xml gsm_sch_detector.xml gsm_fcch_detector.xml gsm_cx_channel_hopper.xml gsm_clock_offset_control.xml DESTINATION share/gnuradio/grc/blocks ) gr-gsm-0.41.2/grc/receiver/gsm_clock_offset_control.xml000066400000000000000000000013521316153413000231400ustar00rootroot00000000000000 GSM Clock Offset Control gsm_clock_offset_control import grgsm grgsm.clock_offset_control($fc, $samp_rate, $osr) fc fc fc float OSR osr osr int samp_rate samp_rate samp_rate float measurements message ctrl message 1 gr-gsm-0.41.2/grc/receiver/gsm_cx_channel_hopper.xml000066400000000000000000000011431316153413000224140ustar00rootroot00000000000000 CX Channel Hopper gsm_cx_channel_hopper import grgsm grgsm.cx_channel_hopper($ma, $maio, $hsn) MA ma [] int_vector MAIO maio int HSN hsn int CX message bursts message gr-gsm-0.41.2/grc/receiver/gsm_fcch_burst_tagger.xml000066400000000000000000000007311316153413000224120ustar00rootroot00000000000000 FCCH Burst Tagger gsm_fcch_burst_tagger import grgsm grgsm.fcch_burst_tagger($OSR) OSR OSR int in complex threshold float out complex gr-gsm-0.41.2/grc/receiver/gsm_fcch_detector.xml000066400000000000000000000015551316153413000215400ustar00rootroot00000000000000 FCCH Bursts Detector gsm_fcch_detector import grgsm grgsm.fcch_detector($OSR) set_OSR($OSR) OverSamplingRatio OSR 4 int in complex 1 out complex 1 Piotr Krysik Detects positions of FCCH bursts. At the end of each detected FCCH burst adds to the stream a tag with key "fcch" and value which is a frequency offset estimate. The input sampling frequency should be integer multiply of GSM GMKS symbol rate - 1625000/6 Hz. /home/piotr/Odbiornik_gsm/gr-gsm/examples/gsm_fcch_detector.grc gr-gsm-0.41.2/grc/receiver/gsm_input.xml000066400000000000000000000026521316153413000201020ustar00rootroot00000000000000 GSM Input Adaptor gsm_input import grgsm grgsm.gsm_input( ppm=$ppm, osr=$osr, fc=$fc, samp_rate_in=$samp_rate_in, ) set_ppm($ppm) set_osr($osr) set_fc($fc) set_samp_rate_in($samp_rate_in) ppm ppm ppm float part OSR osr osr int part fc fc fc float part samp_rate_in samp_rate_in samp_rate_in float part in complex 1 ctrl_in message True out complex 1 Piotr Krysik Adaptor of input stream for the GSM receiver. Contains frequency offset corrector and resampler to correct carrier frequency and sampling frequency offsets. At the end it has LP filter for filtering of a GSM channel. gr-gsm-0.41.2/grc/receiver/gsm_receiver.xml000066400000000000000000000022701316153413000205430ustar00rootroot00000000000000 GSM Receiver gsm_receiver import grgsm grgsm.receiver($osr, $cell_allocation, $tseq_nums, False) Oversampling ratio osr 4 int Cell allocation cell_allocation [0] float_vector part TSEQ numbers tseq_nums [] int_vector part Num Streams num_streams 1 int part $num_streams >= 0 in complex $num_streams C0 message 1 CX message 1 measurements message 1 gr-gsm-0.41.2/grc/receiver/gsm_receiver_with_uplink.xml000066400000000000000000000024671316153413000231700ustar00rootroot00000000000000 GSM Receiver (with uplink) gsm_receiver_with_uplink import grgsm grgsm.receiver($osr, $cell_allocation, $tseq_nums, True) Oversampling ratio osr 4 int Cell allocation cell_allocation [0] float_vector part TSEQ numbers tseq_nums [] int_vector part Num Streams num_streams 1 int part $num_streams >= 0 C complex $num_streams C_up complex $num_streams C0 message 1 CX message 1 measurements message 1 gr-gsm-0.41.2/grc/receiver/gsm_sch_detector.xml000066400000000000000000000007031316153413000214040ustar00rootroot00000000000000 SCH Bursts Detector gsm_sch_detector import grgsm grgsm.sch_detector($OSR) set_OSR($OSR) OSR OSR 4 int in complex out complex gr-gsm-0.41.2/hier_blocks/000077500000000000000000000000001316153413000152535ustar00rootroot00000000000000gr-gsm-0.41.2/hier_blocks/compile_demappers000077500000000000000000000013671316153413000207000ustar00rootroot00000000000000#!/bin/bash #This is just helper script for manual compilation of hierarhical blocks #by gr-gsm developers #Author: Piotr Krysik cd demapping for p in *.grc do echo $p grcc $p -d `pwd` done cd .. mv ~/.grc_gnuradio/gsm_* . for file in *.py.xml do cat $file | sed 's/.*\.*/ import grgsm<\/import>/' \ | sed 's//grgsm./' \ | sed "s/.*.py//" \ | sed 's/.*hier_blocks/gr-gsm\/hier_blocks/' \ > ${file}2 mv ${file}2 $file mv "$file" "`basename $file .py.xml`.xml" done for py in *.py do cat $py |sed 's/gr.hier_block2/grgsm.hier_block/' > ${py}2 mv ${py}2 $py done mv *.py ../python/demapping mv *.xml ../grc/demappinggr-gsm-0.41.2/hier_blocks/demapping/000077500000000000000000000000001316153413000172175ustar00rootroot00000000000000gr-gsm-0.41.2/hier_blocks/demapping/gsm_bcch_ccch_demapper.grc000066400000000000000000000154451316153413000243270ustar00rootroot00000000000000 Tue May 17 17:08:42 2016 options author Piotr Krysik window_size category comment description Demapper for BCCH + CCCH control channels. This corresponds to channel combination iv specified in GSM 05.02, section 6.4 _enabled True _coordinate (8, 8) _rotation 0 generate_options hb hier_block_src_path .: id gsm_bcch_ccch_demapper max_nouts 0 qt_qss_theme realtime_scheduling run_command {python} -u {filename} run_options prompt run True thread_safe_setters title BCCH + CCCH demapper gsm_universal_ctrl_chans_demapper alias comment affinity _enabled True _coordinate (168, 193) _rotation 0 id gsm_universal_ctrl_chans_demapper_0 maxoutbuf 0 minoutbuf 0 downlink_channel_types [0,0,1,1,1,1,2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,] downlink_starts_fn_mod51 [0,0,2,2,2,2,6,6,6,6,0,0,12,12,12,12,16,16,16,16,0,0,22,22,22,22,26,26,26,26,0,0,32,32,32,32,36,36,36,36,0,0,42,42,42,42,46,46,46,46,0,] downlink_subslots [0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,0,0,3,3,3,3,4,4,4,4,0,0,5,5,5,5,6,6,6,6,0,0,7,7,7,7,8,8,8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,0,0,3,3,3,3,4,4,4,4,0,0,5,5,5,5,6,6,6,6,0,0,7,7,7,7,8,8,8,8,0] timeslot_nr timeslot_nr uplink_channel_types [2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,0,0,2,2,2,2,] uplink_starts_fn_mod51 [0,0,0,0,0,0,6,6,6,6,10,10,10,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,37,37,37,41,41,41,41,0,0,47,47,47,47] uplink_subslots [0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,0,0,3,3,3,3,0,0,0,0,0,0,2,2,2,2,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,0,0,3,3,3,3] pad_sink comment _enabled True _coordinate (424, 188) _rotation 0 id pad_sink_0 type message label bursts num_streams 1 optional True vlen 1 pad_source comment _enabled True _coordinate (32, 188) _rotation 0 id pad_source_0 label bursts num_streams 1 optional True type message vlen 1 parameter alias comment _enabled True _coordinate (192, 7) _rotation 0 id timeslot_nr label timeslot_nr short_id type intx value 0 gsm_universal_ctrl_chans_demapper_0 pad_sink_0 bursts in pad_source_0 gsm_universal_ctrl_chans_demapper_0 out bursts gr-gsm-0.41.2/hier_blocks/demapping/gsm_bcch_ccch_sdcch4_demapper.grc000066400000000000000000000155471316153413000255620ustar00rootroot00000000000000 Tue May 17 17:08:42 2016 options author Piotr Krysik window_size category comment description Demapper for BCCH + CCCH + SDCCH/4 + SACCH/C4 control channels. This corresponds to channel combination v specified in GSM 05.02, section 6.4 _enabled True _coordinate (8, 8) _rotation 0 generate_options hb hier_block_src_path .: id gsm_bcch_ccch_sdcch4_demapper max_nouts 0 qt_qss_theme realtime_scheduling run_command {python} -u {filename} run_options prompt run True thread_safe_setters title BCCH + CCCH + SDCCH/4 demapper gsm_universal_ctrl_chans_demapper alias comment affinity _enabled True _coordinate (168, 193) _rotation 0 id gsm_universal_ctrl_chans_demapper_0 maxoutbuf 0 minoutbuf 0 downlink_channel_types [0,0,1,1,1,1,2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,0,7,7,7,7,7,7,7,7,0,0,7,7,7,7,7,7,7,7,0,0,135,135,135,135,135,135,135,135,0] downlink_starts_fn_mod51 [0,0,2,2,2,2,6,6,6,6,0,0,12,12,12,12,16,16,16,16,0,0,22,22,22,22,26,26,26,26,0,0,32,32,32,32,36,36,36,36,0,0,42,42,42,42,46,46,46,46,0] downlink_subslots [0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,0,0,0,0,0,0,1,1,1,1,0,0,2,2,2,2,3,3,3,3,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,0,0,0,0,0,0,1,1,1,1,0,0,2,2,2,2,3,3,3,3,0,0,2,2,2,2,3,3,3,3,0] timeslot_nr timeslot_nr uplink_channel_types [7,7,7,7,0,0,135,135,135,135,135,135,135,135,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,7,7,7,7,7,7,7,0,0,7,7,7,7] uplink_starts_fn_mod51 [0,0,0,0,0,0,6,6,6,6,10,10,10,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,37,37,37,41,41,41,41,0,0,47,47,47,47] uplink_subslots [0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,0,0,3,3,3,3,0,0,0,0,0,0,2,2,2,2,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,0,0,3,3,3,3] pad_sink comment _enabled True _coordinate (416, 188) _rotation 0 id pad_sink_0 type message label bursts num_streams 1 optional True vlen 1 pad_source comment _enabled True _coordinate (32, 188) _rotation 0 id pad_source_0 label bursts num_streams 1 optional True type message vlen 1 parameter alias comment _enabled True _coordinate (192, 7) _rotation 0 id timeslot_nr label timeslot_nr short_id type intx value 0 gsm_universal_ctrl_chans_demapper_0 pad_sink_0 bursts in pad_source_0 gsm_universal_ctrl_chans_demapper_0 out bursts gr-gsm-0.41.2/hier_blocks/demapping/gsm_sdcch8_demapper.grc000066400000000000000000000155731316153413000236260ustar00rootroot00000000000000 Tue May 17 17:08:42 2016 options author Piotr Krysik window_size category comment description Demapper for SDCCH/8 + SACCH/C8 control channels. This corresponds to channel combination vii specified in GSM 05.02, section 6.4 _enabled True _coordinate (8, 8) _rotation 0 generate_options hb hier_block_src_path .: id gsm_sdcch8_demapper max_nouts 0 qt_qss_theme realtime_scheduling run_command {python} -u {filename} run_options prompt run True thread_safe_setters title SDCCH/8 demapper gsm_universal_ctrl_chans_demapper alias comment affinity _enabled True _coordinate (168, 193) _rotation 0 id gsm_universal_ctrl_chans_demapper_0 maxoutbuf 0 minoutbuf 0 downlink_channel_types [8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,0,0,0] downlink_starts_fn_mod51 [0,0,0,0,4,4,4,4,8,8,8,8,12,12,12,12,16,16,16,16,20,20,20,20,24,24,24,24,28,28,28,28,32,32,32,32,36,36,36,36,40,40,40,40,44,44,44,44,0,0,0] downlink_subslots [0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,0,0,0] timeslot_nr timeslot_nr uplink_channel_types [136,136,136,136,136,136,136,136,136,136,136,136,0,0,0,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,136,136,136,136] uplink_starts_fn_mod51 [0,0,0,0,4,4,4,4,8,8,8,8,0,0,0,15,15,15,15,19,19,19,19,23,23,23,23,27,27,27,27,31,31,31,31,35,35,35,35,39,39,39,39,43,43,43,43,47,47,47,47] uplink_subslots [1,1,1,1,2,2,2,2,3,3,3,3,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,0,0,0,0,5,5,5,5,6,6,6,6,7,7,7,7,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,4,4,4,4] pad_sink comment _enabled True _coordinate (416, 188) _rotation 0 id pad_sink_0 type message label bursts num_streams 1 optional True vlen 1 pad_source comment _enabled True _coordinate (32, 188) _rotation 0 id pad_source_0 label bursts num_streams 1 optional True type message vlen 1 parameter alias comment _enabled True _coordinate (192, 7) _rotation 0 id timeslot_nr label timeslot_nr short_id type intx value 1 gsm_universal_ctrl_chans_demapper_0 pad_sink_0 bursts in pad_source_0 gsm_universal_ctrl_chans_demapper_0 out bursts gr-gsm-0.41.2/hier_blocks/misc_utils/000077500000000000000000000000001316153413000174265ustar00rootroot00000000000000gr-gsm-0.41.2/hier_blocks/misc_utils/gsm_clock_offset_corrector_tagged.grc000066400000000000000000000306001316153413000270260ustar00rootroot00000000000000 Thu Nov 6 10:22:20 2014 options author Piotr Krysik window_size 2280, 1024 category GSM comment description Clock offset corrector with blocks that use tags to switch offsets _enabled True _coordinate (10, 10) _rotation 0 generate_options hb hier_block_src_path .: id clock_offset_corrector_tagged max_nouts 0 qt_qss_theme realtime_scheduling run_command {python} -u {filename} run_options prompt run True thread_safe_setters title Clock Offset Corrector Tagged variable comment _enabled True _coordinate (688, 21) _rotation 0 id gsm_symb_rate value 1625000.0/6.0 variable comment _enabled True _coordinate (808, 21) _rotation 0 id samp_rate_out value osr*gsm_symb_rate pad_source comment _enabled True _coordinate (32, 244) _rotation 0 id ctrl label ctrl num_streams 1 optional True type message vlen 1 parameter alias comment _enabled True _coordinate (274, 19) _rotation 0 id fc label fc short_id type eng_float value 936.6e6 gsm_controlled_fractional_resampler_cc alias comment affinity _enabled 1 _coordinate (344, 197) _rotation 0 id gsm_controlled_fractional_resampler_cc_0 maxoutbuf 0 minoutbuf 0 phase_shift 0 resamp_ratio (1-ppm/1.0e6)*(samp_rate_in/samp_rate_out) gsm_controlled_rotator_cc alias comment affinity _enabled True _coordinate (600, 204) _rotation 0 id gsm_controlled_rotator_cc_0 maxoutbuf 0 minoutbuf 0 phase_inc ppm/1.0e6*2*math.pi*fc/samp_rate_out gsm_msg_to_tag alias comment affinity _enabled True _coordinate (192, 193) _rotation 0 id gsm_msg_to_tag_0 maxoutbuf 0 minoutbuf 0 import alias comment _enabled True _coordinate (11, 125) _rotation 0 id math_imp import import math parameter alias comment _enabled True _coordinate (584, 23) _rotation 0 id osr label OSR short_id type intx value 4 pad_sink comment _enabled True _coordinate (776, 204) _rotation 0 id pad_sink_1 type complex label out num_streams 1 optional False vlen 1 pad_source comment _enabled True _coordinate (32, 188) _rotation 0 id pad_source_0 label in num_streams 1 optional False type complex vlen 1 parameter alias comment _enabled True _coordinate (496, 19) _rotation 0 id ppm label ppm short_id type eng_float value 0 parameter alias comment _enabled True _coordinate (368, 19) _rotation 0 id samp_rate_in label samp_rate_in short_id type eng_float value 1625000.0/6.0*4.0 ctrl gsm_msg_to_tag_0 out msg gsm_controlled_fractional_resampler_cc_0 gsm_controlled_rotator_cc_0 0 0 gsm_controlled_rotator_cc_0 pad_sink_1 0 0 gsm_msg_to_tag_0 gsm_controlled_fractional_resampler_cc_0 0 0 pad_source_0 gsm_msg_to_tag_0 0 0 gr-gsm-0.41.2/hier_blocks/receiver/000077500000000000000000000000001316153413000170575ustar00rootroot00000000000000gr-gsm-0.41.2/hier_blocks/receiver/gsm_fcch_detector.grc000066400000000000000000000276161316153413000232320ustar00rootroot00000000000000 Tue Jul 8 19:32:53 2014 variable id samp_rate _enabled True value f_symb*OSR _coordinate (10, 170) _rotation 0 variable id f_symb _enabled True value 1625000.0/6.0 _coordinate (11, 239) _rotation 0 parameter id OSR _enabled True label OverSamplingRatio value 4 type intx short_id _coordinate (264, 4) _rotation 0 blocks_complex_to_arg id blocks_complex_to_arg_0 _enabled True vlen 1 affinity minoutbuf 0 maxoutbuf 0 _coordinate (641, 158) _rotation 0 blocks_multiply_conjugate_cc id blocks_multiply_conjugate_cc_0 _enabled True vlen 1 affinity minoutbuf 0 maxoutbuf 0 _coordinate (444, 141) _rotation 0 blocks_delay id blocks_delay_0 _enabled True type complex delay int(OSR) num_ports 1 vlen 1 affinity minoutbuf 0 maxoutbuf 0 _coordinate (319, 171) _rotation 0 blocks_moving_average_xx id blocks_moving_average_xx_0 _enabled True type float length int((142)*samp_rate/f_symb) scale 1 max_iter int(1e6) affinity minoutbuf 0 maxoutbuf 0 _coordinate (971, 138) _rotation 0 blocks_threshold_ff id blocks_threshold_ff_0_0 _enabled True low 0 high 0 init 0 affinity minoutbuf 0 maxoutbuf 0 _coordinate (815, 138) _rotation 0 pad_source id pad_source_0 _enabled True label in type complex vlen 1 num_streams 1 optional False _coordinate (155, 137) _rotation 0 blocks_threshold_ff id blocks_threshold_ff_0 _enabled True low int((138)*samp_rate/f_symb) high int((138)*samp_rate/f_symb) init 0 affinity minoutbuf 0 maxoutbuf 0 _coordinate (1150, 138) _rotation 0 gsm_fcch_burst_tagger id gsm_fcch_burst_tagger_0 _enabled True OSR OSR affinity minoutbuf 0 maxoutbuf 0 _coordinate (348, 303) _rotation 0 pad_sink id pad_sink_0 _enabled True label out type complex vlen 1 num_streams 1 optional False _coordinate (584, 316) _rotation 0 options id fcch_detector _enabled True title FCCH Bursts Detector author Piotr Krysik description Detects positions of FCCH bursts. At the end of each detected FCCH burst adds to the stream a tag with key "fcch" and value which is a frequency offset estimate. The input sampling frequency should be integer multiply of GSM GMKS symbol rate - 1625000/6 Hz. window_size 1280, 1024 generate_options hb category GSM run_options prompt run True max_nouts 0 realtime_scheduling _coordinate (8, 0) _rotation 0 pad_source_0 blocks_multiply_conjugate_cc_0 0 0 blocks_delay_0 blocks_multiply_conjugate_cc_0 0 1 blocks_complex_to_arg_0 blocks_threshold_ff_0_0 0 0 pad_source_0 blocks_delay_0 0 0 blocks_multiply_conjugate_cc_0 blocks_complex_to_arg_0 0 0 blocks_moving_average_xx_0 blocks_threshold_ff_0 0 0 blocks_threshold_ff_0_0 blocks_moving_average_xx_0 0 0 gsm_fcch_burst_tagger_0 pad_sink_0 0 0 pad_source_0 gsm_fcch_burst_tagger_0 0 0 blocks_threshold_ff_0 gsm_fcch_burst_tagger_0 0 1 gr-gsm-0.41.2/hier_blocks/receiver/gsm_input.grc000066400000000000000000000320241316153413000215620ustar00rootroot00000000000000 Thu Nov 6 14:41:06 2014 options author Piotr Krysik window_size 1280, 1024 category comment description Adaptor of input stream for the GSM receiver. Contains frequency ofset corrector doing also resampling to integer multiplies of GSM sample rate and LP filter filtering GSM channel. _enabled True _coordinate (10, 10) _rotation 0 generate_options hb hier_block_src_path .: id gsm_input max_nouts 0 qt_qss_theme realtime_scheduling run_command {python} -u {filename} run_options prompt run True thread_safe_setters title GSM input adaptor variable comment _enabled True _coordinate (752, 21) _rotation 0 id gsm_symb_rate value 1625000.0/6.0 variable comment _enabled True _coordinate (632, 19) _rotation 0 id samp_rate_out value gsm_symb_rate*osr pad_source comment _enabled True _coordinate (56, 188) _rotation 0 id ctrl_in label ctrl_in num_streams 1 optional True type message vlen 1 parameter alias comment _enabled True _coordinate (231, 22) _rotation 0 id fc label fc short_id type eng_float value 940e6 fractional_resampler_xx alias comment affinity _enabled 0 _coordinate (488, 281) _rotation 0 id fractional_resampler_xx_0 maxoutbuf 0 minoutbuf 0 phase_shift 0 resamp_ratio samp_rate_in/samp_rate_out type complex gsm_clock_offset_corrector_tagged alias comment affinity _enabled True _coordinate (232, 199) _rotation 0 id gsm_clock_offset_corrector_tagged_0 maxoutbuf 0 minoutbuf 0 osr osr fc fc ppm ppm samp_rate_in samp_rate_in low_pass_filter beta 6.76 alias comment affinity cutoff_freq 125e3 decim 1 _enabled True type fir_filter_ccf _coordinate (712, 178) _rotation 0 gain 1 id low_pass_filter_0_0 interp 1 maxoutbuf 0 minoutbuf 0 samp_rate samp_rate_out width 5e3 win firdes.WIN_HAMMING parameter alias comment _enabled True _coordinate (541, 23) _rotation 0 id osr label OSR short_id type intx value 4 pad_sink comment _enabled True _coordinate (904, 220) _rotation 0 id pad_sink_0 type complex label out num_streams 1 optional False vlen 1 pad_source comment _enabled True _coordinate (56, 236) _rotation 0 id pad_source_0 label in num_streams 1 optional False type complex vlen 1 parameter alias comment _enabled True _coordinate (453, 22) _rotation 0 id ppm label ppm short_id type eng_float value 0 parameter alias comment _enabled True _coordinate (328, 22) _rotation 0 id samp_rate_in label samp_rate_in short_id type eng_float value 1e6 ctrl_in gsm_clock_offset_corrector_tagged_0 out ctrl fractional_resampler_xx_0 low_pass_filter_0_0 0 0 gsm_clock_offset_corrector_tagged_0 fractional_resampler_xx_0 0 0 gsm_clock_offset_corrector_tagged_0 low_pass_filter_0_0 0 0 low_pass_filter_0_0 pad_sink_0 0 0 pad_source_0 gsm_clock_offset_corrector_tagged_0 0 0 gr-gsm-0.41.2/include/000077500000000000000000000000001316153413000144125ustar00rootroot00000000000000gr-gsm-0.41.2/include/grgsm/000077500000000000000000000000001316153413000155315ustar00rootroot00000000000000gr-gsm-0.41.2/include/grgsm/CMakeLists.txt000066400000000000000000000023551316153413000202760ustar00rootroot00000000000000# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. ######################################################################## # Install public header files ######################################################################## install(FILES plotting.hpp api.h gsmtap.h constants.h DESTINATION include/grgsm ) add_subdirectory(decoding) add_subdirectory(decryption) add_subdirectory(demapping) add_subdirectory(receiver) add_subdirectory(misc_utils) add_subdirectory(qa_utils) add_subdirectory(flow_control) gr-gsm-0.41.2/include/grgsm/api.h000066400000000000000000000020411316153413000164500ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2014 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GRGSM_API_H #define INCLUDED_GRGSM_API_H #include #ifdef gnuradio_gsm_EXPORTS # define GRGSM_API __GR_ATTR_EXPORT #else # define GRGSM_API __GR_ATTR_IMPORT #endif #endif /* INCLUDED_GRGSM_API_H */ gr-gsm-0.41.2/include/grgsm/constants.h000066400000000000000000000033641316153413000177240ustar00rootroot00000000000000/* -*- c++ -*- */ /* * Copyright 2006,2009,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU Radio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GRGSM_CONSTANTS_H #define INCLUDED_GRGSM_CONSTANTS_H #include #include namespace gr { namespace gsm{ /*! * \brief return date/time of build, as set when 'cmake' is run */ GRGSM_API const std::string build_date(); /*! * \brief return version string defined by cmake (GrVersion.cmake) */ GRGSM_API const std::string version(); /*! * \brief return just the major version defined by cmake */ GRGSM_API const std::string major_version(); /*! * \brief return just the api version defined by cmake */ GRGSM_API const std::string api_version(); /*! * \brief return just the minor version defined by cmake */ GRGSM_API const std::string minor_version(); /*! * \brief return just the maint version defined by cmake */ GRGSM_API const std::string maint_version(); } /* namespace gsm */ } /* namespace gr */ #endif /* INCLUDED_GRGSM_CONSTANTS_H */ gr-gsm-0.41.2/include/grgsm/decoding/000077500000000000000000000000001316153413000173055ustar00rootroot00000000000000gr-gsm-0.41.2/include/grgsm/decoding/CMakeLists.txt000066400000000000000000000020471316153413000220500ustar00rootroot00000000000000# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. ######################################################################## # Install public header files ######################################################################## install(FILES control_channels_decoder.h tch_f_decoder.h DESTINATION include/grgsm/decoding ) gr-gsm-0.41.2/include/grgsm/decoding/control_channels_decoder.h000066400000000000000000000033011316153413000244730ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2014 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GSM_CONTROL_CHANNELS_DECODER_H #define INCLUDED_GSM_CONTROL_CHANNELS_DECODER_H #include #include namespace gr { namespace gsm { /*! * \brief <+description of block+> * \ingroup gsm * */ class GRGSM_API control_channels_decoder : virtual public gr::block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of gsm::control_channels_decoder. * * To avoid accidental use of raw pointers, gsm::control_channels_decoder's * constructor is in a private implementation * class. gsm::control_channels_decoder::make is the public interface for * creating new instances. */ static sptr make(); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_CONTROL_CHANNELS_DECODER_H */ gr-gsm-0.41.2/include/grgsm/decoding/tch_f_decoder.h000066400000000000000000000035701316153413000222330ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GSM_TCH_F_DECODER_H #define INCLUDED_GSM_TCH_F_DECODER_H #include #include namespace gr { namespace gsm { enum tch_mode { TCH_AFS12_2, TCH_AFS10_2, TCH_AFS7_95, TCH_AFS7_4, TCH_AFS6_7, TCH_AFS5_9, TCH_AFS5_15, TCH_AFS4_75, TCH_FS, TCH_EFR }; /*! * \brief <+description of block+> * \ingroup gsm * */ class GRGSM_API tch_f_decoder : virtual public gr::block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of gsm::tch_f_decoder. * * To avoid accidental use of raw pointers, gsm::tch_f_decoder's * constructor is in a private implementation * class. gsm::tch_f_decoder::make is the public interface for * creating new instances. */ static sptr make(tch_mode mode, bool boundary_check=false); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_TCH_F_DECODER_H */ gr-gsm-0.41.2/include/grgsm/decryption/000077500000000000000000000000001316153413000177115ustar00rootroot00000000000000gr-gsm-0.41.2/include/grgsm/decryption/CMakeLists.txt000066400000000000000000000020041316153413000224450ustar00rootroot00000000000000# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. ######################################################################## # Install public header files ######################################################################## install(FILES decryption.h DESTINATION include/grgsm/decoding ) gr-gsm-0.41.2/include/grgsm/decryption/decryption.h000066400000000000000000000034621316153413000222470ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2014 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_DECRYPTION_H #define INCLUDED_GSM_DECRYPTION_H #include #include #include namespace gr { namespace gsm { /*! * \brief <+description of block+> * \ingroup gsm * */ class GRGSM_API decryption : virtual public gr::block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of gsm::decryption. * * To avoid accidental use of raw pointers, gsm::decryption's * constructor is in a private implementation * class. gsm::decryption::make is the public interface for * creating new instances. */ static sptr make(const std::vector & k_c, unsigned int a5_version); virtual void set_k_c(const std::vector & k_c) = 0; virtual void set_a5_version(unsigned int a5_version) = 0; }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_DECRYPTION_H */ gr-gsm-0.41.2/include/grgsm/demapping/000077500000000000000000000000001316153413000174755ustar00rootroot00000000000000gr-gsm-0.41.2/include/grgsm/demapping/CMakeLists.txt000066400000000000000000000020641316153413000222370ustar00rootroot00000000000000# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. ######################################################################## # Install public header files ######################################################################## install(FILES universal_ctrl_chans_demapper.h tch_f_chans_demapper.h DESTINATION include/grgsm/demapping ) gr-gsm-0.41.2/include/grgsm/demapping/tch_f_chans_demapper.h000066400000000000000000000032721316153413000237660ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GSM_TCH_F_CHANS_DEMAPPER_H #define INCLUDED_GSM_TCH_F_CHANS_DEMAPPER_H #include #include namespace gr { namespace gsm { /*! * \brief <+description of block+> * \ingroup gsm * */ class GRGSM_API tch_f_chans_demapper : virtual public gr::block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of gsm::tch_f_chans_demapper. * * To avoid accidental use of raw pointers, gsm::tch_f_chans_demapper's * constructor is in a private implementation * class. gsm::tch_f_chans_demapper::make is the public interface for * creating new instances. */ static sptr make(unsigned int timeslot_nr); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_TCH_F_CHANS_DEMAPPER_H */ gr-gsm-0.41.2/include/grgsm/demapping/universal_ctrl_chans_demapper.h000066400000000000000000000041441316153413000257360ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2014-2016 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GSM_UNIVERSAL_CTRL_CHANS_DEMAPPER_H #define INCLUDED_GSM_UNIVERSAL_CTRL_CHANS_DEMAPPER_H #include #include #include namespace gr { namespace gsm { /*! * \brief <+description of block+> * \ingroup gsm * */ class GRGSM_API universal_ctrl_chans_demapper : virtual public gr::block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of gsm::universal_ctrl_chans_demapper. * * To avoid accidental use of raw pointers, gsm::universal_ctrl_chans_demapper's * constructor is in a private implementation * class. gsm::universal_ctrl_chans_demapper::make is the public interface for * creating new instances. */ static sptr make(unsigned int timeslot_nr, const std::vector &downlink_starts_fn_mod51, const std::vector &downlink_channel_types, const std::vector &downlink_subslots, const std::vector &uplink_starts_fn_mod51=std::vector(), const std::vector &uplink_channel_types=std::vector(), const std::vector &uplink_subslots=std::vector()); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_UNIVERSAL_CTRL_CHANS_DEMAPPER_H */ gr-gsm-0.41.2/include/grgsm/endian.h000066400000000000000000000056571316153413000171550ustar00rootroot00000000000000// "License": Public Domain // I, Mathias Panzenböck, place this file hereby into the public domain. Use it at your own risk for whatever you like. // In case there are jurisdictions that don't support putting things in the public domain you can also consider it to // be "dual licensed" under the BSD, MIT and Apache licenses, if you want to. This code is trivial anyway. Consider it // an example on how to get the endian conversion functions on different platforms. #ifndef PORTABLE_ENDIAN_H__ #define PORTABLE_ENDIAN_H__ #if (defined(_WIN16) || defined(_WIN32) || defined(_WIN64)) && !defined(__WINDOWS__) # define __WINDOWS__ #endif #if defined(__linux__) || defined(__CYGWIN__) # include #elif defined(__APPLE__) # include # define htobe16(x) OSSwapHostToBigInt16(x) # define htole16(x) OSSwapHostToLittleInt16(x) # define be16toh(x) OSSwapBigToHostInt16(x) # define le16toh(x) OSSwapLittleToHostInt16(x) # define htobe32(x) OSSwapHostToBigInt32(x) # define htole32(x) OSSwapHostToLittleInt32(x) # define be32toh(x) OSSwapBigToHostInt32(x) # define le32toh(x) OSSwapLittleToHostInt32(x) # define htobe64(x) OSSwapHostToBigInt64(x) # define htole64(x) OSSwapHostToLittleInt64(x) # define be64toh(x) OSSwapBigToHostInt64(x) # define le64toh(x) OSSwapLittleToHostInt64(x) # define __BYTE_ORDER BYTE_ORDER # define __BIG_ENDIAN BIG_ENDIAN # define __LITTLE_ENDIAN LITTLE_ENDIAN # define __PDP_ENDIAN PDP_ENDIAN #elif defined(__OpenBSD__) # include #elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) # include # define be16toh(x) betoh16(x) # define le16toh(x) letoh16(x) # define be32toh(x) betoh32(x) # define le32toh(x) letoh32(x) # define be64toh(x) betoh64(x) # define le64toh(x) letoh64(x) #elif defined(__WINDOWS__) # include # include # if BYTE_ORDER == LITTLE_ENDIAN # define htobe16(x) htons(x) # define htole16(x) (x) # define be16toh(x) ntohs(x) # define le16toh(x) (x) # define htobe32(x) htonl(x) # define htole32(x) (x) # define be32toh(x) ntohl(x) # define le32toh(x) (x) # define htobe64(x) htonll(x) # define htole64(x) (x) # define be64toh(x) ntohll(x) # define le64toh(x) (x) # elif BYTE_ORDER == BIG_ENDIAN /* that would be xbox 360 */ # define htobe16(x) (x) # define htole16(x) __builtin_bswap16(x) # define be16toh(x) (x) # define le16toh(x) __builtin_bswap16(x) # define htobe32(x) (x) # define htole32(x) __builtin_bswap32(x) # define be32toh(x) (x) # define le32toh(x) __builtin_bswap32(x) # define htobe64(x) (x) # define htole64(x) __builtin_bswap64(x) # define be64toh(x) (x) # define le64toh(x) __builtin_bswap64(x) # else # error byte order not supported # endif # define __BYTE_ORDER BYTE_ORDER # define __BIG_ENDIAN BIG_ENDIAN # define __LITTLE_ENDIAN LITTLE_ENDIAN # define __PDP_ENDIAN PDP_ENDIAN #else # error platform not supported #endif #endif gr-gsm-0.41.2/include/grgsm/flow_control/000077500000000000000000000000001316153413000202405ustar00rootroot00000000000000gr-gsm-0.41.2/include/grgsm/flow_control/CMakeLists.txt000066400000000000000000000023221316153413000227770ustar00rootroot00000000000000# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. ######################################################################## # Install public header files ######################################################################## install(FILES common.h burst_timeslot_splitter.h burst_sdcch_subslot_splitter.h burst_timeslot_filter.h burst_sdcch_subslot_filter.h burst_fnr_filter.h dummy_burst_filter.h uplink_downlink_splitter.h DESTINATION include/grgsm/flow_control ) gr-gsm-0.41.2/include/grgsm/flow_control/burst_fnr_filter.h000066400000000000000000000042451316153413000237670ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GSM_BURST_FNR_FILTER_H #define INCLUDED_GSM_BURST_FNR_FILTER_H #include #include #include namespace gr { namespace gsm { enum filter_mode { FILTER_LESS_OR_EQUAL, FILTER_GREATER_OR_EQUAL }; /*! * \brief <+description of block+> * \ingroup gsm * */ class GRGSM_API burst_fnr_filter : virtual public gr::block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of gsm::burst_fnr_filter. * * To avoid accidental use of raw pointers, gsm::burst_fnr_filter's * constructor is in a private implementation * class. gsm::burst_fnr_filter::make is the public interface for * creating new instances. */ static sptr make(filter_mode mode, unsigned int fnr); /* External API */ virtual unsigned int get_fn(void) = 0; virtual unsigned int set_fn(unsigned int fn) = 0; virtual filter_mode get_mode(void) = 0; virtual filter_mode set_mode(filter_mode mode) = 0; /* Filtering policy */ virtual filter_policy get_policy(void) = 0; virtual filter_policy set_policy(filter_policy policy) = 0; }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_BURST_FNR_FILTER_H */ gr-gsm-0.41.2/include/grgsm/flow_control/burst_sdcch_subslot_filter.h000066400000000000000000000044361316153413000260430ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_BURST_SDCCH_SUBSLOT_FILTER_H #define INCLUDED_GSM_BURST_SDCCH_SUBSLOT_FILTER_H #include #include #include namespace gr { namespace gsm { enum subslot_filter_mode { SS_FILTER_SDCCH8, SS_FILTER_SDCCH4 }; /*! * \brief <+description of block+> * \ingroup gsm * */ class GRGSM_API burst_sdcch_subslot_filter : virtual public gr::block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of grgsm::burst_sdcch_subslot_filter. * * To avoid accidental use of raw pointers, grgsm::burst_sdcch_subslot_filter's * constructor is in a private implementation * class. grgsm::burst_sdcch_subslot_filter::make is the public interface for * creating new instances. */ static sptr make(subslot_filter_mode mode, unsigned int subslot); /* External API */ virtual unsigned int get_ss(void) = 0; virtual unsigned int set_ss(unsigned int ss) = 0; virtual subslot_filter_mode get_mode(void) = 0; virtual subslot_filter_mode set_mode(subslot_filter_mode mode) = 0; /* Filtering policy */ virtual filter_policy get_policy(void) = 0; virtual filter_policy set_policy(filter_policy policy) = 0; }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_BURST_SDCCH_SUBSLOT_FILTER_H */ gr-gsm-0.41.2/include/grgsm/flow_control/burst_sdcch_subslot_splitter.h000066400000000000000000000037331316153413000264230ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_BURST_SDCCH_SUBSLOT_SPLITTER_H #define INCLUDED_GSM_BURST_SDCCH_SUBSLOT_SPLITTER_H #include #include namespace gr { namespace gsm { enum splitter_mode { SPLITTER_SDCCH8, SPLITTER_SDCCH4 }; /*! * \brief <+description of block+> * \ingroup gsm * */ class GRGSM_API burst_sdcch_subslot_splitter : virtual public gr::block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of grgsm::burst_sdcch_subslot_splitter. * * To avoid accidental use of raw pointers, grgsm::burst_sdcch_subslot_splitter's * constructor is in a private implementation * class. grgsm::burst_sdcch_subslot_splitter::make is the public interface for * creating new instances. */ static sptr make(splitter_mode mode); /* External API */ virtual splitter_mode get_mode(void) = 0; virtual splitter_mode set_mode(splitter_mode mode) = 0; }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_BURST_SDCCH_SUBSLOT_SPLITTER_H */ gr-gsm-0.41.2/include/grgsm/flow_control/burst_timeslot_filter.h000066400000000000000000000037721316153413000250460ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_BURST_TIMESLOT_FILTER_H #define INCLUDED_GSM_BURST_TIMESLOT_FILTER_H #include #include #include namespace gr { namespace gsm { /*! * \brief <+description of block+> * \ingroup gsm * */ class GRGSM_API burst_timeslot_filter : virtual public gr::block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of grgsm::burst_timeslot_filter. * * To avoid accidental use of raw pointers, grgsm::burst_timeslot_filter's * constructor is in a private implementation * class. grgsm::burst_timeslot_filter::make is the public interface for * creating new instances. */ static sptr make(unsigned int timeslot); /* External API */ virtual unsigned int get_tn(void) = 0; virtual unsigned int set_tn(unsigned int tn) = 0; /* Filtering policy */ virtual filter_policy get_policy(void) = 0; virtual filter_policy set_policy(filter_policy policy) = 0; }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_BURST_TIMESLOT_FILTER_H */ gr-gsm-0.41.2/include/grgsm/flow_control/burst_timeslot_splitter.h000066400000000000000000000032751316153413000254250ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_BURST_TIMESLOT_SPLITTER_H #define INCLUDED_GSM_BURST_TIMESLOT_SPLITTER_H #include #include namespace gr { namespace gsm { /*! * \brief <+description of block+> * \ingroup gsm * */ class GRGSM_API burst_timeslot_splitter : virtual public gr::block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of grgsm::burst_timeslot_splitter. * * To avoid accidental use of raw pointers, grgsm::burst_timeslot_splitter's * constructor is in a private implementation * class. grgsm::burst_timeslot_splitter::make is the public interface for * creating new instances. */ static sptr make(); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_BURST_TIMESLOT_SPLITTER_H */ gr-gsm-0.41.2/include/grgsm/flow_control/common.h000066400000000000000000000021321316153413000216770ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2017 by Vadim Yanitskiy * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GSM_FLOW_CONTROL_COMMON_H #define INCLUDED_GSM_FLOW_CONTROL_COMMON_H namespace gr { namespace gsm { enum filter_policy { FILTER_POLICY_DEFAULT, FILTER_POLICY_PASS_ALL, FILTER_POLICY_DROP_ALL, }; } /* namespace gsm */ } /* namespace gr */ #endif gr-gsm-0.41.2/include/grgsm/flow_control/dummy_burst_filter.h000066400000000000000000000035471316153413000243410ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_DUMMY_BURST_FILTER_H #define INCLUDED_GSM_DUMMY_BURST_FILTER_H #include #include #include namespace gr { namespace gsm { /*! * \brief <+description of block+> * \ingroup gsm * */ class GRGSM_API dummy_burst_filter : virtual public gr::block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of grgsm::dummy_burst_filter. * * To avoid accidental use of raw pointers, grgsm::dummy_burst_filter's * constructor is in a private implementation * class. grgsm::dummy_burst_filter::make is the public interface for * creating new instances. */ static sptr make(); /* External API */ /* Filtering policy */ virtual filter_policy get_policy(void) = 0; virtual filter_policy set_policy(filter_policy policy) = 0; }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_DUMMY_BURST_FILTER_H */ gr-gsm-0.41.2/include/grgsm/flow_control/uplink_downlink_splitter.h000066400000000000000000000033261316153413000255520ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2016 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GRGSM_UPLINK_DOWNLINK_SPLITTER_H #define INCLUDED_GRGSM_UPLINK_DOWNLINK_SPLITTER_H #include #include namespace gr { namespace grgsm { /*! * \brief <+description of block+> * \ingroup grgsm * */ class GRGSM_API uplink_downlink_splitter : virtual public gr::block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of grgsm::uplink_downlink_splitter. * * To avoid accidental use of raw pointers, grgsm::uplink_downlink_splitter's * constructor is in a private implementation * class. grgsm::uplink_downlink_splitter::make is the public interface for * creating new instances. */ static sptr make(); }; } // namespace grgsm } // namespace gr #endif /* INCLUDED_GRGSM_UPLINK_DOWNLINK_SPLITTER_H */ gr-gsm-0.41.2/include/grgsm/gsmtap.h000066400000000000000000000042741316153413000172040ustar00rootroot00000000000000#ifndef _GSMTAP_H #define _GSMTAP_H /* gsmtap header, pseudo-header in front of the actua GSM payload */ /* GSMTAP is a generic header format for GSM protocol captures, * it uses the IANA-assigned UDP port number 4729 and carries * payload in various formats of GSM interfaces such as Um MAC * blocks or Um bursts. * * Example programs generating GSMTAP data are airprobe * (http://airprobe.org/) or OsmocomBB (http://bb.osmocom.org/) */ #include #define GSMTAP_VERSION 0x02 #define GSMTAP_TYPE_UM 0x01 /* A Layer 2 MAC block (23 bytes) */ #define GSMTAP_TYPE_ABIS 0x02 #define GSMTAP_TYPE_UM_BURST 0x03 /* raw burst bits */ #define GSMTAP_BURST_UNKNOWN 0x00 #define GSMTAP_BURST_FCCH 0x01 #define GSMTAP_BURST_PARTIAL_SCH 0x02 #define GSMTAP_BURST_SCH 0x03 #define GSMTAP_BURST_CTS_SCH 0x04 #define GSMTAP_BURST_COMPACT_SCH 0x05 #define GSMTAP_BURST_NORMAL 0x06 #define GSMTAP_BURST_DUMMY 0x07 #define GSMTAP_BURST_ACCESS 0x08 #define GSMTAP_BURST_NONE 0x09 #define GSMTAP_CHANNEL_UNKNOWN 0x00 #define GSMTAP_CHANNEL_BCCH 0x01 #define GSMTAP_CHANNEL_CCCH 0x02 #define GSMTAP_CHANNEL_RACH 0x03 #define GSMTAP_CHANNEL_AGCH 0x04 #define GSMTAP_CHANNEL_PCH 0x05 #define GSMTAP_CHANNEL_SDCCH 0x06 #define GSMTAP_CHANNEL_SDCCH4 0x07 #define GSMTAP_CHANNEL_SDCCH8 0x08 #define GSMTAP_CHANNEL_TCH_F 0x09 #define GSMTAP_CHANNEL_TCH_H 0x0a #define GSMTAP_CHANNEL_ACCH 0x80 #define GSMTAP_ARFCN_F_PCS 0x8000 #define GSMTAP_ARFCN_F_UPLINK 0x4000 #define GSMTAP_ARFCN_MASK 0x3fff #define GSMTAP_UDP_PORT 4729 /* officially registered with IANA */ struct gsmtap_hdr { uint8_t version; /* version, set to GSMTAP_VERSION */ uint8_t hdr_len; /* length in number of 32bit words */ uint8_t type; /* see GSMTAP_TYPE_* */ uint8_t timeslot; /* timeslot (0..7 on Um) */ uint16_t arfcn; /* ARFCN (frequency) */ int8_t signal_dbm; /* signal level in dBm */ int8_t snr_db; /* signal/noise ratio in dB */ uint32_t frame_number; /* GSM Frame Number (FN) */ uint8_t sub_type; /* Type of burst/channel, see above */ uint8_t antenna_nr; /* Antenna Number */ uint8_t sub_slot; /* sub-slot within timeslot */ uint8_t res; /* reserved for future use (RFU) */ } __attribute__((packed)); #endif /* _GSMTAP_H */ gr-gsm-0.41.2/include/grgsm/misc_utils/000077500000000000000000000000001316153413000177045ustar00rootroot00000000000000gr-gsm-0.41.2/include/grgsm/misc_utils/CMakeLists.txt000066400000000000000000000025211316153413000224440ustar00rootroot00000000000000# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. ######################################################################## # Install public header files ######################################################################## install(FILES bursts_printer.h burst_file_source.h burst_file_sink.h collect_system_info.h message_file_sink.h message_file_source.h extract_system_info.h extract_immediate_assignment.h extract_cmc.h controlled_rotator_cc.h message_printer.h tmsi_dumper.h msg_to_tag.h controlled_fractional_resampler_cc.h DESTINATION include/grgsm/misc_utils ) gr-gsm-0.41.2/include/grgsm/misc_utils/burst_file_sink.h000066400000000000000000000032311316153413000232360ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_BURST_FILE_SINK_H #define INCLUDED_GSM_BURST_FILE_SINK_H #include #include namespace gr { namespace gsm { /*! * \brief <+description of block+> * \ingroup gsm * */ class GRGSM_API burst_file_sink : virtual public gr::block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of grgsm::burst_file_sink. * * To avoid accidental use of raw pointers, grgsm::burst_file_sink's * constructor is in a private implementation * class. grgsm::burst_file_sink::make is the public interface for * creating new instances. */ static sptr make(const std::string &filename); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_BURST_FILE_SINK_H */ gr-gsm-0.41.2/include/grgsm/misc_utils/burst_file_source.h000066400000000000000000000032521316153413000235750ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_BURST_FILE_SOURCE_H #define INCLUDED_GSM_BURST_FILE_SOURCE_H #include #include namespace gr { namespace gsm { /*! * \brief <+description of block+> * \ingroup gsm * */ class GRGSM_API burst_file_source : virtual public gr::block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of grgsm::burst_file_source. * * To avoid accidental use of raw pointers, grgsm::burst_file_source's * constructor is in a private implementation * class. grgsm::burst_file_source::make is the public interface for * creating new instances. */ static sptr make(const std::string &filename); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_BURST_FILE_SOURCE_H */ gr-gsm-0.41.2/include/grgsm/misc_utils/bursts_printer.h000066400000000000000000000034641316153413000231510ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2014 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GSM_BURSTS_PRINTER_H #define INCLUDED_GSM_BURSTS_PRINTER_H #include #include #include #include namespace gr { namespace gsm { /*! * \brief <+description of block+> * \ingroup gsm * */ class GRGSM_API bursts_printer : virtual public gr::block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of gsm::bursts_printer. * * To avoid accidental use of raw pointers, gsm::bursts_printer's * constructor is in a private implementation * class. gsm::bursts_printer::make is the public interface for * creating new instances. */ static sptr make(pmt::pmt_t prepend_string, bool prepend_fnr=false, bool prepend_frame_count=false, bool print_payload_only=false, bool ignore_dummy_bursts=false); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_BURSTS_PRINTER_H */ gr-gsm-0.41.2/include/grgsm/misc_utils/collect_system_info.h000066400000000000000000000035421316153413000241250ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2017 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GSM_COLLECT_SYSTEM_INFO_H #define INCLUDED_GSM_COLLECT_SYSTEM_INFO_H #include #include #include namespace gr { namespace gsm { /*! * \brief <+description of block+> * \ingroup gsm * */ class GRGSM_API collect_system_info : virtual public gr::block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of gsm::collect_system_info. * * To avoid accidental use of raw pointers, gsm::collect_system_info's * constructor is in a private implementation * class. gsm::collect_system_info::make is the public interface for * creating new instances. */ static sptr make(); virtual std::vector get_framenumbers() = 0; virtual std::vector get_system_information_type() = 0; virtual std::vector get_data() = 0; }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_COLLECT_SYSTEM_INFO_H */ gr-gsm-0.41.2/include/grgsm/misc_utils/controlled_fractional_resampler_cc.h000066400000000000000000000040751316153413000271510ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2016 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GRGSM_CONTROLLED_FRACTIONAL_RESAMPLER_CC_H #define INCLUDED_GRGSM_CONTROLLED_FRACTIONAL_RESAMPLER_CC_H #include #include //#include namespace gr { namespace gsm { /*! * \brief <+description of block+> * \ingroup grgsm * */ class GRGSM_API controlled_fractional_resampler_cc : virtual public block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of grgsm::controlled_fractional_resampler_cc. * * To avoid accidental use of raw pointers, grgsm::controlled_fractional_resampler_cc's * constructor is in a private implementation * class. grgsm::controlled_fractional_resampler_cc::make is the public interface for * creating new instances. */ static sptr make(float phase_shift, float resamp_ratio); virtual float mu() const = 0; virtual float resamp_ratio() const = 0; virtual void set_mu (float mu) = 0; virtual void set_resamp_ratio(float resamp_ratio) = 0; }; } // namespace grgsm } // namespace gr #endif /* INCLUDED_GRGSM_CONTROLLED_FRACTIONAL_RESAMPLER_CC_H */ gr-gsm-0.41.2/include/grgsm/misc_utils/controlled_rotator_cc.h000066400000000000000000000034741316153413000244510ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2014-2016 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GSM_CONTROLLED_ROTATOR_CC_H #define INCLUDED_GSM_CONTROLLED_ROTATOR_CC_H #include #include namespace gr { namespace gsm { /*! * \brief <+description of block+> * \ingroup gsm * */ class GRGSM_API controlled_rotator_cc : virtual public sync_block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of gsm::controlled_rotator_cc. * * To avoid accidental use of raw pointers, gsm::controlled_rotator_cc's * constructor is in a private implementation * class. gsm::controlled_rotator_cc::make is the public interface for * creating new instances. */ static sptr make(double phase_inc); virtual void set_phase_inc(double phase_inc) = 0; // virtual void set_samp_rate(double samp_rate) = 0; }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_CONTROLLED_ROTATOR_CC_H */ gr-gsm-0.41.2/include/grgsm/misc_utils/extract_cmc.h000066400000000000000000000034211316153413000223510ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2016 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GSM_EXTRACT_CMC_H #define INCLUDED_GSM_EXTRACT_CMC_H #include #include #include namespace gr { namespace gsm { /*! * \brief <+description of block+> * \ingroup gsm * */ class GRGSM_API extract_cmc : virtual public gr::block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of gsm::extract_cmc. * * To avoid accidental use of raw pointers, gsm::extract_cmc's * constructor is in a private implementation * class. gsm::extract_cmc::make is the public interface for * creating new instances. */ static sptr make(); virtual std::vector get_framenumbers() = 0; virtual std::vector get_a5_versions() = 0; virtual std::vector get_start_ciphering() = 0; }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_EXTRACT_CMC_H */ gr-gsm-0.41.2/include/grgsm/misc_utils/extract_immediate_assignment.h000066400000000000000000000045601316153413000260020ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GSM_EXTRACT_IMMEDIATE_ASSIGNMENT_H #define INCLUDED_GSM_EXTRACT_IMMEDIATE_ASSIGNMENT_H #include #include #include namespace gr { namespace gsm { /*! * \brief <+description of block+> * \ingroup gsm * */ class GRGSM_API extract_immediate_assignment : virtual public gr::block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of gsm::extract_immediate_assignment. * * To avoid accidental use of raw pointers, gsm::extract_immediate_assignment's * constructor is in a private implementation * class. gsm::extract_immediate_assignment::make is the public interface for * creating new instances. */ static sptr make(bool print_immediate_assignments=false, bool ignore_gprs=false, bool unique_references=false); virtual std::vector get_frame_numbers() = 0; virtual std::vector get_channel_types() = 0; virtual std::vector get_timeslots() = 0; virtual std::vector get_subchannels() = 0; virtual std::vector get_hopping() = 0; virtual std::vector get_maios() = 0; virtual std::vector get_hsns() = 0; virtual std::vector get_arfcns() = 0; virtual std::vector get_timing_advances() = 0; virtual std::vector get_mobile_allocations() = 0; }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_EXTRACT_IMMEDIATE_ASSIGNMENT_H */ gr-gsm-0.41.2/include/grgsm/misc_utils/extract_system_info.h000066400000000000000000000042321316153413000241470ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2014 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GSM_EXTRACT_SYSTEM_INFO_H #define INCLUDED_GSM_EXTRACT_SYSTEM_INFO_H #include #include #include namespace gr { namespace gsm { /*! * \brief <+description of block+> * \ingroup gsm * */ class GRGSM_API extract_system_info : virtual public gr::block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of gsm::extract_system_info. * * To avoid accidental use of raw pointers, gsm::extract_system_info's * constructor is in a private implementation * class. gsm::extract_system_info::make is the public interface for * creating new instances. */ static sptr make(); virtual std::vector get_chans() = 0; virtual std::vector get_pwrs() = 0; virtual std::vector get_lac() = 0; virtual std::vector get_cell_id() = 0; virtual std::vector get_mcc() = 0; virtual std::vector get_mnc() = 0; virtual std::vector get_ccch_conf() = 0; virtual std::vector get_cell_arfcns(int chan_id) = 0; virtual std::vector get_neighbours(int chan_id) = 0; virtual void reset() = 0; }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_EXTRACT_SYSTEM_INFO_H */ gr-gsm-0.41.2/include/grgsm/misc_utils/message_file_sink.h000066400000000000000000000032511316153413000235250ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_MESSAGE_FILE_SINK_H #define INCLUDED_GSM_MESSAGE_FILE_SINK_H #include #include namespace gr { namespace gsm { /*! * \brief <+description of block+> * \ingroup gsm * */ class GRGSM_API message_file_sink : virtual public gr::block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of grgsm::message_file_sink. * * To avoid accidental use of raw pointers, grgsm::message_file_sink's * constructor is in a private implementation * class. grgsm::message_file_sink::make is the public interface for * creating new instances. */ static sptr make(const std::string &filename); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_MESSAGE_FILE_SINK_H */ gr-gsm-0.41.2/include/grgsm/misc_utils/message_file_source.h000066400000000000000000000032721316153413000240640ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_MESSAGE_FILE_SOURCE_H #define INCLUDED_GSM_MESSAGE_FILE_SOURCE_H #include #include namespace gr { namespace gsm { /*! * \brief <+description of block+> * \ingroup gsm * */ class GRGSM_API message_file_source : virtual public gr::block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of grgsm::message_file_source. * * To avoid accidental use of raw pointers, grgsm::message_file_source's * constructor is in a private implementation * class. grgsm::message_file_source::make is the public interface for * creating new instances. */ static sptr make(const std::string &filename); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_MESSAGE_FILE_SOURCE_H */ gr-gsm-0.41.2/include/grgsm/misc_utils/message_printer.h000066400000000000000000000033611316153413000232470ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2014 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GSM_MESSAGE_PRINTER_H #define INCLUDED_GSM_MESSAGE_PRINTER_H #include #include namespace gr { namespace gsm { /*! * \brief <+description of block+> * \ingroup gsm * */ class GRGSM_API message_printer : virtual public gr::block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of gsm::message_printer. * * To avoid accidental use of raw pointers, gsm::message_printer's * constructor is in a private implementation * class. gsm::message_printer::make is the public interface for * creating new instances. */ static sptr make(pmt::pmt_t prepend_string, bool prepend_fnr=false, bool prepend_frame_count=false, bool print_gsmtap_header=false); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_MESSAGE_PRINTER_H */ gr-gsm-0.41.2/include/grgsm/misc_utils/msg_to_tag.h000066400000000000000000000031551316153413000222040ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2016 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GRGSM_MSG_TO_TAG_H #define INCLUDED_GRGSM_MSG_TO_TAG_H #include #include namespace gr { namespace gsm { /*! * \brief <+description of block+> * \ingroup grgsm * */ class GRGSM_API msg_to_tag : virtual public gr::sync_block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of grgsm::msg_to_tag. * * To avoid accidental use of raw pointers, grgsm::msg_to_tag's * constructor is in a private implementation * class. grgsm::msg_to_tag::make is the public interface for * creating new instances. */ static sptr make(); }; } // namespace grgsm } // namespace gr #endif /* INCLUDED_GRGSM_MSG_TO_TAG_H */ gr-gsm-0.41.2/include/grgsm/misc_utils/tmsi_dumper.h000066400000000000000000000031341316153413000224060ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_TMSI_DUMPER_H #define INCLUDED_GSM_TMSI_DUMPER_H #include #include namespace gr { namespace gsm { /*! * \brief <+description of block+> * \ingroup gsm * */ class GRGSM_API tmsi_dumper : virtual public gr::block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of gsm::tmsi_dumper. * * To avoid accidental use of raw pointers, gsm::tmsi_dumper's * constructor is in a private implementation * class. gsm::tmsi_dumper::make is the public interface for * creating new instances. */ static sptr make(); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_TMSI_DUMPER_H */ gr-gsm-0.41.2/include/grgsm/plotting.hpp000066400000000000000000000043741316153413000201120ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2014 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #define USE_CXX (__cplusplus >= 201103) #include #include #include #include #include "gnuplot-iostream.h" boost::shared_ptr current_figure; void imagesc(arma::mat & x){ Gnuplot gp; gp << "set palette rgb 3,2,2;"; gp << "plot "; gp << gp.file1d(x) << "matrix with image"; gp << std::endl; } void plot(arma::cx_mat & x, std::string title){ arma::mat y = arma::abs(x); if(current_figure.get()==NULL){ current_figure = boost::make_shared(); } (*current_figure) << "plot "; (*current_figure) << current_figure->file1d(y) <<"title \'" << title << "\' with lines "; (*current_figure) << std::endl; } void replot(arma::cx_mat & x, std::string title){ arma::mat y = arma::abs(x); if(current_figure.get()==NULL){ current_figure = boost::make_shared(); } (*current_figure) << "replot "; (*current_figure) << current_figure->file1d(y) <<"title \'" << title << "\' with lines "; (*current_figure) << std::endl; } template void plot(std::vector & x){ arma::cx_mat y = arma::conv_to::from(x); plot(y,""); } template void plot(std::vector & x, std::string title){ arma::cx_mat y = arma::conv_to::from(x); plot(y,title); } template void replot(std::vector & x, std::string title){ arma::cx_mat y = arma::conv_to::from(x); replot(y,title); } gr-gsm-0.41.2/include/grgsm/qa_utils/000077500000000000000000000000001316153413000173525ustar00rootroot00000000000000gr-gsm-0.41.2/include/grgsm/qa_utils/CMakeLists.txt000066400000000000000000000020771316153413000221200ustar00rootroot00000000000000# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. ######################################################################## # Install public header files ######################################################################## install(FILES burst_sink.h burst_source.h message_source.h message_sink.h DESTINATION include/grgsm/qa_utils ) gr-gsm-0.41.2/include/grgsm/qa_utils/burst_sink.h000066400000000000000000000033771316153413000217200ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_BURST_SINK_H #define INCLUDED_GSM_BURST_SINK_H #include #include namespace gr { namespace gsm { /*! * \brief <+description of block+> * \ingroup gsm * */ class GRGSM_API burst_sink : virtual public gr::block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of grgsm::burst_sink. * * To avoid accidental use of raw pointers, grgsm::burst_sink's * constructor is in a private implementation * class. grgsm::burst_sink::make is the public interface for * creating new instances. */ static sptr make(); virtual std::vector get_framenumbers() = 0; virtual std::vector get_timeslots() = 0; virtual std::vector get_burst_data() = 0; }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_BURST_SINK_H */ gr-gsm-0.41.2/include/grgsm/qa_utils/burst_source.h000066400000000000000000000037271316153413000222530ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_BURST_SOURCE_H #define INCLUDED_GSM_BURST_SOURCE_H #include #include namespace gr { namespace gsm { /*! * \brief <+description of block+> * \ingroup gsm * */ class GRGSM_API burst_source : virtual public gr::block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of grgsm::burst_source. * * To avoid accidental use of raw pointers, grgsm::burst_source's * constructor is in a private implementation * class. grgsm::burst_source::make is the public interface for * creating new instances. */ static sptr make(const std::vector &framenumbers, const std::vector ×lots, const std::vector &burst_data); virtual void set_framenumbers(const std::vector &framenumbers) = 0; virtual void set_timeslots(const std::vector ×lots) = 0; virtual void set_burst_data(const std::vector &burst_data) = 0; }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_BURST_SOURCE_H */ gr-gsm-0.41.2/include/grgsm/qa_utils/message_sink.h000066400000000000000000000032561316153413000222010ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_MESSAGE_SINK_H #define INCLUDED_GSM_MESSAGE_SINK_H #include #include namespace gr { namespace gsm { /*! * \brief <+description of block+> * \ingroup gsm * */ class GRGSM_API message_sink : virtual public gr::block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of grgsm::message_sink. * * To avoid accidental use of raw pointers, grgsm::message_sink's * constructor is in a private implementation * class. grgsm::message_sink::make is the public interface for * creating new instances. */ static sptr make(); virtual std::vector get_messages() = 0; }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_MESSAGE_SINK_H */ gr-gsm-0.41.2/include/grgsm/qa_utils/message_source.h000066400000000000000000000033601316153413000225310ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_MESSAGE_SOURCE_H #define INCLUDED_GSM_MESSAGE_SOURCE_H #include #include namespace gr { namespace gsm { /*! * \brief <+description of block+> * \ingroup gsm * */ class GRGSM_API message_source : virtual public gr::block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of grgsm::message_source. * * To avoid accidental use of raw pointers, grgsm::message_source's * constructor is in a private implementation * class. grgsm::message_source::make is the public interface for * creating new instances. */ static sptr make(const std::vector &msg_data); virtual void set_msg_data(const std::vector &msg_data) = 0; }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_MESSAGE_SOURCE_H */ gr-gsm-0.41.2/include/grgsm/receiver/000077500000000000000000000000001316153413000173355ustar00rootroot00000000000000gr-gsm-0.41.2/include/grgsm/receiver/CMakeLists.txt000066400000000000000000000020651316153413000221000ustar00rootroot00000000000000# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. ######################################################################## # Install public header files ######################################################################## install(FILES clock_offset_control.h cx_channel_hopper.h receiver.h DESTINATION include/grgsm/receiver ) gr-gsm-0.41.2/include/grgsm/receiver/clock_offset_control.h000066400000000000000000000035561316153413000237200ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2015-2016 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_CLOCK_OFFSET_CONTROL_H #define INCLUDED_GSM_CLOCK_OFFSET_CONTROL_H #include #include namespace gr { namespace gsm { /*! * \brief <+description of block+> * \ingroup gsm * */ class GRGSM_API clock_offset_control : virtual public gr::block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of gsm::clock_offset_control. * * To avoid accidental use of raw pointers, gsm::clock_offset_control's * constructor is in a private implementation * class. gsm::clock_offset_control::make is the public interface for * creating new instances. */ static sptr make(float fc, float samp_rate, unsigned int osr=4); virtual void set_fc(float fc) = 0; virtual void set_samp_rate(float samp_rate) = 0; virtual void set_osr(unsigned int osr) = 0; }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_CLOCK_OFFSET_CONTROL_H */ gr-gsm-0.41.2/include/grgsm/receiver/cx_channel_hopper.h000066400000000000000000000033221316153413000231650ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Pieter Robyns * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_CX_CHANNEL_HOPPER_H #define INCLUDED_GSM_CX_CHANNEL_HOPPER_H #include #include #include namespace gr { namespace gsm { /*! * \brief <+description of block+> * \ingroup gsm * */ class GRGSM_API cx_channel_hopper : virtual public gr::block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of gsm::cx_channel_hopper. * * To avoid accidental use of raw pointers, gsm::cx_channel_hopper's * constructor is in a private implementation * class. gsm::cx_channel_hopper::make is the public interface for * creating new instances. */ static sptr make(const std::vector &ma, int maio, int hsn); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_CX_CHANNEL_HOPPER_H */ gr-gsm-0.41.2/include/grgsm/receiver/receiver.h000066400000000000000000000036601316153413000213170ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2014-2016 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GSM_RECEIVER_H #define INCLUDED_GSM_RECEIVER_H #include #include #include #include namespace gr { namespace gsm { /*! * \brief <+description of block+> * \ingroup gsm * */ class GRGSM_API receiver : virtual public sync_block { public: typedef boost::shared_ptr sptr; /*! * \brief Return a shared_ptr to a new instance of gsm::receiver. * * To avoid accidental use of raw pointers, gsm::receiver's * constructor is in a private implementation * class. gsm::receiver::make is the public interface for * creating new instances. */ static sptr make(int osr, const std::vector &cell_allocation, const std::vector &seq_nums, bool process_uplink=false); virtual void set_cell_allocation(const std::vector &cell_allocation) = 0; virtual void set_tseq_nums(const std::vector & tseq_nums) = 0; virtual void reset() = 0; }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_RECEIVER_H */ gr-gsm-0.41.2/lib/000077500000000000000000000000001316153413000135355ustar00rootroot00000000000000gr-gsm-0.41.2/lib/CMakeLists.txt000066400000000000000000000104251316153413000162770ustar00rootroot00000000000000# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. include(GrPlatform) #define LIB_SUFFIX include(GrMiscUtils) ######################################################################## # Add sources macro ######################################################################## set(grgsm_sources "") macro (add_sources) file (RELATIVE_PATH _relPath "${PROJECT_SOURCE_DIR}/lib" "${CMAKE_CURRENT_SOURCE_DIR}") foreach (_src ${ARGN}) if (_relPath) list (APPEND grgsm_sources "${_relPath}/${_src}") else() list (APPEND grgsm_sources "${_src}") endif() endforeach() if (_relPath) # propagate grgsm_sources to parent directory set (grgsm_sources ${grgsm_sources} PARENT_SCOPE) endif() endmacro() ######################################################################## # Handle the generated constants ######################################################################## execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import time;print time.strftime('%a, %d %b %Y %H:%M:%S', time.gmtime())" OUTPUT_VARIABLE BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE ) message(STATUS "Loading build date ${BUILD_DATE} into constants...") message(STATUS "Loading version ${VERSION} into constants...") #double escape for windows backslash path separators string(REPLACE "\\" "\\\\" prefix "${prefix}") configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/constants.cc.in ${CMAKE_CURRENT_BINARY_DIR}/constants.cc ESCAPE_QUOTES @ONLY) list(APPEND grgsm_sources ${CMAKE_CURRENT_BINARY_DIR}/constants.cc) ######################################################################### # Subdirecories ######################################################################### add_subdirectory(decoding) add_subdirectory(decryption) add_subdirectory(demapping) add_subdirectory(flow_control) add_subdirectory(misc_utils) add_subdirectory(qa_utils) add_subdirectory(receiver) ######################################################################## # Setup library ######################################################################## include_directories(${Boost_INCLUDE_DIR} receiver) link_directories(${Boost_LIBRARY_DIRS}) add_library(grgsm SHARED ${grgsm_sources}) target_link_libraries(grgsm ${Boost_LIBRARIES} ${GNURADIO_ALL_LIBRARIES} ${VOLK_LIBRARIES} ${LIBOSMOCODEC_LIBRARIES} ${LIBOSMOCORE_LIBRARIES} # ${LIBOSMOCODING_LIBRARIES} # libraries required by plotting.h - have troubles to be installed by pybombs # boost_iostreams # boost_system # boost_filesystem ) set_target_properties(grgsm PROPERTIES DEFINE_SYMBOL "grgsm_EXPORTS") GR_LIBRARY_FOO(grgsm) ######################################################################## # Install built library files ######################################################################## install(TARGETS grgsm LIBRARY DESTINATION lib${LIB_SUFFIX} # .so/.dylib file ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file RUNTIME DESTINATION bin # .dll file ) ######################################################################## # Build and register unit test ######################################################################## #include(GrTest) #include_directories(${CPPUNIT_INCLUDE_DIRS}) #list(APPEND test_grgsm_sources # ${CMAKE_CURRENT_SOURCE_DIR}/test_gsm.cc # ${CMAKE_CURRENT_SOURCE_DIR}/qa_gsm.cc # ${CMAKE_CURRENT_SOURCE_DIR}/qa_receiver.cc #) #add_executable(test-gsm ${test_grgsm_sources}) #target_link_libraries( # test-gsm # ${GNURADIO_RUNTIME_LIBRARIES} # ${Boost_LIBRARIES} # ${CPPUNIT_LIBRARIES} # grgsm #) #GR_ADD_TEST(test_gsm test-gsm) gr-gsm-0.41.2/lib/constants.cc.in000066400000000000000000000027171316153413000164740ustar00rootroot00000000000000/* -*- c++ -*- */ /* * Copyright 2006,2009,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU Radio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #if HAVE_CONFIG_H #include #endif #include #include namespace gr { namespace gsm{ const std::string build_date() { return "@BUILD_DATE@"; } const std::string version() { return "@VERSION@"; } // Return individual parts of the version const std::string major_version() { return "@MAJOR_VERSION@"; } const std::string api_version() { return "@API_COMPAT@"; } const std::string minor_version() { return "@MINOR_VERSION@"; } const std::string maint_version() { return "@MAINT_VERSION@"; } } /* namespace gsm */ } /* namespace gr */ gr-gsm-0.41.2/lib/decoding/000077500000000000000000000000001316153413000153115ustar00rootroot00000000000000gr-gsm-0.41.2/lib/decoding/CMakeLists.txt000066400000000000000000000017411316153413000200540ustar00rootroot00000000000000# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. add_subdirectory(osmocom/coding) add_subdirectory(openbts) add_subdirectory(osmocom/coding) add_subdirectory(openbts) add_sources( control_channels_decoder_impl.cc tch_f_decoder_impl.cc sch.c ) gr-gsm-0.41.2/lib/decoding/control_channels_decoder_impl.cc000066400000000000000000000077511316153413000236730ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2014 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "control_channels_decoder_impl.h" #define DATA_BYTES 23 namespace gr { namespace gsm { static int ubits2sbits(ubit_t *ubits, sbit_t *sbits, int count) { int i; for (i = 0; i < count; i++) { if (*ubits == 0x23) { ubits++; sbits++; continue; } if ((*ubits++) & 1) *sbits++ = -127; else *sbits++ = 127; } return count; } control_channels_decoder::sptr control_channels_decoder::make() { return gnuradio::get_initial_sptr (new control_channels_decoder_impl()); } /* * Constructor */ control_channels_decoder_impl::control_channels_decoder_impl() : gr::block("control_channels_decoder", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), d_collected_bursts_num(0) { //setup input/output ports message_port_register_in(pmt::mp("bursts")); set_msg_handler(pmt::mp("bursts"), boost::bind(&control_channels_decoder_impl::decode, this, _1)); message_port_register_out(pmt::mp("msgs")); } control_channels_decoder_impl::~control_channels_decoder_impl() { } void control_channels_decoder_impl::decode(pmt::pmt_t msg) { ubit_t bursts_u[116 * 4]; sbit_t bursts_s[116 * 4]; uint8_t result[23]; int n_errors, n_bits_total; int8_t header_plus_data[sizeof(gsmtap_hdr)+DATA_BYTES]; d_bursts[d_collected_bursts_num] = msg; d_collected_bursts_num++; //get convecutive bursts if(d_collected_bursts_num==4) { d_collected_bursts_num=0; //reorganize data from input bursts for(int ii = 0; ii < 4; ii++) { pmt::pmt_t header_plus_burst = pmt::cdr(d_bursts[ii]); int8_t * burst_bits = (int8_t *)(pmt::blob_data(header_plus_burst))+sizeof(gsmtap_hdr); memcpy(&bursts_u[ii*116], &burst_bits[3],58); memcpy(&bursts_u[ii*116+58], &burst_bits[3+57+1+26],58); } //convert to soft bits ubits2sbits(bursts_u, bursts_s, 116 * 4); //decode gsm0503_xcch_decode(result, bursts_s, &n_errors, &n_bits_total); //extract header of the first burst of the four bursts pmt::pmt_t first_header_plus_burst = pmt::cdr(d_bursts[0]); gsmtap_hdr * header = (gsmtap_hdr *)pmt::blob_data(first_header_plus_burst); //copy header and data memcpy(header_plus_data, header, sizeof(gsmtap_hdr)); memcpy(header_plus_data+sizeof(gsmtap_hdr), result, DATA_BYTES); //set data type in the header ((gsmtap_hdr*)header_plus_data)->type = GSMTAP_TYPE_UM; //prepare message pmt::pmt_t msg_out = pmt::cons(pmt::PMT_NIL, pmt::make_blob(header_plus_data,DATA_BYTES+sizeof(gsmtap_hdr))); //send message to the output message_port_pub(pmt::mp("msgs"), msg_out); } return; } } /* namespace gsm */ } /* namespace gr */ gr-gsm-0.41.2/lib/decoding/control_channels_decoder_impl.h000066400000000000000000000027141316153413000235270ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2014 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GSM_CONTROL_CHANNELS_DECODER_IMPL_H #define INCLUDED_GSM_CONTROL_CHANNELS_DECODER_IMPL_H #include extern "C" { #include "osmocom/coding/gsm0503_coding.h" } namespace gr { namespace gsm { class control_channels_decoder_impl : public control_channels_decoder { private: unsigned int d_collected_bursts_num; pmt::pmt_t d_bursts[4]; void decode(pmt::pmt_t msg); public: control_channels_decoder_impl(); ~control_channels_decoder_impl(); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_CONTROL_CHANNELS_DECODER_IMPL_H */ gr-gsm-0.41.2/lib/decoding/openbts/000077500000000000000000000000001316153413000167635ustar00rootroot00000000000000gr-gsm-0.41.2/lib/decoding/openbts/AmrCoder.cpp000066400000000000000000001434241316153413000211730ustar00rootroot00000000000000/* * Copyright 2013, 2014 Range Networks, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * This use of this software may be subject to additional restrictions. * See the LEGAL file in the main directory for details. */ #include "BitVector.h" #include "AmrCoder.h" #include #include #include using namespace std; ViterbiTCH_AFS12_2::ViterbiTCH_AFS12_2() { assert(mDeferral < 32); mCoeffs[0] = 0x019; mCoeffsFB[0] = 0x019; mCoeffs[1] = 0x01b; mCoeffsFB[1] = 0x019; for (unsigned i = 0; i < mIRate; i++) { computeStateTables(i); } computeGeneratorTable(); } //void BitVector::encode(const ViterbiTCH_AFS12_2& coder, BitVector& target) const void ViterbiTCH_AFS12_2::encode(const BitVector& in, BitVector& target) const { assert(in.size() == 250); assert(target.size() == 508); const char *u = in.begin(); char *C = target.begin(); const unsigned H = 4; BitVector r(254+H); for (int k = -H; k <= -1; k++) r[k+H] = 0; for (unsigned k = 0; k <= 249; k++) { r[k+H] = u[k] ^ r[k-3+H] ^ r[k-4+H]; C[2*k] = u[k]; C[2*k+1] = r[k+H] ^ r[k-1+H] ^ r[k-3+H] ^ r[k-4+H]; } // termination for (unsigned k = 250; k <= 253; k++) { r[k+H] = 0; C[2*k] = r[k-3+H] ^ r[k-4+H]; C[2*k+1] = r[k+H] ^ r[k-1+H] ^ r[k-3+H] ^ r[k-4+H]; } } //void BitVector::encode(const ViterbiTCH_AFS10_2& coder, BitVector& target) void ViterbiTCH_AFS10_2::encode(const BitVector& in, BitVector& target) const { assert(in.size() == 210); assert(target.size() == 642); const char *u = in.begin(); char *C = target.begin(); const unsigned H = 4; BitVector r(214+H); for (int k = -H; k <= -1; k++) r[k+H] = 0; for (unsigned k = 0; k <= 209; k++) { r[k+H] = u[k] ^ r[k-1+H] ^ r[k-2+H] ^ r[k-3+H] ^ r[k-4+H]; C[3*k] = r[k+H] ^ r[k-1+H] ^ r[k-3+H] ^ r[k-4+H]; C[3*k+1] = r[k+H] ^ r[k-2+H] ^ r[k-4+H]; C[3*k+2] = u[k]; } // termination for (unsigned k = 210; k <= 213; k++) { r[k+H] = 0; C[3*k] = r[k+H] ^ r[k-1+H] ^ r[k-3+H] ^ r[k-4+H]; C[3*k+1] = r[k+H] ^ r[k-2+H] ^ r[k-4+H]; C[3*k+2] = r[k-1+H] ^ r[k-2+H] ^ r[k-3+H] ^ r[k-4+H]; } } //void BitVector::encode(const ViterbiTCH_AFS7_95& coder, BitVector& target) void ViterbiTCH_AFS7_95::encode(const BitVector& in, BitVector& target) const { assert(in.size() == 165); assert(target.size() == 513); const char *u = in.begin(); char *C = target.begin(); const unsigned H = 6; BitVector r(171+H); for (int k = -H; k <= -1; k++) r[k+H] = 0; for (unsigned k = 0; k <= 164; k++) { r[k+H] = u[k] ^ r[k-2+H] ^ r[k-3+H] ^ r[k-5+H] ^ r[k-6+H]; C[3*k] = u[k]; C[3*k+1] = r[k+H] ^ r[k-1+H] ^ r[k-4+H] ^ r[k-6+H]; C[3*k+2] = r[k+H] ^ r[k-1+H] ^ r[k-2+H] ^ r[k-3+H] ^ r[k-4+H] ^ r[k-6+H]; } // termination for (unsigned k = 165; k <= 170; k++) { r[k+H] = 0; C[3*k] = r[k-2+H] ^ r[k-3+H] ^ r[k-5+H] ^ r[k-6+H]; C[3*k+1] = r[k+H] ^ r[k-1+H] ^ r[k-4+H] ^ r[k-6+H]; C[3*k+2] = r[k+H] ^ r[k-1+H] ^ r[k-2+H] ^ r[k-3+H] ^ r[k-4+H] ^ r[k-6+H]; } } void ViterbiTCH_AFS7_4::encode(const BitVector& in, BitVector& target) const { assert(in.size() == 154); assert(target.size() == 474); const char *u = in.begin(); char *C = target.begin(); const unsigned H = 4; BitVector r(158+H); for (int k = -H; k <= -1; k++) r[k+H] = 0; for (unsigned k = 0; k <= 153; k++) { r[k+H] = u[k] ^ r[k-1+H] ^ r[k-2+H] ^ r[k-3+H] ^ r[k-4+H]; C[3*k] = r[k+H] ^ r[k-1+H] ^ r[k-3+H] ^ r[k-4+H]; C[3*k+1] = r[k+H] ^ r[k-2+H] ^ r[k-4+H]; C[3*k+2] = u[k]; } // termination for (unsigned k = 154; k <= 157; k++) { r[k+H] = 0; C[3*k] = r[k+H] ^ r[k-1+H] ^ r[k-3+H] ^ r[k-4+H]; C[3*k+1] = r[k+H] ^ r[k-2+H] ^ r[k-4+H]; C[3*k+2] = r[k-1+H] ^ r[k-2+H] ^ r[k-3+H] ^ r[k-4+H]; } } void ViterbiTCH_AFS6_7::encode(const BitVector& in, BitVector& target) const { assert(in.size() == 140); assert(target.size() == 576); const char *u = in.begin(); char *C = target.begin(); const unsigned H = 4; BitVector r(144+H); for (int k = -H; k <= -1; k++) r[k+H] = 0; for (unsigned k = 0; k <= 139; k++) { r[k+H] = u[k] ^ r[k-1+H] ^ r[k-2+H] ^ r[k-3+H] ^ r[k-4+H]; C[4*k] = r[k+H] ^ r[k-1+H] ^ r[k-3+H] ^ r[k-4+H]; C[4*k+1] = r[k+H] ^ r[k-2+H] ^ r[k-4+H]; C[4*k+2] = u[k]; C[4*k+3] = u[k]; } // termination for (unsigned k = 140; k <= 143; k++) { r[k+H] = 0; C[4*k] = r[k+H] ^ r[k-1+H] ^ r[k-3+H] ^ r[k-4+H]; C[4*k+1] = r[k+H] ^ r[k-2+H] ^ r[k-4+H]; C[4*k+2] = r[k-1+H] ^ r[k-2+H] ^ r[k-3+H] ^ r[k-4+H]; C[4*k+3] = r[k-1+H] ^ r[k-2+H] ^ r[k-3+H] ^ r[k-4+H]; } } void ViterbiTCH_AFS5_9::encode(const BitVector& in, BitVector& target) const { assert(in.size() == 124); assert(target.size() == 520); const char *u = in.begin(); char *C = target.begin(); const unsigned H = 6; BitVector r(130+H); for (int k = -H; k <= -1; k++) r[k+H] = 0; for (unsigned k = 0; k <= 123; k++) { r[k+H] = u[k] ^ r[k-1+H] ^ r[k-2+H] ^ r[k-3+H] ^ r[k-4+H] ^ r[k-6+H]; C[4*k] = r[k+H] ^ r[k-2+H] ^ r[k-3+H] ^ r[k-5+H] ^ r[k-6+H]; C[4*k+1] = r[k+H] ^ r[k-1+H] ^ r[k-4+H] ^ r[k-6+H]; C[4*k+2] = u[k]; C[4*k+3] = u[k]; } // termination for (unsigned k = 124; k <= 129; k++) { r[k+H] = 0; C[4*k] = r[k+H] ^ r[k-2+H] ^ r[k-3+H] ^ r[k-5+H] ^ r[k-6+H]; C[4*k+1] = r[k+H] ^ r[k-1+H] ^ r[k-4+H] ^ r[k-6+H]; C[4*k+2] = r[k-1+H] ^ r[k-2+H] ^ r[k-3+H] ^ r[k-4+H] ^ r[k-6+H]; C[4*k+3] = r[k-1+H] ^ r[k-2+H] ^ r[k-3+H] ^ r[k-4+H] ^ r[k-6+H]; } } void ViterbiTCH_AFS5_15::encode(const BitVector& in, BitVector& target) const { assert(in.size() == 109); assert(target.size() == 565); const char *u = in.begin(); char *C = target.begin(); const unsigned H = 4; BitVector r(113+H); for (int k = -H; k <= -1; k++) r[k+H] = 0; for (unsigned k = 0; k <= 108; k++) { r[k+H] = u[k] ^ r[k-1+H] ^ r[k-2+H] ^ r[k-3+H] ^ r[k-4+H]; C[5*k] = r[k+H] ^ r[k-1+H] ^ r[k-3+H] ^ r[k-4+H]; C[5*k+1] = r[k+H] ^ r[k-1+H] ^ r[k-3+H] ^ r[k-4+H]; C[5*k+2] = r[k+H] ^ r[k-2+H] ^ r[k-4+H]; C[5*k+3] = u[k]; C[5*k+4] = u[k]; } // termination for (unsigned k = 109; k <= 112; k++) { r[k+H] = 0; C[5*k] = r[k+H] ^ r[k-1+H] ^ r[k-3+H] ^ r[k-4+H]; C[5*k+1] = r[k+H] ^ r[k-1+H] ^ r[k-3+H] ^ r[k-4+H]; C[5*k+2] = r[k+H] ^ r[k-2+H] ^ r[k-4+H]; C[5*k+3] = r[k-1+H] ^ r[k-2+H] ^ r[k-3+H] ^ r[k-4+H]; C[5*k+4] = r[k-1+H] ^ r[k-2+H] ^ r[k-3+H] ^ r[k-4+H]; } } void ViterbiTCH_AFS4_75::encode(const BitVector& in, BitVector& target) const { assert(in.size() == 101); assert(target.size() == 535); const char *u = in.begin(); char *C = target.begin(); const unsigned H = 6; BitVector r(107+H); for (int k = -H; k <= -1; k++) r[k+H] = 0; for (unsigned k = 0; k <= 100; k++) { r[k+H] = u[k] ^ r[k-1+H] ^ r[k-2+H] ^ r[k-3+H] ^ r[k-4+H] ^ r[k-6+H]; C[5*k] = r[k+H] ^ r[k-2+H] ^ r[k-3+H] ^ r[k-5+H] ^ r[k-6+H]; C[5*k+1] = r[k+H] ^ r[k-2+H] ^ r[k-3+H] ^ r[k-5+H] ^ r[k-6+H]; C[5*k+2] = r[k+H] ^ r[k-1+H] ^ r[k-4+H] ^ r[k-6+H]; C[5*k+3] = u[k]; C[5*k+4] = u[k]; } // termination for (unsigned k = 101; k <= 106; k++) { r[k+H] = 0; C[5*k] = r[k+H] ^ r[k-2+H] ^ r[k-3+H] ^ r[k-5+H] ^ r[k-6+H]; C[5*k+1] = r[k+H] ^ r[k-2+H] ^ r[k-3+H] ^ r[k-5+H] ^ r[k-6+H]; C[5*k+2] = r[k+H] ^ r[k-1+H] ^ r[k-4+H] ^ r[k-6+H]; C[5*k+3] = r[k+H] ^ r[k-2+H] ^ r[k-3+H] ^ r[k-4+H] ^ r[k-6+H]; C[5*k+4] = r[k-1+H] ^ r[k-2+H] ^ r[k-3+H] ^ r[k-4+H] ^ r[k-6+H]; } } void ViterbiTCH_AFS12_2::initializeStates() { for (unsigned i=0; ioState) << mIRate; for (unsigned in = 0; in <= 1; in++) { mCandidates[cand+in].iState = ((sp->iState) << 1) | in; mCandidates[cand+in].cost = sp->cost; uint32_t outputs = oStateShifted; for (unsigned out = 0; out < mIRate; out++) { char feedback = applyPoly(sp->rState[out], mCoeffsFB[out] ^ 1, mOrder+1); char rState = (((sp->rState[out]) ^ feedback) << 1) | in; mCandidates[cand+in].rState[out] = rState; outputs |= (mGeneratorTable[rState & mCMask] & (1 << (mIRate - out - 1))); } mCandidates[cand+in].oState = outputs; } sp++; } } void ViterbiTCH_AFS12_2::getSoftCostMetrics(const uint32_t inSample, const float *matchCost, const float *mismatchCost) { const float *cTab[2] = {matchCost,mismatchCost}; for (unsigned i=0; i>i)&0x01][mIRate-i-1]; } } } void ViterbiTCH_AFS12_2::pruneCandidates() { const vCand* c1 = mCandidates; // 0-prefix const vCand* c2 = mCandidates + mIStates; // 1-prefix for (unsigned i=0; i=minCost) continue; minCost = thisCost; minIndex=i; } return mSurvivors[minIndex]; } const ViterbiTCH_AFS12_2::vCand& ViterbiTCH_AFS12_2::step(uint32_t inSample, const float *probs, const float *iprobs) { branchCandidates(); getSoftCostMetrics(inSample,probs,iprobs); pruneCandidates(); return minCost(); } void ViterbiTCH_AFS12_2::decode(const SoftVector &in, BitVector& target) { ViterbiTCH_AFS12_2 &decoder = *this; const size_t sz = in.size() - 8; const unsigned deferral = decoder.deferral(); const size_t ctsz = sz + deferral*decoder.iRate(); assert(sz == decoder.iRate()*target.size()); // Build a "history" array where each element contains the full history. uint32_t history[ctsz]; { BitVector bits = in.sliced(); uint32_t accum = 0; for (size_t i=0; i0.5F) pVal = 1.0F-pVal; float ipVal = 1.0F-pVal; // This is a cheap approximation to an ideal cost function. if (pVal<0.01F) pVal = 0.01; if (ipVal<0.01F) ipVal = 0.01; matchCostTable[i] = 0.25F/ipVal; mismatchCostTable[i] = 0.25F/pVal; } // pad end of table with unknowns for (size_t i=sz; i=deferral) *op++ = (minCost.iState >> deferral)&0x01; oCount++; } } } ViterbiTCH_AFS10_2::ViterbiTCH_AFS10_2() { assert(mDeferral < 32); mCoeffs[0] = 0x01b; mCoeffsFB[0] = 0x01f; mCoeffs[1] = 0x015; mCoeffsFB[1] = 0x01f; mCoeffs[2] = 0x01f; mCoeffsFB[2] = 0x01f; for (unsigned i = 0; i < mIRate; i++) { computeStateTables(i); } computeGeneratorTable(); } void ViterbiTCH_AFS10_2::initializeStates() { for (unsigned i=0; ioState) << mIRate; for (unsigned in = 0; in <= 1; in++) { mCandidates[cand+in].iState = ((sp->iState) << 1) | in; mCandidates[cand+in].cost = sp->cost; uint32_t outputs = oStateShifted; for (unsigned out = 0; out < mIRate; out++) { char feedback = applyPoly(sp->rState[out], mCoeffsFB[out] ^ 1, mOrder+1); char rState = (((sp->rState[out]) ^ feedback) << 1) | in; mCandidates[cand+in].rState[out] = rState; outputs |= (mGeneratorTable[rState & mCMask] & (1 << (mIRate - out - 1))); } mCandidates[cand+in].oState = outputs; } sp++; } } void ViterbiTCH_AFS10_2::getSoftCostMetrics(const uint32_t inSample, const float *matchCost, const float *mismatchCost) { const float *cTab[2] = {matchCost,mismatchCost}; for (unsigned i=0; i>i)&0x01][mIRate-i-1]; } } } void ViterbiTCH_AFS10_2::pruneCandidates() { const vCand* c1 = mCandidates; // 0-prefix const vCand* c2 = mCandidates + mIStates; // 1-prefix for (unsigned i=0; i=minCost) continue; minCost = thisCost; minIndex=i; } return mSurvivors[minIndex]; } const ViterbiTCH_AFS10_2::vCand& ViterbiTCH_AFS10_2::step(uint32_t inSample, const float *probs, const float *iprobs) { branchCandidates(); getSoftCostMetrics(inSample,probs,iprobs); pruneCandidates(); return minCost(); } void ViterbiTCH_AFS10_2::decode(const SoftVector &in, BitVector& target) { ViterbiTCH_AFS10_2 &decoder = *this; const size_t sz = in.size() - 12; const unsigned deferral = decoder.deferral(); const size_t ctsz = sz + deferral*decoder.iRate(); assert(sz == decoder.iRate()*target.size()); // Build a "history" array where each element contains the full history. uint32_t history[ctsz]; { BitVector bits = in.sliced(); uint32_t accum = 0; for (size_t i=0; i0.5F) pVal = 1.0F-pVal; float ipVal = 1.0F-pVal; // This is a cheap approximation to an ideal cost function. if (pVal<0.01F) pVal = 0.01; if (ipVal<0.01F) ipVal = 0.01; matchCostTable[i] = 0.25F/ipVal; mismatchCostTable[i] = 0.25F/pVal; } // pad end of table with unknowns for (size_t i=sz; i=deferral) *op++ = (minCost.iState >> deferral)&0x01; oCount++; } } } ViterbiTCH_AFS7_95::ViterbiTCH_AFS7_95() { assert(mDeferral < 32); mCoeffs[0] = 0x06d; mCoeffsFB[0] = 0x06d; mCoeffs[1] = 0x053; mCoeffsFB[1] = 0x06d; mCoeffs[2] = 0x05f; mCoeffsFB[2] = 0x06d; for (unsigned i = 0; i < mIRate; i++) { computeStateTables(i); } computeGeneratorTable(); } void ViterbiTCH_AFS7_95::initializeStates() { for (unsigned i=0; ioState) << mIRate; for (unsigned in = 0; in <= 1; in++) { mCandidates[cand+in].iState = ((sp->iState) << 1) | in; mCandidates[cand+in].cost = sp->cost; uint32_t outputs = oStateShifted; for (unsigned out = 0; out < mIRate; out++) { char feedback = applyPoly(sp->rState[out], mCoeffsFB[out] ^ 1, mOrder+1); char rState = (((sp->rState[out]) ^ feedback) << 1) | in; mCandidates[cand+in].rState[out] = rState; outputs |= (mGeneratorTable[rState & mCMask] & (1 << (mIRate - out - 1))); } mCandidates[cand+in].oState = outputs; } sp++; } } void ViterbiTCH_AFS7_95::getSoftCostMetrics(const uint32_t inSample, const float *matchCost, const float *mismatchCost) { const float *cTab[2] = {matchCost,mismatchCost}; for (unsigned i=0; i>i)&0x01][mIRate-i-1]; } } } void ViterbiTCH_AFS7_95::pruneCandidates() { const vCand* c1 = mCandidates; // 0-prefix const vCand* c2 = mCandidates + mIStates; // 1-prefix for (unsigned i=0; i=minCost) continue; minCost = thisCost; minIndex=i; } return mSurvivors[minIndex]; } const ViterbiTCH_AFS7_95::vCand& ViterbiTCH_AFS7_95::step(uint32_t inSample, const float *probs, const float *iprobs) { branchCandidates(); getSoftCostMetrics(inSample,probs,iprobs); pruneCandidates(); return minCost(); } void ViterbiTCH_AFS7_95::decode(const SoftVector &in, BitVector& target) { ViterbiTCH_AFS7_95 &decoder = *this; const size_t sz = in.size() - 18; const unsigned deferral = decoder.deferral(); const size_t ctsz = sz + deferral*decoder.iRate(); assert(sz == decoder.iRate()*target.size()); // Build a "history" array where each element contains the full history. uint32_t history[ctsz]; { BitVector bits = in.sliced(); uint32_t accum = 0; for (size_t i=0; i0.5F) pVal = 1.0F-pVal; float ipVal = 1.0F-pVal; // This is a cheap approximation to an ideal cost function. if (pVal<0.01F) pVal = 0.01; if (ipVal<0.01F) ipVal = 0.01; matchCostTable[i] = 0.25F/ipVal; mismatchCostTable[i] = 0.25F/pVal; } // pad end of table with unknowns for (size_t i=sz; i=deferral) *op++ = (minCost.iState >> deferral)&0x01; oCount++; } } } ViterbiTCH_AFS7_4::ViterbiTCH_AFS7_4() { assert(mDeferral < 32); mCoeffs[0] = 0x01b; mCoeffsFB[0] = 0x01f; mCoeffs[1] = 0x015; mCoeffsFB[1] = 0x01f; mCoeffs[2] = 0x01f; mCoeffsFB[2] = 0x01f; for (unsigned i = 0; i < mIRate; i++) { computeStateTables(i); } computeGeneratorTable(); } void ViterbiTCH_AFS7_4::initializeStates() { for (unsigned i=0; ioState) << mIRate; for (unsigned in = 0; in <= 1; in++) { mCandidates[cand+in].iState = ((sp->iState) << 1) | in; mCandidates[cand+in].cost = sp->cost; uint32_t outputs = oStateShifted; for (unsigned out = 0; out < mIRate; out++) { char feedback = applyPoly(sp->rState[out], mCoeffsFB[out] ^ 1, mOrder+1); char rState = (((sp->rState[out]) ^ feedback) << 1) | in; mCandidates[cand+in].rState[out] = rState; outputs |= (mGeneratorTable[rState & mCMask] & (1 << (mIRate - out - 1))); } mCandidates[cand+in].oState = outputs; } sp++; } } void ViterbiTCH_AFS7_4::getSoftCostMetrics(const uint32_t inSample, const float *matchCost, const float *mismatchCost) { const float *cTab[2] = {matchCost,mismatchCost}; for (unsigned i=0; i>i)&0x01][mIRate-i-1]; } } } void ViterbiTCH_AFS7_4::pruneCandidates() { const vCand* c1 = mCandidates; // 0-prefix const vCand* c2 = mCandidates + mIStates; // 1-prefix for (unsigned i=0; i=minCost) continue; minCost = thisCost; minIndex=i; } return mSurvivors[minIndex]; } const ViterbiTCH_AFS7_4::vCand& ViterbiTCH_AFS7_4::step(uint32_t inSample, const float *probs, const float *iprobs) { branchCandidates(); getSoftCostMetrics(inSample,probs,iprobs); pruneCandidates(); return minCost(); } void ViterbiTCH_AFS7_4::decode(const SoftVector &in, BitVector& target) { ViterbiTCH_AFS7_4 &decoder = *this; const size_t sz = in.size() - 12; const unsigned deferral = decoder.deferral(); const size_t ctsz = sz + deferral*decoder.iRate(); assert(sz == decoder.iRate()*target.size()); // Build a "history" array where each element contains the full history. uint32_t history[ctsz]; { BitVector bits = in.sliced(); uint32_t accum = 0; for (size_t i=0; i0.5F) pVal = 1.0F-pVal; float ipVal = 1.0F-pVal; // This is a cheap approximation to an ideal cost function. if (pVal<0.01F) pVal = 0.01; if (ipVal<0.01F) ipVal = 0.01; matchCostTable[i] = 0.25F/ipVal; mismatchCostTable[i] = 0.25F/pVal; } // pad end of table with unknowns for (size_t i=sz; i=deferral) *op++ = (minCost.iState >> deferral)&0x01; oCount++; } } } ViterbiTCH_AFS6_7::ViterbiTCH_AFS6_7() { assert(mDeferral < 32); mCoeffs[0] = 0x01b; mCoeffsFB[0] = 0x01f; mCoeffs[1] = 0x015; mCoeffsFB[1] = 0x01f; mCoeffs[2] = 0x01f; mCoeffsFB[2] = 0x01f; mCoeffs[3] = 0x01f; mCoeffsFB[3] = 0x01f; for (unsigned i = 0; i < mIRate; i++) { computeStateTables(i); } computeGeneratorTable(); } void ViterbiTCH_AFS6_7::initializeStates() { for (unsigned i=0; ioState) << mIRate; for (unsigned in = 0; in <= 1; in++) { mCandidates[cand+in].iState = ((sp->iState) << 1) | in; mCandidates[cand+in].cost = sp->cost; uint32_t outputs = oStateShifted; for (unsigned out = 0; out < mIRate; out++) { char feedback = applyPoly(sp->rState[out], mCoeffsFB[out] ^ 1, mOrder+1); char rState = (((sp->rState[out]) ^ feedback) << 1) | in; mCandidates[cand+in].rState[out] = rState; outputs |= (mGeneratorTable[rState & mCMask] & (1 << (mIRate - out - 1))); } mCandidates[cand+in].oState = outputs; } sp++; } } void ViterbiTCH_AFS6_7::getSoftCostMetrics(const uint32_t inSample, const float *matchCost, const float *mismatchCost) { const float *cTab[2] = {matchCost,mismatchCost}; for (unsigned i=0; i>i)&0x01][mIRate-i-1]; } } } void ViterbiTCH_AFS6_7::pruneCandidates() { const vCand* c1 = mCandidates; // 0-prefix const vCand* c2 = mCandidates + mIStates; // 1-prefix for (unsigned i=0; i=minCost) continue; minCost = thisCost; minIndex=i; } return mSurvivors[minIndex]; } const ViterbiTCH_AFS6_7::vCand& ViterbiTCH_AFS6_7::step(uint32_t inSample, const float *probs, const float *iprobs) { branchCandidates(); getSoftCostMetrics(inSample,probs,iprobs); pruneCandidates(); return minCost(); } void ViterbiTCH_AFS6_7::decode(const SoftVector &in, BitVector& target) { ViterbiTCH_AFS6_7 &decoder = *this; const size_t sz = in.size() - 16; const unsigned deferral = decoder.deferral(); const size_t ctsz = sz + deferral*decoder.iRate(); assert(sz == decoder.iRate()*target.size()); // Build a "history" array where each element contains the full history. uint32_t history[ctsz]; { BitVector bits = in.sliced(); uint32_t accum = 0; for (size_t i=0; i0.5F) pVal = 1.0F-pVal; float ipVal = 1.0F-pVal; // This is a cheap approximation to an ideal cost function. if (pVal<0.01F) pVal = 0.01; if (ipVal<0.01F) ipVal = 0.01; matchCostTable[i] = 0.25F/ipVal; mismatchCostTable[i] = 0.25F/pVal; } // pad end of table with unknowns for (size_t i=sz; i=deferral) *op++ = (minCost.iState >> deferral)&0x01; oCount++; } } } ViterbiTCH_AFS5_9::ViterbiTCH_AFS5_9() { assert(mDeferral < 32); mCoeffs[0] = 0x06d; mCoeffsFB[0] = 0x05f; mCoeffs[1] = 0x053; mCoeffsFB[1] = 0x05f; mCoeffs[2] = 0x05f; mCoeffsFB[2] = 0x05f; mCoeffs[3] = 0x05f; mCoeffsFB[3] = 0x05f; for (unsigned i = 0; i < mIRate; i++) { computeStateTables(i); } computeGeneratorTable(); } void ViterbiTCH_AFS5_9::initializeStates() { for (unsigned i=0; ioState) << mIRate; for (unsigned in = 0; in <= 1; in++) { mCandidates[cand+in].iState = ((sp->iState) << 1) | in; mCandidates[cand+in].cost = sp->cost; uint32_t outputs = oStateShifted; for (unsigned out = 0; out < mIRate; out++) { char feedback = applyPoly(sp->rState[out], mCoeffsFB[out] ^ 1, mOrder+1); char rState = (((sp->rState[out]) ^ feedback) << 1) | in; mCandidates[cand+in].rState[out] = rState; outputs |= (mGeneratorTable[rState & mCMask] & (1 << (mIRate - out - 1))); } mCandidates[cand+in].oState = outputs; } sp++; } } void ViterbiTCH_AFS5_9::getSoftCostMetrics(const uint32_t inSample, const float *matchCost, const float *mismatchCost) { const float *cTab[2] = {matchCost,mismatchCost}; for (unsigned i=0; i>i)&0x01][mIRate-i-1]; } } } void ViterbiTCH_AFS5_9::pruneCandidates() { const vCand* c1 = mCandidates; // 0-prefix const vCand* c2 = mCandidates + mIStates; // 1-prefix for (unsigned i=0; i=minCost) continue; minCost = thisCost; minIndex=i; } return mSurvivors[minIndex]; } const ViterbiTCH_AFS5_9::vCand& ViterbiTCH_AFS5_9::step(uint32_t inSample, const float *probs, const float *iprobs) { branchCandidates(); getSoftCostMetrics(inSample,probs,iprobs); pruneCandidates(); return minCost(); } void ViterbiTCH_AFS5_9::decode(const SoftVector &in, BitVector& target) { ViterbiTCH_AFS5_9 &decoder = *this; const size_t sz = in.size() - 24; const unsigned deferral = decoder.deferral(); const size_t ctsz = sz + deferral*decoder.iRate(); assert(sz == decoder.iRate()*target.size()); // Build a "history" array where each element contains the full history. uint32_t history[ctsz]; { BitVector bits = in.sliced(); uint32_t accum = 0; for (size_t i=0; i0.5F) pVal = 1.0F-pVal; float ipVal = 1.0F-pVal; // This is a cheap approximation to an ideal cost function. if (pVal<0.01F) pVal = 0.01; if (ipVal<0.01F) ipVal = 0.01; matchCostTable[i] = 0.25F/ipVal; mismatchCostTable[i] = 0.25F/pVal; } // pad end of table with unknowns for (size_t i=sz; i=deferral) *op++ = (minCost.iState >> deferral)&0x01; oCount++; } } } ViterbiTCH_AFS5_15::ViterbiTCH_AFS5_15() { assert(mDeferral < 32); mCoeffs[0] = 0x01b; mCoeffsFB[0] = 0x01f; mCoeffs[1] = 0x01b; mCoeffsFB[1] = 0x01f; mCoeffs[2] = 0x015; mCoeffsFB[2] = 0x01f; mCoeffs[3] = 0x01f; mCoeffsFB[3] = 0x01f; mCoeffs[4] = 0x01f; mCoeffsFB[4] = 0x01f; for (unsigned i = 0; i < mIRate; i++) { computeStateTables(i); } computeGeneratorTable(); } void ViterbiTCH_AFS5_15::initializeStates() { for (unsigned i=0; ioState) << mIRate; for (unsigned in = 0; in <= 1; in++) { mCandidates[cand+in].iState = ((sp->iState) << 1) | in; mCandidates[cand+in].cost = sp->cost; uint32_t outputs = oStateShifted; for (unsigned out = 0; out < mIRate; out++) { char feedback = applyPoly(sp->rState[out], mCoeffsFB[out] ^ 1, mOrder+1); char rState = (((sp->rState[out]) ^ feedback) << 1) | in; mCandidates[cand+in].rState[out] = rState; outputs |= (mGeneratorTable[rState & mCMask] & (1 << (mIRate - out - 1))); } mCandidates[cand+in].oState = outputs; } sp++; } } void ViterbiTCH_AFS5_15::getSoftCostMetrics(const uint32_t inSample, const float *matchCost, const float *mismatchCost) { const float *cTab[2] = {matchCost,mismatchCost}; for (unsigned i=0; i>i)&0x01][mIRate-i-1]; } } } void ViterbiTCH_AFS5_15::pruneCandidates() { const vCand* c1 = mCandidates; // 0-prefix const vCand* c2 = mCandidates + mIStates; // 1-prefix for (unsigned i=0; i=minCost) continue; minCost = thisCost; minIndex=i; } return mSurvivors[minIndex]; } const ViterbiTCH_AFS5_15::vCand& ViterbiTCH_AFS5_15::step(uint32_t inSample, const float *probs, const float *iprobs) { branchCandidates(); getSoftCostMetrics(inSample,probs,iprobs); pruneCandidates(); return minCost(); } void ViterbiTCH_AFS5_15::decode(const SoftVector &in, BitVector& target) { ViterbiTCH_AFS5_15 &decoder = *this; const size_t sz = in.size() - 20; const unsigned deferral = decoder.deferral(); const size_t ctsz = sz + deferral*decoder.iRate(); assert(sz == decoder.iRate()*target.size()); // Build a "history" array where each element contains the full history. uint32_t history[ctsz]; { BitVector bits = in.sliced(); uint32_t accum = 0; for (size_t i=0; i0.5F) pVal = 1.0F-pVal; float ipVal = 1.0F-pVal; // This is a cheap approximation to an ideal cost function. if (pVal<0.01F) pVal = 0.01; if (ipVal<0.01F) ipVal = 0.01; matchCostTable[i] = 0.25F/ipVal; mismatchCostTable[i] = 0.25F/pVal; } // pad end of table with unknowns for (size_t i=sz; i=deferral) *op++ = (minCost.iState >> deferral)&0x01; oCount++; } } } ViterbiTCH_AFS4_75::ViterbiTCH_AFS4_75() { assert(mDeferral < 32); mCoeffs[0] = 0x06d; mCoeffsFB[0] = 0x05f; mCoeffs[1] = 0x06d; mCoeffsFB[1] = 0x05f; mCoeffs[2] = 0x053; mCoeffsFB[2] = 0x05f; mCoeffs[3] = 0x05f; mCoeffsFB[3] = 0x05f; mCoeffs[4] = 0x05f; mCoeffsFB[4] = 0x05f; for (unsigned i = 0; i < mIRate; i++) { computeStateTables(i); } computeGeneratorTable(); } void ViterbiTCH_AFS4_75::initializeStates() { for (unsigned i=0; ioState) << mIRate; for (unsigned in = 0; in <= 1; in++) { mCandidates[cand+in].iState = ((sp->iState) << 1) | in; mCandidates[cand+in].cost = sp->cost; uint32_t outputs = oStateShifted; for (unsigned out = 0; out < mIRate; out++) { char feedback = applyPoly(sp->rState[out], mCoeffsFB[out] ^ 1, mOrder+1); char rState = (((sp->rState[out]) ^ feedback) << 1) | in; mCandidates[cand+in].rState[out] = rState; outputs |= (mGeneratorTable[rState & mCMask] & (1 << (mIRate - out - 1))); } mCandidates[cand+in].oState = outputs; } sp++; } } void ViterbiTCH_AFS4_75::getSoftCostMetrics(const uint32_t inSample, const float *matchCost, const float *mismatchCost) { const float *cTab[2] = {matchCost,mismatchCost}; for (unsigned i=0; i>i)&0x01][mIRate-i-1]; } } } void ViterbiTCH_AFS4_75::pruneCandidates() { const vCand* c1 = mCandidates; // 0-prefix const vCand* c2 = mCandidates + mIStates; // 1-prefix for (unsigned i=0; i=minCost) continue; minCost = thisCost; minIndex=i; } return mSurvivors[minIndex]; } const ViterbiTCH_AFS4_75::vCand& ViterbiTCH_AFS4_75::step(uint32_t inSample, const float *probs, const float *iprobs) { branchCandidates(); getSoftCostMetrics(inSample,probs,iprobs); pruneCandidates(); return minCost(); } void ViterbiTCH_AFS4_75::decode(const SoftVector &in, BitVector& target) { ViterbiTCH_AFS4_75 &decoder = *this; const size_t sz = in.size() - 30; const unsigned deferral = decoder.deferral(); const size_t ctsz = sz + deferral*decoder.iRate(); assert(sz == decoder.iRate()*target.size()); // Build a "history" array where each element contains the full history. uint32_t history[ctsz]; { BitVector bits = in.sliced(); uint32_t accum = 0; for (size_t i=0; i0.5F) pVal = 1.0F-pVal; float ipVal = 1.0F-pVal; // This is a cheap approximation to an ideal cost function. if (pVal<0.01F) pVal = 0.01; if (ipVal<0.01F) ipVal = 0.01; matchCostTable[i] = 0.25F/ipVal; mismatchCostTable[i] = 0.25F/pVal; } // pad end of table with unknowns for (size_t i=sz; i=deferral) *op++ = (minCost.iState >> deferral)&0x01; oCount++; } } } gr-gsm-0.41.2/lib/decoding/openbts/AmrCoder.h000066400000000000000000000677341316153413000206510ustar00rootroot00000000000000/* * Copyright 2013, 2014 Range Networks, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * This use of this software may be subject to additional restrictions. * See the LEGAL file in the main directory for details. */ #ifndef _AMRCODER_H_ #define _AMRCODER_H_ #include #include "BitVector.h" #include "Viterbi.h" /** Class to represent recursive systematic convolutional coders/decoders of rate 1/2, memory length 4. */ class ViterbiTCH_AFS12_2 : public ViterbiBase { private: /**name Lots of precomputed elements so the compiler can optimize like hell. */ //@{ /**@name Core values. */ //@{ static const unsigned mIRate = 2; ///< reciprocal of rate static const unsigned mOrder = 4; ///< memory length of generators //@} /**@name Derived values. */ //@{ static const unsigned mIStates = 0x01 << mOrder; ///< number of states, number of survivors static const uint32_t mSMask = mIStates-1; ///< survivor mask static const uint32_t mCMask = (mSMask<<1) | 0x01; ///< candidate mask static const uint32_t mOMask = (0x01<. * * This use of this software may be subject to additional restrictions. * See the LEGAL file in the main directory for details. */ #include "BitVector.h" #include #include #include #include //#include using namespace std; BitVector::BitVector(const char *valString) { // 1-30-2013 pat: I dont know what this was intended to do, but it did not create a normalized BitVector, // and it could even fail if the accum overlows 8 bits. //uint32_t accum = 0; //for (size_t i=0; i=0; i--) { accum = (accum<<1) | ((*dp--) & 0x01); } return accum; } uint64_t BitVector::readField(size_t& readIndex, unsigned length) const { const uint64_t retVal = peekField(readIndex,length); readIndex += length; return retVal; } uint64_t BitVector::readFieldReversed(size_t& readIndex, unsigned length) const { const uint64_t retVal = peekFieldReversed(readIndex,length); readIndex += length; return retVal; } void BitVector::fillField(size_t writeIndex, uint64_t value, unsigned length) { if (length != 0) { char *dpBase = mStart + writeIndex; char *dp = dpBase + length - 1; assert(dp < mEnd); while (dp>=dpBase) { *dp-- = value & 0x01; value >>= 1; } } } void BitVector::fillFieldReversed(size_t writeIndex, uint64_t value, unsigned length) { if (length != 0) { char *dp = mStart + writeIndex; char *dpEnd = dp + length - 1; assert(dpEnd < mEnd); while (dp<=dpEnd) { *dp++ = value & 0x01; value >>= 1; } } } void BitVector::writeField(size_t& writeIndex, uint64_t value, unsigned length) { if (length != 0) { fillField(writeIndex,value,length); writeIndex += length; } } void BitVector::writeFieldReversed(size_t& writeIndex, uint64_t value, unsigned length) { if (length != 0) { fillFieldReversed(writeIndex,value,length); writeIndex += length; } } void BitVector::invert() { for (size_t i=0; i=8); char tmp0 = mStart[0]; mStart[0] = mStart[7]; mStart[7] = tmp0; char tmp1 = mStart[1]; mStart[1] = mStart[6]; mStart[6] = tmp1; char tmp2 = mStart[2]; mStart[2] = mStart[5]; mStart[5] = tmp2; char tmp3 = mStart[3]; mStart[3] = mStart[4]; mStart[4] = tmp3; } void BitVector::LSB8MSB() { if (size()<8) return; size_t size8 = 8*(size()/8); size_t iTop = size8 - 8; for (size_t i=0; i<=iTop; i+=8) segment(i,8).reverse8(); } uint64_t BitVector::syndrome(Generator& gen) const { gen.clear(); const char *dp = mStart; while (dp0.5F) newSig[i]=1; else newSig[i] = 0; } return newSig; } // (pat) Added 6-22-2012 float SoftVector::getEnergy(float *plow) const { const SoftVector &vec = *this; int len = vec.size(); float avg = 0; float low = 1; for (int i = 0; i < len; i++) { float bit = vec[i]; float energy = 2*((bit < 0.5) ? (0.5-bit) : (bit-0.5)); if (energy < low) low = energy; avg += energy/len; } if (plow) { *plow = low; } return avg; } // (pat) Added 1-2014. Compute SNR of a soft vector. Very similar to above. // Since we dont really know what the expected signal values are, we will assume that the signal is 0 or 1 // and return the SNR on that basis. // SNR is power(signal) / power(noise) where power can be calculated as (RMS(signal) / RMS(noise))**2 of the values. // Since RMS is square-rooted, ie RMS = sqrt(1/n * (x1**2 + x2**2 ...)), we just add up the squares. // To compute RMS of the signal we will remove any constant offset, so the signal values are either 0.5 or -0.5, // so the RMS of the signal is just 0.5**2 * len; all we need to compute is the noise component. float SoftVector::getSNR() const { float sumSquaresNoise = 0; const SoftVector &vec = *this; int len = vec.size(); if (len == 0) { return 0.0; } for (int i = 0; i < len; i++) { float bit = vec[i]; if (bit < 0.5) { // Assume signal is 0. sumSquaresNoise += (bit - 0.0) * (bit - 0.0); } else { // Assume signal is 1. sumSquaresNoise += (bit - 1.0) * (bit - 1.0); } } float sumSquaresSignal = 0.5 * 0.5 * len; // I really want log10 of this to convert to dB, but log is expensive, and Harvind seems to like absolute SNR. // Clamp max to 999; it shouldnt get up there but be sure. This also avoids divide by zero. if (sumSquaresNoise * 1000 < sumSquaresSignal) return 999; return sumSquaresSignal / sumSquaresNoise; } ostream& operator<<(ostream& os, const SoftVector& sv) { for (size_t i=0; i0.75) os << "1"; else os << "-"; } return os; } void BitVector::pack(unsigned char* targ) const { // Assumes MSB-first packing. unsigned bytes = size()/8; for (unsigned i=0; ipack(result.c_str()) but technically c_str() is read-only. unsigned bytes = size()/8; for (unsigned i=0; i> (8-rem),rem); } void BitVector::hex(ostream& os) const { os << std::hex; unsigned digits = size()/4; size_t wp=0; for (unsigned i=0; i0) { if (sscanf(src+digits, "%1x", &val) < 1) { return false; } fillField(whole,val,rem); } return true; } bool BitVector::operator==(const BitVector &other) const { unsigned l = size(); return l == other.size() && 0==memcmp(begin(),other.begin(),l); } void BitVector::copyPunctured(BitVector &dst, const unsigned *puncture, const size_t plth) { assert(size() - plth == dst.size()); char *srcp = mStart; char *dstp = dst.mStart; const unsigned *pend = puncture + plth; while (srcp < mEnd) { if (puncture < pend) { int n = (*puncture++) - (srcp - mStart); assert(n >= 0); for (int i = 0; i < n; i++) { assert(srcp < mEnd && dstp < dst.mEnd); *dstp++ = *srcp++; } srcp++; } else { while (srcp < mEnd) { assert(dstp < dst.mEnd); *dstp++ = *srcp++; } } } assert(dstp == dst.mEnd && puncture == pend); } void SoftVector::copyUnPunctured(SoftVector &dst, const unsigned *puncture, const size_t plth) { assert(size() + plth == dst.size()); float *srcp = mStart; float *dstp = dst.mStart; const unsigned *pend = puncture + plth; while (dstp < dst.mEnd) { if (puncture < pend) { int n = (*puncture++) - (dstp - dst.mStart); assert(n >= 0); for (int i = 0; i < n; i++) { assert(srcp < mEnd && dstp < dst.mEnd); *dstp++ = *srcp++; } *dstp++ = 0.5; } else { while (srcp < mEnd) { assert(dstp < dst.mEnd); *dstp++ = *srcp++; } } } assert(dstp == dst.mEnd && puncture == pend); } // vim: ts=4 sw=4 gr-gsm-0.41.2/lib/decoding/openbts/BitVector.h000066400000000000000000000275201316153413000210430ustar00rootroot00000000000000/* * Copyright 2008, 2009, 2014 Free Software Foundation, Inc. * Copyright 2014 Range Networks, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * This use of this software may be subject to additional restrictions. * See the LEGAL file in the main directory for details. */ #ifndef BITVECTORS_H #define BITVECTORS_H #include "Vector.h" #include #include class BitVector; class SoftVector; /** Shift-register (LFSR) generator. */ class Generator { private: uint64_t mCoeff; ///< polynomial coefficients. LSB is zero exponent. uint64_t mState; ///< shift register state. LSB is most recent. uint64_t mMask; ///< mask for reading state unsigned mLen; ///< number of bits used in shift register unsigned mLen_1; ///< mLen - 1 public: Generator(uint64_t wCoeff, unsigned wLen) :mCoeff(wCoeff),mState(0), mMask((1ULL<>(mLen_1)) & 0x01; mState = (mState<<1) ^ (inBit & 0x01); if (fb) mState ^= mCoeff; } /** Update the generator state by one cycle. This is in the .h for inlining. */ void encoderShift(unsigned inBit) { const unsigned fb = ((mState>>(mLen_1)) ^ inBit) & 0x01; mState <<= 1; if (fb) mState ^= mCoeff; } }; /** Parity (CRC-type) generator and checker based on a Generator. */ class Parity : public Generator { protected: unsigned mCodewordSize; public: Parity(uint64_t wCoefficients, unsigned wParitySize, unsigned wCodewordSize) :Generator(wCoefficients, wParitySize), mCodewordSize(wCodewordSize) { } /** Compute the parity word and write it into the target segment. */ void writeParityWord(const BitVector& data, BitVector& parityWordTarget, bool invert=true); /** Compute the syndrome of a received sequence. */ uint64_t syndrome(const BitVector& receivedCodeword); }; // (pat) Nov 2013. I rationalized the behavior of BitVector and added assertions to core dump code // that relied on the bad aspects of the original behavior. See comments at VectorBase. class BitVector : public VectorBase { public: /**@name Constructors. */ //@{ /**@name Casts of Vector constructors. */ BitVector(VectorDataType wData, char* wStart, char* wEnd) : VectorBase(wData, wStart, wEnd) {} // The one and only copy-constructor. BitVector(const BitVector&other) : VectorBase() { VECTORDEBUG("BitVector(%p)",(void*)&other); if (other.getData()) { this->clone(other); } else { this->makeAlias(other); } } // (pat) Removed default value for len and added 'explicit'. Please do not remove 'explicit'; // it prevents auto-conversion of int to BitVector in constructors. // Previous code was often ambiguous, especially for L3Frame and descendent constructors, leading to latent bugs. explicit BitVector(size_t len) { this->vInit(len); } BitVector() { this->vInit(0); } /** Build a BitVector by concatenation. */ BitVector(const BitVector& other1, const BitVector& other2) : VectorBase() { assert(this->getData() == 0); this->vConcat(other1,other2); } /** Construct from a string of "0" and "1". */ // (pat) Characters that are not '0' or '1' map to '0'. BitVector(const char* valString); //@} /**@name Casts and overrides of Vector operators. */ //@{ // (pat) Please DO NOT add a const anywhere in this method. Use cloneSegment instead. BitVector segment(size_t start, size_t span) { char* wStart = this->begin() + start; char* wEnd = wStart + span; assert(wEnd<=this->end()); #if BITVECTOR_REFCNTS return BitVector(mData,wStart,wEnd); #else return BitVector(NULL,wStart,wEnd); #endif } // (pat) Historically the BitVector segment method had const and non-const versions with different behavior. // I changed the name of the const version to cloneSegment and replaced all uses throughout OpenBTS. const BitVector cloneSegment(size_t start, size_t span) const { BitVector seg = const_cast(this)->segment(start,span); // (pat) We are depending on the Return Value Optimization not to invoke the copy-constructor on the result, // which would result in its immediate destruction while we are still using it. BitVector result; result.clone(seg); return result; } BitVector alias() const { return const_cast(this)->segment(0,size()); } BitVector head(size_t span) { return segment(0,span); } BitVector tail(size_t start) { return segment(start,size()-start); } // (pat) Please do NOT put the const version of head and tail back in, because historically they were messed up. // Use cloneSegment instead. //const BitVector head(size_t span) const { return segment(0,span); } //const BitVector tail(size_t start) const { return segment(start,size()-start); } //@} void zero() { fill(0); } /**@name FEC operations. */ //@{ /** Calculate the syndrome of the vector with the given Generator. */ uint64_t syndrome(Generator& gen) const; /** Calculate the parity word for the vector with the given Generator. */ uint64_t parity(Generator& gen) const; //@} /** Invert 0<->1. */ void invert(); /**@name Byte-wise operations. */ //@{ /** Reverse an 8-bit vector. */ void reverse8(); /** Reverse groups of 8 within the vector (byte reversal). */ void LSB8MSB(); //@} /**@name Serialization and deserialization. */ //@{ uint64_t peekField(size_t readIndex, unsigned length) const; uint64_t peekFieldReversed(size_t readIndex, unsigned length) const; uint64_t readField(size_t& readIndex, unsigned length) const; uint64_t readFieldReversed(size_t& readIndex, unsigned length) const; void fillField(size_t writeIndex, uint64_t value, unsigned length); void fillFieldReversed(size_t writeIndex, uint64_t value, unsigned length); void writeField(size_t& writeIndex, uint64_t value, unsigned length); void writeFieldReversed(size_t& writeIndex, uint64_t value, unsigned length); void write0(size_t& writeIndex) { writeField(writeIndex,0,1); } void write1(size_t& writeIndex) { writeField(writeIndex,1,1); } //@} /** Sum of bits. */ unsigned sum() const; /** Reorder bits, dest[i] = this[map[i]]. */ void map(const unsigned *map, size_t mapSize, BitVector& dest) const; /** Reorder bits, dest[map[i]] = this[i]. */ void unmap(const unsigned *map, size_t mapSize, BitVector& dest) const; /** Pack into a char array. */ void pack(unsigned char*) const; /* Roman: This is here for debugging */ void pack2(unsigned char*) const; // Same as pack but return a string. std::string packToString() const; /** Unpack from a char array. */ void unpack(const unsigned char*); /** Make a hexdump string. */ void hex(std::ostream&) const; std::string hexstr() const; /** Unpack from a hexdump string. * @returns true on success, false on error. */ bool unhex(const char*); // For this method, 'other' should have been run through the copy-constructor already // (unless it was newly created, ie foo.dup(L2Frame(...)), in which case we are screwed anyway) // so the call to makeAlias is redundant. // This only works if other is already an alias. void dup(BitVector other) { assert(!this->getData()); makeAlias(other); assert(this->mStart == other.mStart); } void dup(BitVector &other) { makeAlias(other); assert(this->mStart == other.mStart); } #if 0 void operator=(const BitVector& other) { printf("BitVector::operator=\n"); assert(0); //this->dup(other); } #endif bool operator==(const BitVector &other) const; /** Copy to dst, not including those indexed in puncture. */ void copyPunctured(BitVector &dst, const unsigned *puncture, const size_t plth); /** Index a single bit. */ // (pat) Cant have too many ways to do this, I guess. bool bit(size_t index) const { // We put this code in .h for fast inlining. const char *dp = this->begin()+index; assert(dpend()); return (*dp) & 0x01; } char& operator[](size_t index) { assert(this->mStart+indexmEnd); return this->mStart[index]; } const char& operator[](size_t index) const { assert(this->mStart+indexmEnd); return this->mStart[index]; } /** Set a bit */ void settfb(size_t index, int value) { char *dp = this->mStart+index; assert(dpmEnd); *dp = value; } typedef char* iterator; typedef const char* const_iterator; }; // (pat) BitVector2 was an intermediate step in fixing BitVector but is no longer needed. #define BitVector2 BitVector std::ostream& operator<<(std::ostream&, const BitVector&); /** The SoftVector class is used to represent a soft-decision signal. Values 0..1 represent probabilities that a bit is "true". */ class SoftVector: public Vector { public: /** Build a SoftVector of a given length. */ SoftVector(size_t wSize=0):Vector(wSize) {} /** Construct a SoftVector from a C string of "0", "1", and "X". */ SoftVector(const char* valString); /** Construct a SoftVector from a BitVector. */ SoftVector(const BitVector& source); /** Wrap a SoftVector around a block of floats. The block will be delete[]ed upon desctuction. */ SoftVector(float *wData, unsigned length) :Vector(wData,length) {} SoftVector(float* wData, float* wStart, float* wEnd) :Vector(wData,wStart,wEnd) { } /** Casting from a Vector. Note that this is NOT pass-by-reference. */ SoftVector(Vector source) :Vector(source) {} /**@name Casts and overrides of Vector operators. */ //@{ SoftVector segment(size_t start, size_t span) { float* wStart = mStart + start; float* wEnd = wStart + span; assert(wEnd<=mEnd); return SoftVector(NULL,wStart,wEnd); } SoftVector alias() { return segment(0,size()); } const SoftVector segment(size_t start, size_t span) const { return (SoftVector)(Vector::segment(start,span)); } SoftVector head(size_t span) { return segment(0,span); } const SoftVector head(size_t span) const { return segment(0,span); } SoftVector tail(size_t start) { return segment(start,size()-start); } const SoftVector tail(size_t start) const { return segment(start,size()-start); } //@} // (pat) How good is the SoftVector in the sense of the bits being solid? // Result of 1 is perfect and 0 means all the bits were 0.5 // If plow is non-NULL, also return the lowest energy bit. float getEnergy(float *low=0) const; float getSNR() const; /** Fill with "unknown" values. */ void unknown() { fill(0.5F); } /** Return a hard bit value from a given index by slicing. */ bool bit(size_t index) const { const float *dp = mStart+index; assert(dp0.5F; } /** Slice the whole signal into bits. */ BitVector sliced() const; /** Copy to dst, adding in 0.5 for those indexed in puncture. */ void copyUnPunctured(SoftVector &dst, const unsigned *puncture, const size_t plth); /** Return a soft bit. */ float softbit(size_t index) const { const float *dp = mStart+index; assert(dp. * * This use of this software may be subject to additional restrictions. * See the LEGAL file in the main directory for details. */ #include "GSM503Tables.h" /* This array encodes GSM 05.03 Table 7. */ const unsigned int GSM::gAMRBitOrderTCH_AFS12_2[244] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 23, 15, 16, 17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28, 38, 141, 39, 142, 40, 143, 41, 144, 42, 145, 43, 146, 44, 147, 45, 148, 46, 149, 47, 97, 150, 200, 48, 98, 151, 201, 49, 99, 152, 202, 86, 136, 189, 239, 87, 137, 190, 240, 88, 138, 191, 241, 91, 194, 92, 195, 93, 196, 94, 197, 95, 198, 29, 30, 31, 32, 33, 34, 35, 50, 100, 153, 203, 89, 139, 192, 242, 51, 101, 154, 204, 55, 105, 158, 208, 90, 140, 193, 243, 59, 109, 162, 212, 63, 113, 166, 216, 67, 117, 170, 220, 36, 37, 54, 53, 52, 58, 57, 56, 62, 61, 60, 66, 65, 64, 70, 69, 68, 104, 103, 102, 108, 107, 106, 112, 111, 110, 116, 115, 114, 120, 119, 118, 157, 156, 155, 161, 160, 159, 165, 164, 163, 169, 168, 167, 173, 172, 171, 207, 206, 205, 211, 210, 209, 215, 214, 213, 219, 218, 217, 223, 222, 221, 73, 72, 71, 76, 75, 74, 79, 78, 77, 82, 81, 80, 85, 84, 83, 123, 122, 121, 126, 125, 124, 129, 128, 127, 132, 131, 130, 135, 134, 133, 176, 175, 174, 179, 178, 177, 182, 181, 180, 185, 184, 183, 188, 187, 186, 226, 225, 224, 229, 228, 227, 232, 231, 230, 235, 234, 233, 238, 237, 236, 96, 199 }; /* This array encodes GSM 05.03 Table 8. */ const unsigned int GSM::gAMRBitOrderTCH_AFS10_2[204] = { 7, 6, 5, 4, 3, 2, 1, 0, 16, 15, 14, 13, 12, 11, 10, 9, 8, 26, 27, 28, 29, 30, 31, 115, 116, 117, 118, 119, 120, 72, 73, 161, 162, 65, 68, 69, 108, 111, 112, 154, 157, 158, 197, 200, 201, 32, 33, 121, 122, 74, 75, 163, 164, 66, 109, 155, 198, 19, 23, 21, 22, 18, 17, 20, 24, 25, 37, 36, 35, 34, 80, 79, 78, 77, 126, 125, 124, 123, 169, 168, 167, 166, 70, 67, 71, 113, 110, 114, 159, 156, 160, 202, 199, 203, 76, 165, 81, 82, 92, 91, 93, 83, 95, 85, 84, 94, 101, 102, 96, 104, 86, 103, 87, 97, 127, 128, 138, 137, 139, 129, 141, 131, 130, 140, 147, 148, 142, 150, 132, 149, 133, 143, 170, 171, 181, 180, 182, 172, 184, 174, 173, 183, 190, 191, 185, 193, 175, 192, 176, 186, 38, 39, 49, 48, 50, 40, 52, 42, 41, 51, 58, 59, 53, 61, 43, 60, 44, 54, 194, 179, 189, 196, 177, 195, 178, 187, 188, 151, 136, 146, 153, 134, 152, 135, 144, 145, 105, 90, 100, 107, 88, 106, 89, 98, 99, 62, 47, 57, 64, 45, 63, 46, 55, 56 }; /* This array encodes GSM 05.03 Table 9. */ const unsigned int GSM::gAMRBitOrderTCH_AFS7_95[159] = { 8, 7, 6, 5, 4, 3, 2, 14, 16, 9, 10, 12, 13, 15, 11, 17, 20, 22, 24, 23, 19, 18, 21, 56, 88, 122, 154, 57, 89, 123, 155, 58, 90, 124, 156, 52, 84, 118, 150, 53, 85, 119, 151, 27, 93, 28, 94, 29, 95, 30, 96, 31, 97, 61, 127, 62, 128, 63, 129, 59, 91, 125, 157, 32, 98, 64, 130, 1, 0, 25, 26, 33, 99, 34, 100, 65, 131, 66, 132, 54, 86, 120, 152, 60, 92, 126, 158, 55, 87, 121, 153, 117, 116, 115, 46, 78, 112, 144, 43, 75, 109, 141, 40, 72, 106, 138, 36, 68, 102, 134, 114, 149, 148, 147, 146, 83, 82, 81, 80, 51, 50, 49, 48, 47, 45, 44, 42, 39, 35, 79, 77, 76, 74, 71, 67, 113, 111, 110, 108, 105, 101, 145, 143, 142, 140, 137, 133, 41, 73, 107, 139, 37, 69, 103, 135, 38, 70, 104, 136 }; /* This array encodes GSM 05.03 Table 10. */ const unsigned int GSM::gAMRBitOrderTCH_AFS7_4[148] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 26, 87, 27, 88, 28, 89, 29, 90, 30, 91, 51, 80, 112, 141, 52, 81, 113, 142, 54, 83, 115, 144, 55, 84, 116, 145, 58, 119, 59, 120, 21, 22, 23, 17, 18, 19, 31, 60, 92, 121, 56, 85, 117, 146, 20, 24, 25, 50, 79, 111, 140, 57, 86, 118, 147, 49, 78, 110, 139, 48, 77, 53, 82, 114, 143, 109, 138, 47, 76, 108, 137, 32, 33, 61, 62, 93, 94, 122, 123, 41, 42, 43, 44, 45, 46, 70, 71, 72, 73, 74, 75, 102, 103, 104, 105, 106, 107, 131, 132, 133, 134, 135, 136, 34, 63, 95, 124, 35, 64, 96, 125, 36, 65, 97, 126, 37, 66, 98, 127, 38, 67, 99, 128, 39, 68, 100, 129, 40, 69, 101, 130 }; /* This array encodes GSM 05.03 Table 11. */ const unsigned int GSM::gAMRBitOrderTCH_AFS6_7[134] = { 0, 1, 4, 3, 5, 6, 13, 7, 2, 8, 9, 11, 15, 12, 14, 10, 28, 82, 29, 83, 27, 81, 26, 80, 30, 84, 16, 55, 109, 56, 110, 31, 85, 57, 111, 48, 73, 102, 127, 32, 86, 51, 76, 105, 130, 52, 77, 106, 131, 58, 112, 33, 87, 19, 23, 53, 78, 107, 132, 21, 22, 18, 17, 20, 24, 25, 50, 75, 104, 129, 47, 72, 101, 126, 54, 79, 108, 133, 46, 71, 100, 125, 128, 103, 74, 49, 45, 70, 99, 124, 42, 67, 96, 121, 39, 64, 93, 118, 38, 63, 92, 117, 35, 60, 89, 114, 34, 59, 88, 113, 44, 69, 98, 123, 43, 68, 97, 122, 41, 66, 95, 120, 40, 65, 94, 119, 37, 62, 91, 116, 36, 61, 90, 115 }; /* This array encodes GSM 05.03 Table 12. */ const unsigned int GSM::gAMRBitOrderTCH_AFS5_9[118] = { 0, 1, 4, 5, 3, 6, 7, 2, 13, 15, 8, 9, 11, 12, 14, 10, 16, 28, 74, 29, 75, 27, 73, 26, 72, 30, 76, 51, 97, 50, 71, 96, 117, 31, 77, 52, 98, 49, 70, 95, 116, 53, 99, 32, 78, 33, 79, 48, 69, 94, 115, 47, 68, 93, 114, 46, 67, 92, 113, 19, 21, 23, 22, 18, 17, 20, 24, 111, 43, 89, 110, 64, 65, 44, 90, 25, 45, 66, 91, 112, 54, 100, 40, 61, 86, 107, 39, 60, 85, 106, 36, 57, 82, 103, 35, 56, 81, 102, 34, 55, 80, 101, 42, 63, 88, 109, 41, 62, 87, 108, 38, 59, 84, 105, 37, 58, 83, 104 }; /* This array encodes GSM 05.03 Table 13. */ const unsigned int GSM::gAMRBitOrderTCH_AFS5_15[103] = { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8, 23, 24, 25, 26, 27, 46, 65, 84, 45, 44, 43, 64, 63, 62, 83, 82, 81, 102, 101, 100, 42, 61, 80, 99, 28, 47, 66, 85, 18, 41, 60, 79, 98, 29, 48, 67, 17, 20, 22, 40, 59, 78, 97, 21, 30, 49, 68, 86, 19, 16, 87, 39, 38, 58, 57, 77, 35, 54, 73, 92, 76, 96, 95, 36, 55, 74, 93, 32, 51, 33, 52, 70, 71, 89, 90, 31, 50, 69, 88, 37, 56, 75, 94, 34, 53, 72, 91 }; /* This array encodes GSM 05.03 Table 14. */ const unsigned int GSM::gAMRBitOrderTCH_AFS4_75[95] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 23, 24, 25, 26, 27, 28, 48, 49, 61, 62, 82, 83, 47, 46, 45, 44, 81, 80, 79, 78, 17, 18, 20, 22, 77, 76, 75, 74, 29, 30, 43, 42, 41, 40, 38, 39, 16, 19, 21, 50, 51, 59, 60, 63, 64, 72, 73, 84, 85, 93, 94, 32, 33, 35, 36, 53, 54, 56, 57, 66, 67, 69, 70, 87, 88, 90, 91, 34, 55, 68, 89, 37, 58, 71, 92, 31, 52, 65, 86 }; /* GSM 05.03 3.9.4.4 */ const unsigned int GSM::gAMRPuncturedTCH_AFS12_2[60] = { 321, 325, 329, 333, 337, 341, 345, 349, 353, 357, 361, 363, 365, 369, 373, 377, 379, 381, 385, 389, 393, 395, 397, 401, 405, 409, 411, 413, 417, 421, 425, 427, 429, 433, 437, 441, 443, 445, 449, 453, 457, 459, 461, 465, 469, 473, 475, 477, 481, 485, 489, 491, 493, 495, 497, 499, 501, 503, 505, 507 }; /* GSM 05.03 3.9.4.4 */ const unsigned int GSM::gAMRPuncturedTCH_AFS10_2[194] = { 1, 4, 7, 10, 16, 19, 22, 28, 31, 34, 40, 43, 46, 52, 55, 58, 64, 67, 70, 76, 79, 82, 88, 91, 94, 100, 103, 106, 112, 115, 118, 124, 127, 130, 136, 139, 142, 148, 151, 154, 160, 163, 166, 172, 175, 178, 184, 187, 190, 196, 199, 202, 208, 211, 214, 220, 223, 226, 232, 235, 238, 244, 247, 250, 256, 259, 262, 268, 271, 274, 280, 283, 286, 292, 295, 298, 304, 307, 310, 316, 319, 322, 325, 328, 331, 334, 337, 340, 343, 346, 349, 352, 355, 358, 361, 364, 367, 370, 373, 376, 379, 382, 385, 388, 391, 394, 397, 400, 403, 406, 409, 412, 415, 418, 421, 424, 427, 430, 433, 436, 439, 442, 445, 448, 451, 454, 457, 460, 463, 466, 469, 472, 475, 478, 481, 484, 487, 490, 493, 496, 499, 502, 505, 508, 511, 514, 517, 520, 523, 526, 529, 532, 535, 538, 541, 544, 547, 550, 553, 556, 559, 562, 565, 568, 571, 574, 577, 580, 583, 586, 589, 592, 595, 598, 601, 604, 607, 609, 610, 613, 616, 619, 621, 622, 625, 627, 628, 631, 633, 634, 636, 637, 639, 640 }; /* GSM 05.03 3.9.4.4 */ const unsigned int GSM::gAMRPuncturedTCH_AFS7_95[65] = { 1, 2, 4, 5, 8, 22, 70, 118, 166, 214, 262, 310, 317, 319, 325, 332, 334, 341, 343, 349, 356, 358, 365, 367, 373, 380, 382, 385, 389, 391, 397, 404, 406, 409, 413, 415, 421, 428, 430, 433, 437, 439, 445, 452, 454, 457, 461, 463, 469, 476, 478, 481, 485, 487, 490, 493, 500, 502, 503, 505, 506, 508, 509, 511, 512 }; /* GSM 05.03 3.9.4.4 */ const unsigned int GSM::gAMRPuncturedTCH_AFS7_4[26] = { 0, 355, 361, 367, 373, 379, 385, 391, 397, 403, 409, 415, 421, 427, 433, 439, 445, 451, 457, 460, 463, 466, 468, 469, 471, 472 }; /* GSM 05.03 3.9.4.4 */ const unsigned int GSM::gAMRPuncturedTCH_AFS6_7[128] = { 1, 3, 7, 11, 15, 27, 39, 55, 67, 79, 95, 107, 119, 135, 147, 159, 175, 187, 199, 215, 227, 239, 255, 267, 279, 287, 291, 295, 299, 303, 307, 311, 315, 319, 323, 327, 331, 335, 339, 343, 347, 351, 355, 359, 363, 367, 369, 371, 375, 377, 379, 383, 385, 387, 391, 393, 395, 399, 401, 403, 407, 409, 411, 415, 417, 419, 423, 425, 427, 431, 433, 435, 439, 441, 443, 447, 449, 451, 455, 457, 459, 463, 465, 467, 471, 473, 475, 479, 481, 483, 487, 489, 491, 495, 497, 499, 503, 505, 507, 511, 513, 515, 519, 521, 523, 527, 529, 531, 535, 537, 539, 543, 545, 547, 549, 551, 553, 555, 557, 559, 561, 563, 565, 567, 569, 571, 573, 575 }; /* GSM 05.03 3.9.4.4 */ const unsigned int GSM::gAMRPuncturedTCH_AFS5_9[72] = { 0, 1, 3, 5, 7, 11, 15, 31, 47, 63, 79, 95, 111, 127, 143, 159, 175, 191, 207, 223, 239, 255, 271, 287, 303, 319, 327, 331, 335, 343, 347, 351, 359, 363, 367, 375, 379, 383, 391, 395, 399, 407, 411, 415, 423, 427, 431, 439, 443, 447, 455, 459, 463, 467, 471, 475, 479, 483, 487, 491, 495, 499, 503, 507, 509, 511, 512, 513, 515, 516, 517, 519 }; /* GSM 05.03 3.9.4.4 */ const unsigned int GSM::gAMRPuncturedTCH_AFS5_15[117] = { 0, 4, 5, 9, 10, 14, 15, 20, 25, 30, 35, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300, 310, 315, 320, 325, 330, 334, 335, 340, 344, 345, 350, 354, 355, 360, 364, 365, 370, 374, 375, 380, 384, 385, 390, 394, 395, 400, 404, 405, 410, 414, 415, 420, 424, 425, 430, 434, 435, 440, 444, 445, 450, 454, 455, 460, 464, 465, 470, 474, 475, 480, 484, 485, 490, 494, 495, 500, 504, 505, 510, 514, 515, 520, 524, 525, 529, 530, 534, 535, 539, 540, 544, 545, 549, 550, 554, 555, 559, 560, 564 }; /* GSM 05.03 3.9.4.4 */ const unsigned int GSM::gAMRPuncturedTCH_AFS4_75[87] = { 0, 1, 2, 4, 5, 7, 9, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105, 115, 125, 135, 145, 155, 165, 175, 185, 195, 205, 215, 225, 235, 245, 255, 265, 275, 285, 295, 305, 315, 325, 335, 345, 355, 365, 375, 385, 395, 400, 405, 410, 415, 420, 425, 430, 435, 440, 445, 450, 455, 459, 460, 465, 470, 475, 479, 480, 485, 490, 495, 499, 500, 505, 509, 510, 515, 517, 519, 520, 522, 524, 525, 526, 527, 529, 530, 531, 532, 534 }; /* GSM 05.03 Tables 7-14 */ const unsigned int *GSM::gAMRBitOrder[8] = { GSM::gAMRBitOrderTCH_AFS12_2, GSM::gAMRBitOrderTCH_AFS10_2, GSM::gAMRBitOrderTCH_AFS7_95, GSM::gAMRBitOrderTCH_AFS7_4, GSM::gAMRBitOrderTCH_AFS6_7, GSM::gAMRBitOrderTCH_AFS5_9, GSM::gAMRBitOrderTCH_AFS5_15, GSM::gAMRBitOrderTCH_AFS4_75 }; /* GSM 05.03 3.9.4.2 */ const unsigned int GSM::gAMRKd[9] = {244, 204, 159, 148, 134, 118, 103, 95, 260}; // The last entry is for TCH_FS (GSM mode) /* GSM 05.03 3.9.4.2 */ const unsigned int GSM::gAMRClass1ALth[8] = {81, 65, 75, 61, 55, 55, 49, 39}; /* GSM 05.03 3.9.4.4 */ const unsigned int GSM::gAMRTCHUCLth[8] = {508, 642, 513, 474, 576, 520, 565, 535}; /* GSM 05.03 3.9.4.2 */ const unsigned int GSM::gAMRPunctureLth[8] = {60, 194, 65, 26, 128, 72, 117, 87}; /* GSM 05.03 3.9.4.4 */ const unsigned int *GSM::gAMRPuncture[8] = { GSM::gAMRPuncturedTCH_AFS12_2, GSM::gAMRPuncturedTCH_AFS10_2, GSM::gAMRPuncturedTCH_AFS7_95, GSM::gAMRPuncturedTCH_AFS7_4, GSM::gAMRPuncturedTCH_AFS6_7, GSM::gAMRPuncturedTCH_AFS5_9, GSM::gAMRPuncturedTCH_AFS5_15, GSM::gAMRPuncturedTCH_AFS4_75 }; gr-gsm-0.41.2/lib/decoding/openbts/GSM503Tables.h000066400000000000000000000051201316153413000211430ustar00rootroot00000000000000/* * Copyright 2012, 2014 Range Networks, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * This use of this software may be subject to additional restrictions. * See the LEGAL file in the main directory for details. */ #ifndef GSM503TABLES_H #define GSM503TABLES_H namespace GSM { // don't change the positions in this enum // (pat) The first 8 values are used as indicies into numerous tables. // (pat) Encoder/decoder mode includes 8 modes for AMR + TCH_FS makes 9. // TODO: Add AFS_SID type. And why is it not type 8? enum AMRMode {TCH_AFS12_2, TCH_AFS10_2, TCH_AFS7_95, TCH_AFS7_4, TCH_AFS6_7, TCH_AFS5_9, TCH_AFS5_15, TCH_AFS4_75, TCH_FS}; /** Tables #7-14 from GSM 05.03 */ extern const unsigned int gAMRBitOrderTCH_AFS12_2[244]; extern const unsigned int gAMRBitOrderTCH_AFS10_2[204]; extern const unsigned int gAMRBitOrderTCH_AFS7_95[159]; extern const unsigned int gAMRBitOrderTCH_AFS7_4[148]; extern const unsigned int gAMRBitOrderTCH_AFS6_7[134]; extern const unsigned int gAMRBitOrderTCH_AFS5_9[118]; extern const unsigned int gAMRBitOrderTCH_AFS5_15[103]; extern const unsigned int gAMRBitOrderTCH_AFS4_75[95]; /** GSM 05.03 3.9.4.4 */ extern const unsigned int gAMRPuncturedTCH_AFS12_2[60]; extern const unsigned int gAMRPuncturedTCH_AFS10_2[194]; extern const unsigned int gAMRPuncturedTCH_AFS7_95[65]; extern const unsigned int gAMRPuncturedTCH_AFS7_4[26]; extern const unsigned int gAMRPuncturedTCH_AFS6_7[128]; extern const unsigned int gAMRPuncturedTCH_AFS5_9[72]; extern const unsigned int gAMRPuncturedTCH_AFS5_15[117]; extern const unsigned int gAMRPuncturedTCH_AFS4_75[87]; /* GSM 05.03 Tables 7-14 */ extern const unsigned *gAMRBitOrder[8]; /* GSM 05.03 3.9.4.2 */ extern const unsigned gAMRKd[9]; /* GSM 05.03 3.9.4.2 */ extern const unsigned gAMRClass1ALth[8]; /* GSM 05.03 3.9.4.4 */ extern const unsigned gAMRTCHUCLth[8]; /* GSM 05.03 3.9.4.2 */ extern const unsigned gAMRPunctureLth[8]; /* GSM 05.03 3.9.4.4 */ extern const unsigned *gAMRPuncture[8]; } #endif gr-gsm-0.41.2/lib/decoding/openbts/GSM610Tables.cpp000066400000000000000000000404341316153413000215040ustar00rootroot00000000000000/* * Copyright 2008 Free Software Foundation, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * This use of this software may be subject to additional restrictions. * See the LEGAL file in the main directory for details. */ #include "GSM610Tables.h" /* RFC 3551 RTP A/V Profile July 2003 Octet Bit 0 Bit 1 Bit 2 Bit 3 Bit 4 Bit 5 Bit 6 Bit 7 _____________________________________________________________________ 0 1 1 0 1 LARc0.0 LARc0.1 LARc0.2 LARc0.3 1 LARc0.4 LARc0.5 LARc1.0 LARc1.1 LARc1.2 LARc1.3 LARc1.4 LARc1.5 2 LARc2.0 LARc2.1 LARc2.2 LARc2.3 LARc2.4 LARc3.0 LARc3.1 LARc3.2 3 LARc3.3 LARc3.4 LARc4.0 LARc4.1 LARc4.2 LARc4.3 LARc5.0 LARc5.1 4 LARc5.2 LARc5.3 LARc6.0 LARc6.1 LARc6.2 LARc7.0 LARc7.1 LARc7.2 5 Nc0.0 Nc0.1 Nc0.2 Nc0.3 Nc0.4 Nc0.5 Nc0.6 bc0.0 6 bc0.1 Mc0.0 Mc0.1 xmaxc00 xmaxc01 xmaxc02 xmaxc03 xmaxc04 7 xmaxc05 xmc0.0 xmc0.1 xmc0.2 xmc1.0 xmc1.1 xmc1.2 xmc2.0 8 xmc2.1 xmc2.2 xmc3.0 xmc3.1 xmc3.2 xmc4.0 xmc4.1 xmc4.2 9 xmc5.0 xmc5.1 xmc5.2 xmc6.0 xmc6.1 xmc6.2 xmc7.0 xmc7.1 10 xmc7.2 xmc8.0 xmc8.1 xmc8.2 xmc9.0 xmc9.1 xmc9.2 xmc10.0 11 xmc10.1 xmc10.2 xmc11.0 xmc11.1 xmc11.2 xmc12.0 xmc12.1 xcm12.2 12 Nc1.0 Nc1.1 Nc1.2 Nc1.3 Nc1.4 Nc1.5 Nc1.6 bc1.0 13 bc1.1 Mc1.0 Mc1.1 xmaxc10 xmaxc11 xmaxc12 xmaxc13 xmaxc14 14 xmax15 xmc13.0 xmc13.1 xmc13.2 xmc14.0 xmc14.1 xmc14.2 xmc15.0 15 xmc15.1 xmc15.2 xmc16.0 xmc16.1 xmc16.2 xmc17.0 xmc17.1 xmc17.2 16 xmc18.0 xmc18.1 xmc18.2 xmc19.0 xmc19.1 xmc19.2 xmc20.0 xmc20.1 17 xmc20.2 xmc21.0 xmc21.1 xmc21.2 xmc22.0 xmc22.1 xmc22.2 xmc23.0 18 xmc23.1 xmc23.2 xmc24.0 xmc24.1 xmc24.2 xmc25.0 xmc25.1 xmc25.2 19 Nc2.0 Nc2.1 Nc2.2 Nc2.3 Nc2.4 Nc2.5 Nc2.6 bc2.0 20 bc2.1 Mc2.0 Mc2.1 xmaxc20 xmaxc21 xmaxc22 xmaxc23 xmaxc24 21 xmaxc25 xmc26.0 xmc26.1 xmc26.2 xmc27.0 xmc27.1 xmc27.2 xmc28.0 22 xmc28.1 xmc28.2 xmc29.0 xmc29.1 xmc29.2 xmc30.0 xmc30.1 xmc30.2 23 xmc31.0 xmc31.1 xmc31.2 xmc32.0 xmc32.1 xmc32.2 xmc33.0 xmc33.1 24 xmc33.2 xmc34.0 xmc34.1 xmc34.2 xmc35.0 xmc35.1 xmc35.2 xmc36.0 25 Xmc36.1 xmc36.2 xmc37.0 xmc37.1 xmc37.2 xmc38.0 xmc38.1 xmc38.2 26 Nc3.0 Nc3.1 Nc3.2 Nc3.3 Nc3.4 Nc3.5 Nc3.6 bc3.0 27 bc3.1 Mc3.0 Mc3.1 xmaxc30 xmaxc31 xmaxc32 xmaxc33 xmaxc34 28 xmaxc35 xmc39.0 xmc39.1 xmc39.2 xmc40.0 xmc40.1 xmc40.2 xmc41.0 29 xmc41.1 xmc41.2 xmc42.0 xmc42.1 xmc42.2 xmc43.0 xmc43.1 xmc43.2 30 xmc44.0 xmc44.1 xmc44.2 xmc45.0 xmc45.1 xmc45.2 xmc46.0 xmc46.1 31 xmc46.2 xmc47.0 xmc47.1 xmc47.2 xmc48.0 xmc48.1 xmc48.2 xmc49.0 32 xmc49.1 xmc49.2 xmc50.0 xmc50.1 xmc50.2 xmc51.0 xmc51.1 xmc51.2 Table 3: GSM payload format */ /* This file encodes a mapping between GSM 05.03 Table 2 and RFC-3551 Table 3. */ /* Naming convention: xxx_p position (bit index) xxx_l length (bit field length) LAR log area ratio N LTP lag b LTP gain M grid Xmax block amplitude x RPE pulses */ /**@name Lengths of GSM 06.10 fields */ //@{ const unsigned int LAR1_l=6; ///< log area ratio const unsigned int LAR2_l=6; ///< log area ratio const unsigned int LAR3_l=5; ///< log area ratio const unsigned int LAR4_l=5; ///< log area ratio const unsigned int LAR5_l=4; ///< log area ratio const unsigned int LAR6_l=4; ///< log area ratio const unsigned int LAR7_l=3; ///< log area ratio const unsigned int LAR8_l=3; ///< log area ratio const unsigned int N_l=7; ///< LTP lag const unsigned int b_l=2; ///< LTP gain const unsigned int M_l=2; ///< grid position const unsigned int Xmax_l=6; ///< block amplitude const unsigned int x_l=3; ///< RPE pulses //@} /*@name Indecies of GSM 06.10 fields as they appear in RFC-3551 Table 3. */ //@{ /**@name Log area ratios, apply to whole frame. */ //@{ const unsigned int LAR1_p = 0; const unsigned int LAR2_p = LAR1_p + LAR1_l; const unsigned int LAR3_p = LAR2_p + LAR2_l; const unsigned int LAR4_p = LAR3_p + LAR3_l; const unsigned int LAR5_p = LAR4_p + LAR4_l; const unsigned int LAR6_p = LAR5_p + LAR5_l; const unsigned int LAR7_p = LAR6_p + LAR6_l; const unsigned int LAR8_p = LAR7_p + LAR7_l; //@} /**@name Subframe 1 */ //@{ const unsigned int N1_p = LAR8_p + LAR8_l; const unsigned int b1_p = N1_p + N_l; const unsigned int M1_p = b1_p + b_l; const unsigned int Xmax1_p = M1_p + M_l; const unsigned int x1_0_p = Xmax1_p + Xmax_l; const unsigned int x1_1_p = x1_0_p + x_l; const unsigned int x1_2_p = x1_1_p + x_l; const unsigned int x1_3_p = x1_2_p + x_l; const unsigned int x1_4_p = x1_3_p + x_l; const unsigned int x1_5_p = x1_4_p + x_l; const unsigned int x1_6_p = x1_5_p + x_l; const unsigned int x1_7_p = x1_6_p + x_l; const unsigned int x1_8_p = x1_7_p + x_l; const unsigned int x1_9_p = x1_8_p + x_l; const unsigned int x1_10_p = x1_9_p + x_l; const unsigned int x1_11_p = x1_10_p + x_l; const unsigned int x1_12_p = x1_11_p + x_l; //@} /**@name Subframe 2 */ //@{ const unsigned int N2_p = x1_12_p + x_l; const unsigned int b2_p = N2_p + N_l; const unsigned int M2_p = b2_p + b_l; const unsigned int Xmax2_p = M2_p + M_l; const unsigned int x2_0_p = Xmax2_p + Xmax_l; const unsigned int x2_1_p = x2_0_p + x_l; const unsigned int x2_2_p = x2_1_p + x_l; const unsigned int x2_3_p = x2_2_p + x_l; const unsigned int x2_4_p = x2_3_p + x_l; const unsigned int x2_5_p = x2_4_p + x_l; const unsigned int x2_6_p = x2_5_p + x_l; const unsigned int x2_7_p = x2_6_p + x_l; const unsigned int x2_8_p = x2_7_p + x_l; const unsigned int x2_9_p = x2_8_p + x_l; const unsigned int x2_10_p = x2_9_p + x_l; const unsigned int x2_11_p = x2_10_p + x_l; const unsigned int x2_12_p = x2_11_p + x_l; //@} /**@mame Subframe 3 */ //@{ const unsigned int N3_p = x2_12_p + x_l; const unsigned int b3_p = N3_p + N_l; const unsigned int M3_p = b3_p + b_l; const unsigned int Xmax3_p = M3_p + M_l; const unsigned int x3_0_p = Xmax3_p + Xmax_l; const unsigned int x3_1_p = x3_0_p + x_l; const unsigned int x3_2_p = x3_1_p + x_l; const unsigned int x3_3_p = x3_2_p + x_l; const unsigned int x3_4_p = x3_3_p + x_l; const unsigned int x3_5_p = x3_4_p + x_l; const unsigned int x3_6_p = x3_5_p + x_l; const unsigned int x3_7_p = x3_6_p + x_l; const unsigned int x3_8_p = x3_7_p + x_l; const unsigned int x3_9_p = x3_8_p + x_l; const unsigned int x3_10_p = x3_9_p + x_l; const unsigned int x3_11_p = x3_10_p + x_l; const unsigned int x3_12_p = x3_11_p + x_l; //@} /**@name Subframe 4 */ //@{ const unsigned int N4_p = x3_12_p + x_l; const unsigned int b4_p = N4_p + N_l; const unsigned int M4_p = b4_p + b_l; const unsigned int Xmax4_p = M4_p + M_l; const unsigned int x4_0_p = Xmax4_p + Xmax_l; const unsigned int x4_1_p = x4_0_p + x_l; const unsigned int x4_2_p = x4_1_p + x_l; const unsigned int x4_3_p = x4_2_p + x_l; const unsigned int x4_4_p = x4_3_p + x_l; const unsigned int x4_5_p = x4_4_p + x_l; const unsigned int x4_6_p = x4_5_p + x_l; const unsigned int x4_7_p = x4_6_p + x_l; const unsigned int x4_8_p = x4_7_p + x_l; const unsigned int x4_9_p = x4_8_p + x_l; const unsigned int x4_10_p = x4_9_p + x_l; const unsigned int x4_11_p = x4_10_p + x_l; const unsigned int x4_12_p = x4_11_p + x_l; //@} //@} /* This array encodes GSM 05.03 Table 2. It's also GSM 06.10 Table A2.1a. This is the order of bits as they appear in the d[] bits of the GSM TCH/F. RTP[4+g610BitOrder[i]] <=> GSM[i] */ unsigned int GSM::g610BitOrder[260] = { /**@name importance class 1 */ //@{ /** LAR1:5 */ LAR1_p+LAR1_l-1-5, /* bit 0 */ /** Xmax1:5 */ Xmax1_p+Xmax_l-1-5, /** Xmax2:5 */ Xmax2_p+Xmax_l-1-5, /** Xmax3:5 */ Xmax3_p+Xmax_l-1-5, /** Xmax4:5 */ Xmax4_p+Xmax_l-1-5, //@} /**@name importance class 2 */ //@{ /** LAR1:4 */ LAR1_p+LAR1_l-1-4, /** LAR2:5 */ LAR2_p+LAR2_l-1-5, /** LAR3:4 */ LAR3_p+LAR3_l-1-4, //@} /**@name importance class 3 */ //@{ /** LAR1:3 */ LAR1_p+LAR1_l-1-3, /** LAR2:4 */ LAR2_p+LAR2_l-1-4, /** LAR3:3 */ LAR3_p+LAR3_l-1-3, /* bit 10 */ /** LAR4:4 */ LAR4_p+LAR4_l-1-4, /** N1:6 */ N1_p+N_l-1-6, /** N2:6 */ N2_p+N_l-1-6, /** N3:6 */ N3_p+N_l-1-6, /** N4:6 */ N4_p+N_l-1-6, /** Xmax1:4 */ Xmax1_p+Xmax_l-1-4, /** Xmax2:4 */ Xmax2_p+Xmax_l-1-4, /** Xmax3:4 */ Xmax3_p+Xmax_l-1-4, /** Xmax4:4 */ Xmax4_p+Xmax_l-1-4, /** LAR2:3 */ LAR2_p+LAR2_l-1-3, /* bit 20 */ /** LAR5:3 */ LAR5_p+LAR5_l-1-3, /** LAR6:3 */ LAR6_p+LAR6_l-1-3, /** N1:5 */ N1_p+N_l-1-5, /** N2:5 */ N2_p+N_l-1-5, /** N3:5 */ N3_p+N_l-1-5, /** N4:5 */ N4_p+N_l-1-5, /** N1:4 */ N1_p+N_l-1-4, /** N2:4 */ N2_p+N_l-1-4, /** N3:4 */ N3_p+N_l-1-4, /** N4:4 */ N4_p+N_l-1-4, /* bit 30 */ /** N1:3 */ N1_p+N_l-1-3, /** N2:3 */ N2_p+N_l-1-3, /** N3:3 */ N3_p+N_l-1-3, /** N4:3 */ N4_p+N_l-1-3, /** N1:2 */ N1_p+N_l-1-2, /** N2:2 */ N2_p+N_l-1-2, /** N3:2 */ N3_p+N_l-1-2, /** N4:2 */ N4_p+N_l-1-2, //@} /**@name importance class 4 */ //@{ /** Xmax1:3 */ Xmax1_p+Xmax_l-1-3, /** Xmax2:3 */ Xmax2_p+Xmax_l-1-3, /* bit 40 */ /** Xmax3:3 */ Xmax3_p+Xmax_l-1-3, /** Xmax4:3 */ Xmax4_p+Xmax_l-1-3, /** LAR1:2 */ LAR1_p+LAR1_l-1-2, /** LAR4:3 */ LAR4_p+LAR4_l-1-3, /** LAR7:2 */ LAR7_p+LAR7_l-1-2, /** N1:1 */ N1_p+N_l-1-1, /** N2:1 */ N2_p+N_l-1-1, /** N3:1 */ N3_p+N_l-1-1, /** N4:1 */ N4_p+N_l-1-1, /** LAR5:2 */ LAR5_p+LAR5_l-1-2, /* bit 50 */ /** LAR6:2 */ LAR6_p+LAR6_l-1-2, /** b1:1 */ b1_p+b_l-1-1, /** b2:1 */ b2_p+b_l-1-1, /** b3:1 */ b3_p+b_l-1-1, /** b4:1 */ b4_p+b_l-1-1, /** N1:0 */ N1_p+N_l-1-0, /** N2:0 */ N2_p+N_l-1-0, /** N3:0 */ N3_p+N_l-1-0, /** N4:0 */ N4_p+N_l-1-0, /** M1:1 */ M1_p+M_l-1-1, /* bit 60 */ /** M2:1 */ M2_p+M_l-1-1, /** M3:1 */ M3_p+M_l-1-1, /** M4:1 */ M4_p+M_l-1-1, //@} /**@name importance class 5 */ //@{ /** LAR1:1 */ LAR1_p+LAR1_l-1-1, /** LAR2:2 */ LAR2_p+LAR2_l-1-2, /** LAR3:2 */ LAR3_p+LAR3_l-1-2, /** LAR8:2 */ LAR8_p+LAR8_l-1-2, /** LAR4:2 */ LAR4_p+LAR4_l-1-2, /** LAR5:1 */ LAR5_p+LAR5_l-1-1, /** LAR7:1 */ LAR7_p+LAR7_l-1-1, /* bit 70 */ /** b1:0 */ b1_p+b_l-1-0, /** b2:0 */ b2_p+b_l-1-0, /** b3:0 */ b3_p+b_l-1-0, /** b4:0 */ b4_p+b_l-1-0, /** Xmax1:2 */ Xmax1_p+Xmax_l-1-2, /** Xmax2:2 */ Xmax2_p+Xmax_l-1-2, /** Xmax3:2 */ Xmax3_p+Xmax_l-1-2, /** Xmax4:2 */ Xmax4_p+Xmax_l-1-2, /** x1_0:2 */ x1_0_p+x_l-1-2, /** x1_1:2 */ x1_1_p+x_l-1-2, /* bit 80 */ /** x1_2:2 */ x1_2_p+x_l-1-2, /** x1_3:2 */ x1_3_p+x_l-1-2, /** x1_4:2 */ x1_4_p+x_l-1-2, /** x1_5:2 */ x1_5_p+x_l-1-2, /** x1_6:2 */ x1_6_p+x_l-1-2, /** x1_7:2 */ x1_7_p+x_l-1-2, /** x1_8:2 */ x1_8_p+x_l-1-2, /** x1_9:2 */ x1_9_p+x_l-1-2, /** x1_10:2 */ x1_10_p+x_l-1-2, /** x1_11:2 */ x1_11_p+x_l-1-2, /* bit 90 */ /** x1_12:2 */ x1_12_p+x_l-1-2, /** x2_0:2 */ x2_0_p+x_l-1-2, /** x2_1:2 */ x2_1_p+x_l-1-2, /** x2_2:2 */ x2_2_p+x_l-1-2, /** x2_3:2 */ x2_3_p+x_l-1-2, /** x2_4:2 */ x2_4_p+x_l-1-2, /** x2_5:2 */ x2_5_p+x_l-1-2, /** x2_6:2 */ x2_6_p+x_l-1-2, /** x2_7:2 */ x2_7_p+x_l-1-2, /** x2_8:2 */ x2_8_p+x_l-1-2, /* bit 100 */ /** x2_9:2 */ x2_9_p+x_l-1-2, /** x2_10:2 */ x2_10_p+x_l-1-2, /** x2_11:2 */ x2_11_p+x_l-1-2, /** x2_12:2 */ x2_12_p+x_l-1-2, /** x3_0:2 */ x3_0_p+x_l-1-2, /** x3_1:2 */ x3_1_p+x_l-1-2, /** x3_2:2 */ x3_2_p+x_l-1-2, /** x3_3:2 */ x3_3_p+x_l-1-2, /** x3_4:2 */ x3_4_p+x_l-1-2, /** x3_5:2 */ x3_5_p+x_l-1-2, /* bit 110 */ /** x3_6:2 */ x3_6_p+x_l-1-2, /** x3_7:2 */ x3_7_p+x_l-1-2, /** x3_8:2 */ x3_8_p+x_l-1-2, /** x3_9:2 */ x3_9_p+x_l-1-2, /** x3_10:2 */ x3_10_p+x_l-1-2, /** x3_11:2 */ x3_11_p+x_l-1-2, /** x3_12:2 */ x3_12_p+x_l-1-2, /** x4_0:2 */ x4_0_p+x_l-1-2, /** x4_1:2 */ x4_1_p+x_l-1-2, /** x4_2:2 */ x4_2_p+x_l-1-2, /* bit 120 */ /** x4_3:2 */ x4_3_p+x_l-1-2, /** x4_4:2 */ x4_4_p+x_l-1-2, /** x4_5:2 */ x4_5_p+x_l-1-2, /** x4_6:2 */ x4_6_p+x_l-1-2, /** x4_7:2 */ x4_7_p+x_l-1-2, /** x4_8:2 */ x4_8_p+x_l-1-2, /** x4_9:2 */ x4_9_p+x_l-1-2, /** x4_10:2 */ x4_10_p+x_l-1-2, /** x4_11:2 */ x4_11_p+x_l-1-2, /** x4_12:2 */ x4_12_p+x_l-1-2, /* bit 130 */ /** M1:0 */ M1_p+M_l-1-0, /** M2:0 */ M2_p+M_l-1-0, /** M3:0 */ M3_p+M_l-1-0, /** M4:0 */ M4_p+M_l-1-0, /** Xmax1:1 */ Xmax1_p+Xmax_l-1-1, /** Xmax2:1 */ Xmax2_p+Xmax_l-1-1, /** Xmax3:1 */ Xmax3_p+Xmax_l-1-1, /** Xmax4:1 */ Xmax4_p+Xmax_l-1-1, /** x1_0:1 */ x1_0_p+x_l-1-1, /** x1_1:1 */ x1_1_p+x_l-1-1, /* bit 140 */ /** x1_2:1 */ x1_2_p+x_l-1-1, /** x1_3:1 */ x1_3_p+x_l-1-1, /** x1_4:1 */ x1_4_p+x_l-1-1, /** x1_5:1 */ x1_5_p+x_l-1-1, /** x1_6:1 */ x1_6_p+x_l-1-1, /** x1_7:1 */ x1_7_p+x_l-1-1, /** x1_8:1 */ x1_8_p+x_l-1-1, /** x1_9:1 */ x1_9_p+x_l-1-1, /** x1_10:1 */ x1_10_p+x_l-1-1, /** x1_11:1 */ x1_11_p+x_l-1-1, /* bit 150 */ /** x1_12:1 */ x1_12_p+x_l-1-1, /** x2_0:1 */ x2_0_p+x_l-1-1, /** x2_1:1 */ x2_1_p+x_l-1-1, /** x2_2:1 */ x2_2_p+x_l-1-1, /** x2_3:1 */ x2_3_p+x_l-1-1, /** x2_4:1 */ x2_4_p+x_l-1-1, /** x2_5:1 */ x2_5_p+x_l-1-1, /** x2_6:1 */ x2_6_p+x_l-1-1, /** x2_7:1 */ x2_7_p+x_l-1-1, /** x2_8:1 */ x2_8_p+x_l-1-1, /* bit 160 */ /** x2_9:1 */ x2_9_p+x_l-1-1, /** x2_10:1 */ x2_10_p+x_l-1-1, /** x2_11:1 */ x2_11_p+x_l-1-1, /** x2_12:1 */ x2_12_p+x_l-1-1, /** x3_0:1 */ x3_0_p+x_l-1-1, /** x3_1:1 */ x3_1_p+x_l-1-1, /** x3_2:1 */ x3_2_p+x_l-1-1, /** x3_3:1 */ x3_3_p+x_l-1-1, /** x3_4:1 */ x3_4_p+x_l-1-1, /** x3_5:1 */ x3_5_p+x_l-1-1, /* bit 170 */ /** x3_6:1 */ x3_6_p+x_l-1-1, /** x3_7:1 */ x3_7_p+x_l-1-1, /** x3_8:1 */ x3_8_p+x_l-1-1, /** x3_9:1 */ x3_9_p+x_l-1-1, /** x3_10:1 */ x3_10_p+x_l-1-1, /** x3_11:1 */ x3_11_p+x_l-1-1, /** x3_12:1 */ x3_12_p+x_l-1-1, /** x4_0:1 */ x4_0_p+x_l-1-1, /** x4_1:1 */ x4_1_p+x_l-1-1, /** x4_2:1 */ x4_2_p+x_l-1-1, /* bit 180 */ /** x4_3:1 */ x4_3_p+x_l-1-1, //@} /**@name importance class 6 */ //@{ /** x4_4:1 */ x4_4_p+x_l-1-1, /** x4_5:1 */ x4_5_p+x_l-1-1, /** x4_6:1 */ x4_6_p+x_l-1-1, /** x4_7:1 */ x4_7_p+x_l-1-1, /** x4_8:1 */ x4_8_p+x_l-1-1, /** x4_9:1 */ x4_9_p+x_l-1-1, /** x4_10:1 */ x4_10_p+x_l-1-1, /** x4_11:1 */ x4_11_p+x_l-1-1, /** x4_12:1 */ x4_12_p+x_l-1-1, /* bit 190 */ /** LAR1:0 */ LAR1_p+LAR1_l-1-0, /** LAR2:1 */ LAR2_p+LAR2_l-1-1, /** LAR3:1 */ LAR3_p+LAR3_l-1-1, /** LAR6:1 */ LAR6_p+LAR6_l-1-1, /** LAR7:0 */ LAR7_p+LAR7_l-1-0, /** LAR8:1 */ LAR8_p+LAR8_l-1-1, /** LAR8:0 */ LAR8_p+LAR8_l-1-0, /** LAR3:0 */ LAR3_p+LAR3_l-1-0, /** LAR4:1 */ LAR4_p+LAR4_l-1-1, /** LAR4:0 */ LAR4_p+LAR4_l-1-0, /** LAR5:0 */ LAR5_p+LAR5_l-1-0, /** Xmax1:0 */ Xmax1_p+Xmax_l-1-0, /** Xmax2:0 */ Xmax2_p+Xmax_l-1-0, /** Xmax3:0 */ Xmax3_p+Xmax_l-1-0, /** Xmax4:0 */ Xmax4_p+Xmax_l-1-0, /** x1_0:0 */ x1_0_p+x_l-1-0, /** x1_1:0 */ x1_1_p+x_l-1-0, /** x1_2:0 */ x1_2_p+x_l-1-0, /** x1_3:0 */ x1_3_p+x_l-1-0, /** x1_4:0 */ x1_4_p+x_l-1-0, /** x1_5:0 */ x1_5_p+x_l-1-0, /** x1_6:0 */ x1_6_p+x_l-1-0, /** x1_7:0 */ x1_7_p+x_l-1-0, /** x1_8:0 */ x1_8_p+x_l-1-0, /** x1_9:0 */ x1_9_p+x_l-1-0, /** x1_10:0 */ x1_10_p+x_l-1-0, /** x1_11:0 */ x1_11_p+x_l-1-0, /** x1_12:0 */ x1_12_p+x_l-1-0, /** x2_0:0 */ x2_0_p+x_l-1-0, /** x2_1:0 */ x2_1_p+x_l-1-0, /** x2_2:0 */ x2_2_p+x_l-1-0, /** x2_3:0 */ x2_3_p+x_l-1-0, /** x2_4:0 */ x2_4_p+x_l-1-0, /** x2_5:0 */ x2_5_p+x_l-1-0, /** x2_6:0 */ x2_6_p+x_l-1-0, /** x2_7:0 */ x2_7_p+x_l-1-0, /** x2_8:0 */ x2_8_p+x_l-1-0, /** x2_9:0 */ x2_9_p+x_l-1-0, /** x2_10:0 */ x2_10_p+x_l-1-0, /** x2_11:0 */ x2_11_p+x_l-1-0, /** x2_12:0 */ x2_12_p+x_l-1-0, /** x3_0:0 */ x3_0_p+x_l-1-0, /** x3_1:0 */ x3_1_p+x_l-1-0, /** x3_2:0 */ x3_2_p+x_l-1-0, /** x3_3:0 */ x3_3_p+x_l-1-0, /** x3_4:0 */ x3_4_p+x_l-1-0, /** x3_5:0 */ x3_5_p+x_l-1-0, /** x3_6:0 */ x3_6_p+x_l-1-0, /** x3_7:0 */ x3_7_p+x_l-1-0, /** x3_8:0 */ x3_8_p+x_l-1-0, /** x3_9:0 */ x3_9_p+x_l-1-0, /** x3_10:0 */ x3_10_p+x_l-1-0, /** x3_11:0 */ x3_11_p+x_l-1-0, /** x3_12:0 */ x3_12_p+x_l-1-0, /** x4_0:0 */ x4_0_p+x_l-1-0, /** x4_1:0 */ x4_1_p+x_l-1-0, /** x4_2:0 */ x4_2_p+x_l-1-0, /** x4_3:0 */ x4_3_p+x_l-1-0, /** x4_4:0 */ x4_4_p+x_l-1-0, /** x4_5:0 */ x4_5_p+x_l-1-0, /** x4_6:0 */ x4_6_p+x_l-1-0, /** x4_7:0 */ x4_7_p+x_l-1-0, /** x4_8:0 */ x4_8_p+x_l-1-0, /** x4_9:0 */ x4_9_p+x_l-1-0, /** x4_10:0 */ x4_10_p+x_l-1-0, /** x4_11:0 */ x4_11_p+x_l-1-0, /** x4_12:0 */ x4_12_p+x_l-1-0, /** LAR2:0 */ LAR2_p+LAR2_l-1-0, /** LAR6:0 */ LAR6_p+LAR6_l-1-0 //@} }; gr-gsm-0.41.2/lib/decoding/openbts/GSM610Tables.h000066400000000000000000000017561316153413000211550ustar00rootroot00000000000000/* * Copyright 2008 Free Software Foundation, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * This use of this software may be subject to additional restrictions. * See the LEGAL file in the main directory for details. */ #ifndef GSM610TABLES_H #define GSM610TABLES_H namespace GSM { /** Table #2 from GSM 05.03 */ extern unsigned int g610BitOrder[260]; } #endif gr-gsm-0.41.2/lib/decoding/openbts/GSM660Tables.cpp000066400000000000000000000237151316153413000215140ustar00rootroot00000000000000/* * Copyright 2010 Sylvain Munaut * All Rights Reserved * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * This use of this software may be subject to additional restrictions. * See the LEGAL file in the main directory for details. */ /* EFR (GSM 06.60) importance bit ordering */ #include "GSM660Tables.h" unsigned int GSM::g660BitOrder[260] = { 38, 39, 40, 41, 42, 43, /* 0 -> LTP-LAG 1: b8..b3 */ 145, 146, 147, 148, 149, 150, /* 6 -> LTP-LAG 3: b8..b3 */ 93, 94, /* 12 -> LTP-LAG 2: b5..b4 */ 200, 201, /* 14 -> LTP-LAG 4: b5..b4 */ 47, /* 16 -> LTP-GAIN 1: b3 */ 88, /* 17 -> FCB-GAIN 1: b4 */ 99, /* 18 -> LTP-GAIN 2: b3 */ 140, /* 19 -> FCB-GAIN 2: b4 */ 44, /* 20 -> LTP-LAG 1: b2 */ 151, /* 21 -> LTP-LAG 3: b2 */ 95, /* 22 -> LTP-LAG 2: b3 */ 202, /* 23 -> LTP-LAG 4: b3 */ 1, 2, /* 24 -> LPC 1: b5..b4 */ 7, /* 26 -> LPC 2: b7 */ 9, /* 27 -> LPC 2: b5 */ 17, 18, /* 28 -> LPC 3: b6..b5 */ 23, /* 30 -> LPC 3: b0 */ 45, 46, /* 31 -> LTP-LAG 1: b1..b0 */ 152, 153, /* 33 -> LTP-LAG 3: b1..b0 */ 96, /* 35 -> LTP-LAG 2: b2 */ 203, /* 36 -> LTP-LAG 4: b2 */ 3, 4, /* 37 -> LPC 1: b3..b2 */ 10, 11, /* 39 -> LPC 2: b4..b3 */ 15, /* 41 -> LPC 3: b8 */ 8, /* 42 -> LPC 2: b6 */ 5, 6, /* 43 -> LPC 1: b1..b0 */ 12, /* 45 -> LPC 2: b2 */ 16, /* 46 -> LPC 3: b7 */ 19, /* 47 -> LPC 3: b4 */ 97, /* 48 -> LTP-LAG 2: b1 */ 204, /* 49 -> LTP-LAG 4: b1 */ 0, /* 50 -> LPC 1: b6 */ 13, 14, /* 51 -> LPC 2: b1..b0 */ 20, /* 53 -> LPC 3: b3 */ 24, 25, /* 54 -> LPC 4: b7..b6 */ 27, /* 56 -> LPC 4: b4 */ 154, /* 57 -> LTP-GAIN 3: b3 */ 206, /* 58 -> LTP-GAIN 4: b3 */ 195, /* 59 -> FCB-GAIN 3: b4 */ 247, /* 60 -> FCB-GAIN 4: b4 */ 89, /* 61 -> FCB-GAIN 1: b3 */ 141, /* 62 -> FCB-GAIN 2: b3 */ 196, /* 63 -> FCB-GAIN 3: b3 */ 248, /* 64 -> FCB-GAIN 4: b3 */ 252, 253, 254, 255, 256, 257, 258, 259, /* 65 -> CRC-POLY: b7..b0 */ 48, /* 73 -> LTP-GAIN 1: b2 */ 100, /* 74 -> LTP-GAIN 2: b2 */ 155, /* 75 -> LTP-GAIN 3: b2 */ 207, /* 76 -> LTP-GAIN 4: b2 */ 21, 22, /* 77 -> LPC 3: b2..b1 */ 26, /* 79 -> LPC 4: b5 */ 28, /* 80 -> LPC 4: b3 */ 51, /* 81 -> PULSE 1_1: b3 */ 55, /* 82 -> PULSE 1_2: b3 */ 59, /* 83 -> PULSE 1_3: b3 */ 63, /* 84 -> PULSE 1_4: b3 */ 67, /* 85 -> PULSE 1_5: b3 */ 103, /* 86 -> PULSE 2_1: b3 */ 107, /* 87 -> PULSE 2_2: b3 */ 111, /* 88 -> PULSE 2_3: b3 */ 115, /* 89 -> PULSE 2_4: b3 */ 119, /* 90 -> PULSE 2_5: b3 */ 158, /* 91 -> PULSE 3_1: b3 */ 162, /* 92 -> PULSE 3_2: b3 */ 166, /* 93 -> PULSE 3_3: b3 */ 170, /* 94 -> PULSE 3_4: b3 */ 174, /* 95 -> PULSE 3_5: b3 */ 210, /* 96 -> PULSE 4_1: b3 */ 214, /* 97 -> PULSE 4_2: b3 */ 218, /* 98 -> PULSE 4_3: b3 */ 222, /* 99 -> PULSE 4_4: b3 */ 226, /* 100 -> PULSE 4_5: b3 */ 90, /* 101 -> FCB-GAIN 1: b2 */ 142, /* 102 -> FCB-GAIN 2: b2 */ 197, /* 103 -> FCB-GAIN 3: b2 */ 249, /* 104 -> FCB-GAIN 4: b2 */ 49, /* 105 -> LTP-GAIN 1: b1 */ 101, /* 106 -> LTP-GAIN 2: b1 */ 156, /* 107 -> LTP-GAIN 3: b1 */ 208, /* 108 -> LTP-GAIN 4: b1 */ 29, 30, 31, /* 109 -> LPC 4: b2..b0 */ 32, 33, 34, 35, /* 112 -> LPC 5: b5..b2 */ 98, /* 116 -> LTP-LAG 2: b0 */ 205, /* 117 -> LTP-LAG 4: b0 */ 52, /* 118 -> PULSE 1_1: b2 */ 56, /* 119 -> PULSE 1_2: b2 */ 60, /* 120 -> PULSE 1_3: b2 */ 64, /* 121 -> PULSE 1_4: b2 */ 68, /* 122 -> PULSE 1_5: b2 */ 104, /* 123 -> PULSE 2_1: b2 */ 108, /* 124 -> PULSE 2_2: b2 */ 112, /* 125 -> PULSE 2_3: b2 */ 116, /* 126 -> PULSE 2_4: b2 */ 120, /* 127 -> PULSE 2_5: b2 */ 159, /* 128 -> PULSE 3_1: b2 */ 163, /* 129 -> PULSE 3_2: b2 */ 167, /* 130 -> PULSE 3_3: b2 */ 171, /* 131 -> PULSE 3_4: b2 */ 175, /* 132 -> PULSE 3_5: b2 */ 211, /* 133 -> PULSE 4_1: b2 */ 215, /* 134 -> PULSE 4_2: b2 */ 219, /* 135 -> PULSE 4_3: b2 */ 223, /* 136 -> PULSE 4_4: b2 */ 227, /* 137 -> PULSE 4_5: b2 */ 53, /* 138 -> PULSE 1_1: b1 */ 57, /* 139 -> PULSE 1_2: b1 */ 61, /* 140 -> PULSE 1_3: b1 */ 65, /* 141 -> PULSE 1_4: b1 */ 105, /* 142 -> PULSE 2_1: b1 */ 109, /* 143 -> PULSE 2_2: b1 */ 113, /* 144 -> PULSE 2_3: b1 */ 117, /* 145 -> PULSE 2_4: b1 */ 160, /* 146 -> PULSE 3_1: b1 */ 164, /* 147 -> PULSE 3_2: b1 */ 168, /* 148 -> PULSE 3_3: b1 */ 172, /* 149 -> PULSE 3_4: b1 */ 212, /* 150 -> PULSE 4_1: b1 */ 220, /* 151 -> PULSE 4_3: b1 */ 224, /* 152 -> PULSE 4_4: b1 */ 91, /* 153 -> FCB-GAIN 1: b1 */ 143, /* 154 -> FCB-GAIN 2: b1 */ 198, /* 155 -> FCB-GAIN 3: b1 */ 250, /* 156 -> FCB-GAIN 4: b1 */ 50, /* 157 -> LTP-GAIN 1: b0 */ 102, /* 158 -> LTP-GAIN 2: b0 */ 157, /* 159 -> LTP-GAIN 3: b0 */ 209, /* 160 -> LTP-GAIN 4: b0 */ 92, /* 161 -> FCB-GAIN 1: b0 */ 144, /* 162 -> FCB-GAIN 2: b0 */ 199, /* 163 -> FCB-GAIN 3: b0 */ 251, /* 164 -> FCB-GAIN 4: b0 */ 54, /* 165 -> PULSE 1_1: b0 */ 58, /* 166 -> PULSE 1_2: b0 */ 62, /* 167 -> PULSE 1_3: b0 */ 66, /* 168 -> PULSE 1_4: b0 */ 106, /* 169 -> PULSE 2_1: b0 */ 110, /* 170 -> PULSE 2_2: b0 */ 114, /* 171 -> PULSE 2_3: b0 */ 118, /* 172 -> PULSE 2_4: b0 */ 161, /* 173 -> PULSE 3_1: b0 */ 165, /* 174 -> PULSE 3_2: b0 */ 169, /* 175 -> PULSE 3_3: b0 */ 173, /* 176 -> PULSE 3_4: b0 */ 213, /* 177 -> PULSE 4_1: b0 */ 221, /* 178 -> PULSE 4_3: b0 */ 225, /* 179 -> PULSE 4_4: b0 */ 36, 37, /* 180 -> LPC 5: b1..b0 */ 69, /* 182 -> PULSE 1_5: b1 */ 71, 72, /* 183 -> PULSE 1_5: b1..b1 */ 121, /* 185 -> PULSE 2_5: b1 */ 123, 124, /* 186 -> PULSE 2_5: b1..b1 */ 176, /* 188 -> PULSE 3_5: b1 */ 178, 179, /* 189 -> PULSE 3_5: b1..b1 */ 228, /* 191 -> PULSE 4_5: b1 */ 230, 231, /* 192 -> PULSE 4_5: b1..b1 */ 216, 217, /* 194 -> PULSE 4_2: b1..b0 */ 70, /* 196 -> PULSE 1_5: b0 */ 122, /* 197 -> PULSE 2_5: b0 */ 177, /* 198 -> PULSE 3_5: b0 */ 229, /* 199 -> PULSE 4_5: b0 */ 73, /* 200 -> PULSE 1_6: b2 */ 76, /* 201 -> PULSE 1_7: b2 */ 79, /* 202 -> PULSE 1_8: b2 */ 82, /* 203 -> PULSE 1_9: b2 */ 85, /* 204 -> PULSE 1_10: b2 */ 125, /* 205 -> PULSE 2_6: b2 */ 128, /* 206 -> PULSE 2_7: b2 */ 131, /* 207 -> PULSE 2_8: b2 */ 134, /* 208 -> PULSE 2_9: b2 */ 137, /* 209 -> PULSE 2_10: b2 */ 180, /* 210 -> PULSE 3_6: b2 */ 183, /* 211 -> PULSE 3_7: b2 */ 186, /* 212 -> PULSE 3_8: b2 */ 189, /* 213 -> PULSE 3_9: b2 */ 192, /* 214 -> PULSE 3_10: b2 */ 232, /* 215 -> PULSE 4_6: b2 */ 235, /* 216 -> PULSE 4_7: b2 */ 238, /* 217 -> PULSE 4_8: b2 */ 241, /* 218 -> PULSE 4_9: b2 */ 244, /* 219 -> PULSE 4_10: b2 */ 74, /* 220 -> PULSE 1_6: b1 */ 77, /* 221 -> PULSE 1_7: b1 */ 80, /* 222 -> PULSE 1_8: b1 */ 83, /* 223 -> PULSE 1_9: b1 */ 86, /* 224 -> PULSE 1_10: b1 */ 126, /* 225 -> PULSE 2_6: b1 */ 129, /* 226 -> PULSE 2_7: b1 */ 132, /* 227 -> PULSE 2_8: b1 */ 135, /* 228 -> PULSE 2_9: b1 */ 138, /* 229 -> PULSE 2_10: b1 */ 181, /* 230 -> PULSE 3_6: b1 */ 184, /* 231 -> PULSE 3_7: b1 */ 187, /* 232 -> PULSE 3_8: b1 */ 190, /* 233 -> PULSE 3_9: b1 */ 193, /* 234 -> PULSE 3_10: b1 */ 233, /* 235 -> PULSE 4_6: b1 */ 236, /* 236 -> PULSE 4_7: b1 */ 239, /* 237 -> PULSE 4_8: b1 */ 242, /* 238 -> PULSE 4_9: b1 */ 245, /* 239 -> PULSE 4_10: b1 */ 75, /* 240 -> PULSE 1_6: b0 */ 78, /* 241 -> PULSE 1_7: b0 */ 81, /* 242 -> PULSE 1_8: b0 */ 84, /* 243 -> PULSE 1_9: b0 */ 87, /* 244 -> PULSE 1_10: b0 */ 127, /* 245 -> PULSE 2_6: b0 */ 130, /* 246 -> PULSE 2_7: b0 */ 133, /* 247 -> PULSE 2_8: b0 */ 136, /* 248 -> PULSE 2_9: b0 */ 139, /* 249 -> PULSE 2_10: b0 */ 182, /* 250 -> PULSE 3_6: b0 */ 185, /* 251 -> PULSE 3_7: b0 */ 188, /* 252 -> PULSE 3_8: b0 */ 191, /* 253 -> PULSE 3_9: b0 */ 194, /* 254 -> PULSE 3_10: b0 */ 234, /* 255 -> PULSE 4_6: b0 */ 237, /* 256 -> PULSE 4_7: b0 */ 240, /* 257 -> PULSE 4_8: b0 */ 243, /* 258 -> PULSE 4_9: b0 */ 246, /* 259 -> PULSE 4_10: b0 */ }; gr-gsm-0.41.2/lib/decoding/openbts/GSM660Tables.h000066400000000000000000000021101316153413000211430ustar00rootroot00000000000000/* EFR (GSM 06.60) importance bit ordering */ /* * Copyright 2010 Sylvain Munaut * All Rights Reserved * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * This use of this software may be subject to additional restrictions. * See the LEGAL file in the main directory for details. */ #ifndef GSM660TABLES_H #define GSM660TABLES_H namespace GSM { /** Table #6 from GSM 05.03 */ extern unsigned int g660BitOrder[260]; } #endif /* GSM660TABLES_H */ gr-gsm-0.41.2/lib/decoding/openbts/Vector.h000066400000000000000000000423221316153413000204010ustar00rootroot00000000000000/* * Copyright 2008 Free Software Foundation, Inc. * Copyright 2014 Range Networks, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * This use of this software may be subject to additional restrictions. * See the LEGAL file in the main directory for details. */ /**@file Simplified Vector template with aliases. */ #ifndef VECTOR_H #define VECTOR_H #include #include #include #include // We cant use Logger.h in this file... extern int gVectorDebug; //#define ENABLE_VECTORDEBUG #ifdef ENABLE_VECTORDEBUG #define VECTORDEBUG(...) { printf(__VA_ARGS__); printf(" this=%p [%p,%p,%p]\n",(void*)this,(void*)&mData,mStart,mEnd); } //#define VECTORDEBUG(msg) { std::cout< class RCData : public RefCntBase { public: T* mPointer; }; #endif /** A simplified Vector template with aliases. Unlike std::vector, this class does not support dynamic resizing. Unlike std::vector, this class does support "aliases" and subvectors. */ // (pat) Nov 2013: Vector and the derived classes BitVector and SoftVector were originally written with behavior // that differed for const and non-const cases, making them very difficult to use and resulting in many extremely // difficult to find bugs in the code base. // Ultimately these classes should all be converted to reference counted methodologies, but as an interim measure // I am rationalizing their behavior until we flush out all places in the code base that inadvertently depended // on the original behavior. This is done with assert statements in BitVector methods. // ==== // What the behavior was probably supposed to be: // Vectors can 'own' the data they point to or not. Only one Vector 'owns' the memory at a time, // so that automatic destruction can be used. So whenever there is an operation that yields one // vector from another the options were: clone (allocate a new vector from memory), alias (make the // new vector point into the memory of the original vector) or shift (the new Vector steals the // memory ownership from the original vector.) // The const copy-constructor did a clone, the non-const copy constructor did a shiftMem, and the segment and // related methods (head, tail, etc) returned aliases. // Since a copy-constructor is inserted transparently in sometimes surprising places, this made the // class very difficult to use. Moreover, since the C++ standard specifies that a copy-constructor is used // to copy the return value from functions, it makes it literally impossible for a function to fully control // the return value. Our code has relied on the "Return Value Optimization" which says that the C++ compiler // may omit the copy-construction of the return value even if the copy-constructor has side-effects, which ours does. // This methodology is fundamentally incompatible with C++. // What the original behavior actually was: // class Vector: // The copy-constructor and assignment operators did a clone for the const case and a shift for the non-const case. // This is really horrible. // The segment methods were identical for const and non-const cases, always returning an alias. // This also resulted in zillions of redundant mallocs and copies throughout the code base. // class BitVector: // Copy-constructor: // BitVector did not have any copy-constructors, and I think the intent was that it would have the same behavior // as Vector, but that is not how C++ works: with no copy-constructor the default copy-constructor // uses only the const case, so only the const Vector copy-constructor was used. Therefore it always cloned, // and the code base relied heavily on the "Return Value Optimization" to work at all. // Assignment operator: // BitVector did not have one, so C++ makes a default one that calls Vector::operator=() as a side effect, // which did a clone; not sure if there was a non-const version and no longer care. // segment methods: // The non-const segment() returned an alias, and the const segment() returned a clone. // I think the intent was that the behavior should be the same as Vector, but there was a conversion // of the result of the const segment() method from Vector to BitVector which caused the Vector copy-constructor // to be (inadvertently) invoked, resulting in the const version of the segment method returning a clone. // What the behavior is now: // VectorBase: // There is a new VectorBase class that has only the common methods and extremely basic constructors. // The VectorBase class MUST NOT CONTAIN: copy constructors, non-trivial constructors called from derived classes, // or any method that returns a VectorBase type object. Why? Because any of the above when used in derived classes // can cause copy-constructor invocation, often surprisingly, obfuscating the code. // Each derived class must provide its own: copy-constructors and segment() and related methods, since we do not // want to inadvertently invoke a copy-constructor to convert the segment() result from VectorBase to the derived type. // BitVector: // The BitVector copy-constructor and assignment operator (inherited from VectorBase) paradigm is: // if the copied Vector owned memory, perform a clone so the new vector owns memory also, // otherwise just do a simple copy, which is another alias. This isnt perfect but works every place // in our code base and easier to use than the previous paradigm. // The segment method always returns an alias. // If you want a clone of a segment, use cloneSegment(), which replaces the previous: const segment(...) const method. // Note that the semantics of cloneSegment still rely on the Return Value Optimization. Oh well, we should use refcnts. // Vector: // I left Vector alone (except for rearrangement to separate out VectorBase.) Vector should just not be used. // SoftVector: // SoftVector and signalVector should be updated similar to BitVector, but I did not want to disturb them. // What the behavior should be: // All these should be reference-counted, similar to ByteVector. template class VectorBase { // TODO -- Replace memcpy calls with for-loops. (pat) in case class T is not POD [Plain Old Data] protected: #if BITVECTOR_REFCNTS typedef RefCntPointer > VectorDataType; #else typedef T* VectorDataType; #endif VectorDataType mData; ///< allocated data block. T* mStart; ///< start of useful data T* mEnd; ///< end of useful data + 1 // Init vector with specified size. Previous contents are completely discarded. This is only used for initialization. void vInit(size_t elements) { mData = elements ? new T[elements] : NULL; mStart = mData; // This is where mStart get set to zero mEnd = mStart + elements; } /** Assign from another Vector, shifting ownership. */ // (pat) This should be eliminated, but it is used by Vector and descendents. void shiftMem(VectorBase&other) { VECTORDEBUG("VectorBase::shiftMem(%p)",(void*)&other); this->clear(); this->mData=other.mData; this->mStart=other.mStart; this->mEnd=other.mEnd; other.mData=NULL; } // Assign from another Vector, making this an alias to other. void makeAlias(const VectorBase &other) { if (this->getData()) { assert(this->getData() != other.getData()); // Not possible by the semantics of Vector. this->clear(); } this->mStart=const_cast(other.mStart); this->mEnd=const_cast(other.mEnd); } public: /** Return the size of the Vector in units, ie, the number of T elements. */ size_t size() const { assert(mStart>=mData); assert(mEnd>=mStart); return mEnd - mStart; } /** Return size in bytes. */ size_t bytes() const { return this->size()*sizeof(T); } /** Change the size of the Vector in items (not bytes), discarding content. */ void resize(size_t newElements) { //VECTORDEBUG("VectorBase::resize("<<(void*)this<<","<resize(0); } /** Copy data from another vector. */ void clone(const VectorBase& other) { this->resize(other.size()); memcpy(mData,other.mStart,other.bytes()); } void vConcat(const VectorBase&other1, const VectorBase&other2) { this->resize(other1.size()+other2.size()); memcpy(this->mStart, other1.mStart, other1.bytes()); memcpy(this->mStart+other1.size(), other2.mStart, other2.bytes()); } protected: VectorBase() : mData(0), mStart(0), mEnd(0) {} /** Build a Vector with explicit values. */ VectorBase(VectorDataType wData, T* wStart, T* wEnd) :mData(wData),mStart(wStart),mEnd(wEnd) { //VECTORDEBUG("VectorBase("<<(void*)wData); VECTORDEBUG("VectorBase(%p,%p,%p)",this->getData(),wStart,wEnd); } public: /** Destroy a Vector, deleting held memory. */ ~VectorBase() { //VECTORDEBUG("~VectorBase("<<(void*)this<<")"); VECTORDEBUG("~VectorBase(%p)",this); this->clear(); } bool isOwner() { return !!this->mData; } // Do we own any memory ourselves? std::string inspect() const { char buf[100]; snprintf(buf,100," mData=%p mStart=%p mEnd=%p ",(void*)mData,mStart,mEnd); return std::string(buf); } /** Copy part of this Vector to a segment of another Vector. @param other The other vector. @param start The start point in the other vector. @param span The number of elements to copy. */ void copyToSegment(VectorBase& other, size_t start, size_t span) const { T* base = other.mStart + start; assert(base+span<=other.mEnd); assert(mStart+span<=mEnd); memcpy(base,mStart,span*sizeof(T)); } /** Copy all of this Vector to a segment of another Vector. */ void copyToSegment(VectorBase& other, size_t start=0) const { copyToSegment(other,start,size()); } void copyTo(VectorBase& other) const { copyToSegment(other,0,size()); } /** Copy a segment of this vector into another. @param other The other vector (to copt into starting at 0.) @param start The start point in this vector. @param span The number of elements to copy. WARNING: This function does NOT resize the result - you must set the result size before entering. */ void segmentCopyTo(VectorBase& other, size_t start, size_t span) const { const T* base = mStart + start; assert(base+span<=mEnd); assert(other.mStart+span<=other.mEnd); memcpy(other.mStart,base,span*sizeof(T)); } void fill(const T& val) { T* dp=mStart; while (dp& other) { //std::cout << "Vector=(this="<inspect()<<",other="<clone(other); } else { this->makeAlias(other); } //std::cout << "Vector= after(this="<inspect()<<")"<mStart; } T* begin() { return this->mStart; } const T* end() const { return this->mEnd; } T* end() { return this->mEnd; } #if BITVECTOR_REFCNTS const T*getData() const { return this->mData.isNULL() ? 0 : this->mData->mPointer; } #else const T*getData() const { return this->mData; } #endif }; // (pat) Nov 2013. This class retains the original poor behavior. See comments at VectorBase template class Vector : public VectorBase { public: /** Build an empty Vector of a given size. */ Vector(size_t wSize=0) { this->resize(wSize); } /** Build a Vector by shifting the data block. */ Vector(Vector& other) : VectorBase(other.mData,other.mStart,other.mEnd) { other.mData=NULL; } /** Build a Vector by copying another. */ Vector(const Vector& other):VectorBase() { this->clone(other); } /** Build a Vector with explicit values. */ Vector(T* wData, T* wStart, T* wEnd) : VectorBase(wData,wStart,wEnd) { } /** Build a vector from an existing block, NOT to be deleted upon destruction. */ Vector(T* wStart, size_t span) : VectorBase(NULL,wStart,wStart+span) { } /** Build a Vector by concatenation. */ Vector(const Vector& other1, const Vector& other2):VectorBase() { assert(this->mData == 0); this->vConcat(other1,other2); } //@{ /** Assign from another Vector, shifting ownership. */ void operator=(Vector& other) { this->shiftMem(other); } /** Assign from another Vector, copying. */ void operator=(const Vector& other) { this->clone(other); } /** Return an alias to a segment of this Vector. */ Vector segment(size_t start, size_t span) { T* wStart = this->mStart + start; T* wEnd = wStart + span; assert(wEnd<=this->mEnd); return Vector(NULL,wStart,wEnd); } /** Return an alias to a segment of this Vector. */ const Vector segment(size_t start, size_t span) const { T* wStart = this->mStart + start; T* wEnd = wStart + span; assert(wEnd<=this->mEnd); return Vector(NULL,wStart,wEnd); } Vector head(size_t span) { return segment(0,span); } const Vector head(size_t span) const { return segment(0,span); } Vector tail(size_t start) { return segment(start,this->size()-start); } const Vector tail(size_t start) const { return segment(start,this->size()-start); } /**@name Iterator types. */ //@{ typedef T* iterator; typedef const T* const_iterator; //@} //@} }; /** Basic print operator for Vector objects. */ template std::ostream& operator<<(std::ostream& os, const Vector& v) { for (unsigned i=0; i. * * This use of this software may be subject to additional restrictions. * See the LEGAL file in the main directory for details. */ #ifndef _VITERBI_H_ #define _VITERBI_H_ 1 // (pat) Virtual base class for Viterbi and Turbo coder/decoders. class ViterbiBase { public: virtual void encode(const BitVector &in, BitVector& target) const = 0; virtual void decode(const SoftVector &in, BitVector& target) = 0; // (pat) Return error count from most recent decoder run. // If you get -1 from this, the method is not defined in the Viterbi class. virtual int getBEC() { return -1; } //virtual ~ViterbiBase(); Currently None of these have destructors. // These functions are logically part of the Viterbi functionality, even though they do not use any class variables. unsigned applyPoly(uint64_t val, uint64_t poly); unsigned applyPoly(uint64_t val, uint64_t poly, unsigned order); }; #endif gr-gsm-0.41.2/lib/decoding/openbts/ViterbiR204.cpp000066400000000000000000000221061316153413000214440ustar00rootroot00000000000000/* * Copyright 2008, 2009, 2014 Free Software Foundation, Inc. * Copyright 2014 Range Networks, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * This use of this software may be subject to additional restrictions. * See the LEGAL file in the main directory for details. */ #include "BitVector.h" #include "ViterbiR204.h" #include #include #include #include using namespace std; /** Apply a Galois polymonial to a binary seqeunce. @param val The input sequence. @param poly The polynomial. @param order The order of the polynomial. @return Single-bit result. */ unsigned ViterbiBase::applyPoly(uint64_t val, uint64_t poly, unsigned order) { uint64_t prod = val & poly; unsigned sum = prod; for (unsigned i=1; i>i; return sum & 0x01; } unsigned ViterbiBase::applyPoly(uint64_t val, uint64_t poly) { uint64_t prod = val & poly; prod = (prod ^ (prod >> 32)); prod = (prod ^ (prod >> 16)); prod = (prod ^ (prod >> 8)); prod = (prod ^ (prod >> 4)); prod = (prod ^ (prod >> 2)); prod = (prod ^ (prod >> 1)); return prod & 0x01; } //void BitVector::encode(const ViterbiR2O4& coder, BitVector& target) void ViterbiR2O4::encode(const BitVector& in, BitVector& target) const { const ViterbiR2O4& coder = *this; size_t sz = in.size(); assert(sz*coder.iRate() == target.size()); // Build a "history" array where each element contains the full history. uint32_t history[sz]; uint32_t accum = 0; for (size_t i=0; iiState) << 1; // input state for 0 const uint32_t iState1 = iState0 | 0x01; // input state for 1 const uint32_t oStateShifted = (sp->oState) << mIRate; // shifted output (by 2) const float cost = sp->cost; int bec = sp->bitErrorCnt; sp++; // 0 input extension mCandidates[i].cost = cost; // mCMask is the low 5 bits, ie, full width of mGeneratorTable. mCandidates[i].oState = oStateShifted | mGeneratorTable[iState0 & mCMask]; mCandidates[i].iState = iState0; mCandidates[i].bitErrorCnt = bec; // 1 input extension mCandidates[i+1].cost = cost; mCandidates[i+1].oState = oStateShifted | mGeneratorTable[iState1 & mCMask]; mCandidates[i+1].iState = iState1; mCandidates[i+1].bitErrorCnt = bec; } } void ViterbiR2O4::getSoftCostMetrics(const uint32_t inSample, const float *matchCost, const float *mismatchCost) { const float *cTab[2] = {matchCost,mismatchCost}; for (unsigned i=0; i>1)&0x01][0]; if (mismatched & 1) { thisCand.bitErrorCnt++; } if (mismatched & 2) { thisCand.bitErrorCnt++; } } } void ViterbiR2O4::pruneCandidates() { const vCand* c1 = mCandidates; // 0-prefix const vCand* c2 = mCandidates + mIStates; // 1-prefix for (unsigned i=0; i=minCost) continue; minCost = thisCost; minIndex=i; } return mSurvivors[minIndex]; } const ViterbiR2O4::vCand* ViterbiR2O4::vstep(uint32_t inSample, const float *probs, const float *iprobs, bool isNotTailBits) { branchCandidates(); // (pat) tail bits do not affect cost or error bit count of any branch. if (isNotTailBits) getSoftCostMetrics(inSample,probs,iprobs); pruneCandidates(); return &minCost(); } void ViterbiR2O4::decode(const SoftVector &in, BitVector& target) { ViterbiR2O4& decoder = *this; const size_t sz = in.size(); const unsigned oSize = in.size() / decoder.iRate(); const unsigned deferral = decoder.deferral(); const size_t ctsz = sz + deferral*decoder.iRate(); assert(sz <= decoder.iRate()*target.size()); // Build a "history" array where each element contains the full history. // (pat) We only use every other history element, so why are we setting them? uint32_t history[ctsz]; { BitVector bits = in.sliced(); uint32_t accum = 0; for (size_t i=0; i0.5F) pVal = 1.0F-pVal; float ipVal = 1.0F-pVal; // This is a cheap approximation to an ideal cost function. if (pVal<0.01F) pVal = 0.01; if (ipVal<0.01F) ipVal = 0.01; matchCostTable[i] = 0.25F/ipVal; mismatchCostTable[i] = 0.25F/pVal; } // pad end of table with unknowns // Note that these bits should not contribute to Bit Error Count. for (size_t i=sz; i=deferral) *op++ = (minCost->iState >> deferral)&0x01; oCount++; } // Dont think minCost == NULL can happen. mBitErrorCnt = minCost ? minCost->bitErrorCnt : 0; } } // vim: ts=4 sw=4 gr-gsm-0.41.2/lib/decoding/openbts/ViterbiR204.h000066400000000000000000000111071316153413000211100ustar00rootroot00000000000000/* * Copyright 2008, 2009, 2014 Free Software Foundation, Inc. * Copyright 2014 Range Networks, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * This use of this software may be subject to additional restrictions. * See the LEGAL file in the main directory for details. */ #ifndef _VITERBIR204_H_ #define _VITERBIR204_H_ 1 #include "Viterbi.h" /** Class to represent convolutional coders/decoders of rate 1/2, memory length 4. This is the "workhorse" coder for most GSM channels. */ class ViterbiR2O4 : public ViterbiBase { private: /**name Lots of precomputed elements so the compiler can optimize like hell. */ //@{ /**@name Core values. */ //@{ static const unsigned mIRate = 2; ///< reciprocal of rate static const unsigned mOrder = 4; ///< memory length of generators //@} /**@name Derived values. */ //@{ static const unsigned mIStates = 0x01 << mOrder; ///< (16) number of states, number of survivors static const uint32_t mSMask = mIStates-1; ///< survivor mask static const uint32_t mCMask = (mSMask<<1) | 0x01; ///< candidate mask static const uint32_t mOMask = (0x01< #include /*! \file gsm0503.h * Osmocom convolutional encoder/decoder for xCCH channels, see 3GPP TS 05.03 */ /*! \brief structure describing convolutional code xCCH * * Non-recursive code, flushed, not punctured code. */ extern const struct osmo_conv_code gsm0503_xcch; /*! \brief structure describing convolutional code RACH */ extern const struct osmo_conv_code gsm0503_rach; /*! \brief structure describing convolutional code SCH */ extern const struct osmo_conv_code gsm0503_sch; /*! \brief structures describing convolutional codes CS2/3 */ extern const struct osmo_conv_code gsm0503_cs2; extern const struct osmo_conv_code gsm0503_cs3; /*! \brief structure describing convolutional code TCH/FR */ extern const struct osmo_conv_code gsm0503_tch_fr; /*! \brief structure describing convolutional code TCH/HR */ extern const struct osmo_conv_code gsm0503_tch_hr; /*! \brief structure describing convolutional code TCH/AFS 12.2 */ extern const struct osmo_conv_code gsm0503_tch_afs_12_2; /*! \brief structure describing convolutional code TCH/AFS 10.2 */ extern const struct osmo_conv_code gsm0503_tch_afs_10_2; /*! \brief structure describing convolutional code TCH/AFS 7.95 */ extern const struct osmo_conv_code gsm0503_tch_afs_7_95; /*! \brief structure describing convolutional code TCH/AFS 7.4 */ extern const struct osmo_conv_code gsm0503_tch_afs_7_4; /*! \brief structure describing convolutional code TCH/AFS 6.7 */ extern const struct osmo_conv_code gsm0503_tch_afs_6_7; /*! \brief structure describing convolutional code TCH/AFS 5.9 */ extern const struct osmo_conv_code gsm0503_tch_afs_5_9; /*! \brief structure describing convolutional code TCH/AFS 5.15 */ extern const struct osmo_conv_code gsm0503_tch_afs_5_15; /*! \brief structure describing convolutional code TCH/AFS 4.75 */ extern const struct osmo_conv_code gsm0503_tch_afs_4_75; /*! \brief structure describing convolutional code TCH/AHS 7.95 */ extern const struct osmo_conv_code gsm0503_tch_ahs_7_95; /*! \brief structure describing convolutional code TCH/AHS 7.4 */ extern const struct osmo_conv_code gsm0503_tch_ahs_7_4; /*! \brief structure describing convolutional code TCH/AHS 6.7 */ extern const struct osmo_conv_code gsm0503_tch_ahs_6_7; /*! \brief structure describing convolutional code TCH/AHS 5.9 */ extern const struct osmo_conv_code gsm0503_tch_ahs_5_9; /*! \brief structure describing convolutional code TCH/AHS 5.15 */ extern const struct osmo_conv_code gsm0503_tch_ahs_5_15; /*! \brief structure describing convolutional code TCH/AHS 4.75 */ extern const struct osmo_conv_code gsm0503_tch_ahs_4_75; /*! \brief structure describing convolutional code EDGE MCS-1 DL HDR */ extern const struct osmo_conv_code gsm0503_mcs1_dl_hdr; /*! \brief structure describing convolutional code EDGE MCS-1 UL HDR */ extern const struct osmo_conv_code gsm0503_mcs1_ul_hdr; /*! \brief structure describing convolutional code EDGE MCS-1 */ extern const struct osmo_conv_code gsm0503_mcs1; /*! \brief structure describing convolutional code EDGE MCS-2 */ extern const struct osmo_conv_code gsm0503_mcs2; /*! \brief structure describing convolutional code EDGE MCS-3 */ extern const struct osmo_conv_code gsm0503_mcs3; /*! \brief structure describing convolutional code EDGE MCS-4 */ extern const struct osmo_conv_code gsm0503_mcs4; /*! \brief structure describing convolutional code EDGE MCS-5 DL HDR */ extern const struct osmo_conv_code gsm0503_mcs5_dl_hdr; /*! \brief structure describing convolutional code EDGE MCS-5 UL HDR */ extern const struct osmo_conv_code gsm0503_mcs5_ul_hdr; /*! \brief structure describing convolutional code EDGE MCS-5 */ extern const struct osmo_conv_code gsm0503_mcs5; /*! \brief structure describing convolutional code EDGE MCS-6 */ extern const struct osmo_conv_code gsm0503_mcs6; /*! \brief structure describing convolutional code EDGE MCS-7 DL HDR */ extern const struct osmo_conv_code gsm0503_mcs7_dl_hdr; /*! \brief structure describing convolutional code EDGE MCS-7 UL HDR */ extern const struct osmo_conv_code gsm0503_mcs7_ul_hdr; /*! \brief structure describing convolutional code EDGE MCS-7 */ extern const struct osmo_conv_code gsm0503_mcs7; /*! \brief structure describing convolutional code EDGE MCS-8 */ extern const struct osmo_conv_code gsm0503_mcs8; /*! \brief structure describing convolutional code EDGE MCS-9 */ extern const struct osmo_conv_code gsm0503_mcs9; #ifdef __cplusplus } #endif gr-gsm-0.41.2/lib/decoding/osmocom/coding/gsm0503_coding.c000066400000000000000000001060771316153413000230300ustar00rootroot00000000000000/* * (C) 2013 by Andreas Eversberg * (C) 2015 by Alexander Chemeris * (C) 2016 by Tom Tsou * * All Rights Reserved * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include #include #include #include #ifdef __cplusplus extern "C" { #endif #include #include #include #include #include #include #include "gsm0503.h" #include #include "gsm0503_interleaving.h" #include "gsm0503_mapping.h" #include "gsm0503_tables.h" #include "gsm0503_coding.h" #include "gsm0503_parity.h" #ifdef __cplusplus } #endif /* * EGPRS coding limits */ /* Max header size with parity bits */ #define EGPRS_HDR_UPP_MAX 54 /* Max encoded header size */ #define EGPRS_HDR_C_MAX 162 /* Max punctured header size */ #define EGPRS_HDR_HC_MAX 160 /* Max data block size with parity bits */ #define EGPRS_DATA_U_MAX 612 /* Max encoded data block size */ #define EGPRS_DATA_C_MAX 1836 /* Max single block punctured data size */ #define EGPRS_DATA_DC_MAX 1248 /* Dual block punctured data size */ #define EGPRS_DATA_C1 612 #define EGPRS_DATA_C2 EGPRS_DATA_C1 /* TS 101318 Chapter 5.1: 260 bits + 4bit sig */ #define GSM_FR_BYTES 33 /* TS 101318 Chapter 5.2: 112 bits, no sig */ #define GSM_HR_BYTES 14 /* TS 101318 Chapter 5.3: 244 bits + 4bit sig */ #define GSM_EFR_BYTES 31 struct gsm0503_mcs_code { uint8_t mcs; uint8_t usf_len; /* Header coding */ uint8_t hdr_len; uint8_t hdr_code_len; uint8_t hdr_punc_len; const struct osmo_conv_code *hdr_conv; const uint8_t *hdr_punc; /* Data coding */ uint16_t data_len; uint16_t data_code_len; uint16_t data_punc_len; const struct osmo_conv_code *data_conv; const uint8_t *data_punc[3]; }; static int osmo_conv_decode_ber(const struct osmo_conv_code *code, const sbit_t *input, ubit_t *output, int *n_errors, int *n_bits_total) { int res, i, coded_len; ubit_t recoded[EGPRS_DATA_C_MAX]; res = osmo_conv_decode(code, input, output); if (n_bits_total || n_errors) { coded_len = osmo_conv_encode(code, output, recoded); OSMO_ASSERT(sizeof(recoded) / sizeof(recoded[0]) >= coded_len); } /* Count bit errors */ if (n_errors) { *n_errors = 0; for (i = 0; i < coded_len; i++) { if (!((recoded[i] && input[i] < 0) || (!recoded[i] && input[i] > 0)) ) *n_errors += 1; } } if (n_bits_total) *n_bits_total = coded_len; return res; } static int _xcch_decode_cB(uint8_t *l2_data, sbit_t *cB, int *n_errors, int *n_bits_total) { ubit_t conv[224]; int rv; osmo_conv_decode_ber(&gsm0503_xcch, cB, conv, n_errors, n_bits_total); rv = osmo_crc64gen_check_bits(&gsm0503_fire_crc40, conv, 184, conv + 184); if (rv) return -1; osmo_ubit2pbit_ext(l2_data, 0, conv, 0, 184, 1); return 0; } static int _xcch_encode_cB(ubit_t *cB, uint8_t *l2_data) { ubit_t conv[224]; osmo_pbit2ubit_ext(conv, 0, l2_data, 0, 184, 1); osmo_crc64gen_set_bits(&gsm0503_fire_crc40, conv, 184, conv + 184); osmo_conv_encode(&gsm0503_xcch, conv, cB); return 0; } /* * GSM xCCH block transcoding */ int gsm0503_xcch_decode(uint8_t *l2_data, sbit_t *bursts, int *n_errors, int *n_bits_total) { sbit_t iB[456], cB[456]; int i; for (i = 0; i < 4; i++) gsm0503_xcch_burst_unmap(&iB[i * 114], &bursts[i * 116], NULL, NULL); gsm0503_xcch_deinterleave(cB, iB); return _xcch_decode_cB(l2_data, cB, n_errors, n_bits_total); } int gsm0503_xcch_encode(ubit_t *bursts, uint8_t *l2_data) { ubit_t iB[456], cB[456], hl = 1, hn = 1; int i; _xcch_encode_cB(cB, l2_data); gsm0503_xcch_interleave(cB, iB); for (i = 0; i < 4; i++) gsm0503_xcch_burst_map(&iB[i * 114], &bursts[i * 116], &hl, &hn); return 0; } /* * GSM PDTCH block transcoding */ int gsm0503_pdtch_decode(uint8_t *l2_data, sbit_t *bursts, uint8_t *usf_p, int *n_errors, int *n_bits_total) { sbit_t iB[456], cB[676], hl_hn[8]; ubit_t conv[456]; int i, j, k, rv, best = 0, cs = 0, usf = 0; /* make GCC happy */ for (i = 0; i < 4; i++) gsm0503_xcch_burst_unmap(&iB[i * 114], &bursts[i * 116], hl_hn + i * 2, hl_hn + i * 2 + 1); for (i = 0; i < 4; i++) { for (j = 0, k = 0; j < 8; j++) k += abs(((int)gsm0503_pdtch_hl_hn_sbit[i][j]) - ((int)hl_hn[j])); if (i == 0 || k < best) { best = k; cs = i+1; } } gsm0503_xcch_deinterleave(cB, iB); switch (cs) { case 1: osmo_conv_decode_ber(&gsm0503_xcch, cB, conv, n_errors, n_bits_total); rv = osmo_crc64gen_check_bits(&gsm0503_fire_crc40, conv, 184, conv + 184); if (rv) return -1; osmo_ubit2pbit_ext(l2_data, 0, conv, 0, 184, 1); return 23; case 2: for (i = 587, j = 455; i >= 0; i--) { if (!gsm0503_puncture_cs2[i]) cB[i] = cB[j--]; else cB[i] = 0; } osmo_conv_decode_ber(&gsm0503_cs2, cB, conv, n_errors, n_bits_total); for (i = 0; i < 8; i++) { for (j = 0, k = 0; j < 6; j++) k += abs(((int)gsm0503_usf2six[i][j]) - ((int)conv[j])); if (i == 0 || k < best) { best = k; usf = i; } } conv[3] = usf & 1; conv[4] = (usf >> 1) & 1; conv[5] = (usf >> 2) & 1; if (usf_p) *usf_p = usf; rv = osmo_crc16gen_check_bits(&gsm0503_cs234_crc16, conv + 3, 271, conv + 3 + 271); if (rv) return -1; osmo_ubit2pbit_ext(l2_data, 0, conv, 3, 271, 1); return 34; case 3: for (i = 675, j = 455; i >= 0; i--) { if (!gsm0503_puncture_cs3[i]) cB[i] = cB[j--]; else cB[i] = 0; } osmo_conv_decode_ber(&gsm0503_cs3, cB, conv, n_errors, n_bits_total); for (i = 0; i < 8; i++) { for (j = 0, k = 0; j < 6; j++) k += abs(((int)gsm0503_usf2six[i][j]) - ((int)conv[j])); if (i == 0 || k < best) { best = k; usf = i; } } conv[3] = usf & 1; conv[4] = (usf >> 1) & 1; conv[5] = (usf >> 2) & 1; if (usf_p) *usf_p = usf; rv = osmo_crc16gen_check_bits(&gsm0503_cs234_crc16, conv + 3, 315, conv + 3 + 315); if (rv) return -1; osmo_ubit2pbit_ext(l2_data, 0, conv, 3, 315, 1); return 40; case 4: for (i = 12; i < 456; i++) conv[i] = (cB[i] < 0) ? 1 : 0; for (i = 0; i < 8; i++) { for (j = 0, k = 0; j < 12; j++) k += abs(((int)gsm0503_usf2twelve_sbit[i][j]) - ((int)cB[j])); if (i == 0 || k < best) { best = k; usf = i; } } conv[9] = usf & 1; conv[10] = (usf >> 1) & 1; conv[11] = (usf >> 2) & 1; if (usf_p) *usf_p = usf; rv = osmo_crc16gen_check_bits(&gsm0503_cs234_crc16, conv + 9, 431, conv + 9 + 431); if (rv) { *n_bits_total = 456 - 12; *n_errors = *n_bits_total; return -1; } *n_bits_total = 456 - 12; *n_errors = 0; osmo_ubit2pbit_ext(l2_data, 0, conv, 9, 431, 1); return 54; default: *n_bits_total = 0; *n_errors = 0; break; } return -1; } int gsm0503_pdtch_encode(ubit_t *bursts, uint8_t *l2_data, uint8_t l2_len) { ubit_t iB[456], cB[676]; const ubit_t *hl_hn; ubit_t conv[334]; int i, j, usf; switch (l2_len) { case 23: osmo_pbit2ubit_ext(conv, 0, l2_data, 0, 184, 1); osmo_crc64gen_set_bits(&gsm0503_fire_crc40, conv, 184, conv + 184); osmo_conv_encode(&gsm0503_xcch, conv, cB); hl_hn = gsm0503_pdtch_hl_hn_ubit[0]; break; case 34: osmo_pbit2ubit_ext(conv, 3, l2_data, 0, 271, 1); usf = l2_data[0] & 0x7; osmo_crc16gen_set_bits(&gsm0503_cs234_crc16, conv + 3, 271, conv + 3 + 271); memcpy(conv, gsm0503_usf2six[usf], 6); osmo_conv_encode(&gsm0503_cs2, conv, cB); for (i = 0, j = 0; i < 588; i++) if (!gsm0503_puncture_cs2[i]) cB[j++] = cB[i]; hl_hn = gsm0503_pdtch_hl_hn_ubit[1]; break; case 40: osmo_pbit2ubit_ext(conv, 3, l2_data, 0, 315, 1); usf = l2_data[0] & 0x7; osmo_crc16gen_set_bits(&gsm0503_cs234_crc16, conv + 3, 315, conv + 3 + 315); memcpy(conv, gsm0503_usf2six[usf], 6); osmo_conv_encode(&gsm0503_cs3, conv, cB); for (i = 0, j = 0; i < 676; i++) if (!gsm0503_puncture_cs3[i]) cB[j++] = cB[i]; hl_hn = gsm0503_pdtch_hl_hn_ubit[2]; break; case 54: osmo_pbit2ubit_ext(cB, 9, l2_data, 0, 431, 1); usf = l2_data[0] & 0x7; osmo_crc16gen_set_bits(&gsm0503_cs234_crc16, cB + 9, 431, cB + 9 + 431); memcpy(cB, gsm0503_usf2twelve_ubit[usf], 12); hl_hn = gsm0503_pdtch_hl_hn_ubit[3]; break; default: return -1; } gsm0503_xcch_interleave(cB, iB); for (i = 0; i < 4; i++) { gsm0503_xcch_burst_map(&iB[i * 114], &bursts[i * 116], hl_hn + i * 2, hl_hn + i * 2 + 1); } return GSM0503_GPRS_BURSTS_NBITS; } /* * GSM TCH/F FR/EFR transcoding */ static void tch_fr_reassemble(uint8_t *tch_data, ubit_t *b_bits, int net_order) { int i, j, k, l, o; tch_data[0] = 0xd << 4; memset(tch_data + 1, 0, 32); if (net_order) { for (i = 0, j = 4; i < 260; i++, j++) tch_data[j >> 3] |= (b_bits[i] << (7 - (j & 7))); return; } /* reassemble d-bits */ i = 0; /* counts bits */ j = 4; /* counts output bits */ k = gsm0503_gsm_fr_map[0]-1; /* current number bit in element */ l = 0; /* counts element bits */ o = 0; /* offset input bits */ while (i < 260) { tch_data[j >> 3] |= (b_bits[k + o] << (7 - (j & 7))); if (--k < 0) { o += gsm0503_gsm_fr_map[l]; k = gsm0503_gsm_fr_map[++l]-1; } i++; j++; } } static void tch_fr_disassemble(ubit_t *b_bits, uint8_t *tch_data, int net_order) { int i, j, k, l, o; if (net_order) { for (i = 0, j = 4; i < 260; i++, j++) b_bits[i] = (tch_data[j >> 3] >> (7 - (j & 7))) & 1; return; } i = 0; /* counts bits */ j = 4; /* counts input bits */ k = gsm0503_gsm_fr_map[0] - 1; /* current number bit in element */ l = 0; /* counts element bits */ o = 0; /* offset output bits */ while (i < 260) { b_bits[k + o] = (tch_data[j >> 3] >> (7 - (j & 7))) & 1; if (--k < 0) { o += gsm0503_gsm_fr_map[l]; k = gsm0503_gsm_fr_map[++l] - 1; } i++; j++; } } static void tch_hr_reassemble(uint8_t *tch_data, ubit_t *b_bits) { int i, j; tch_data[0] = 0x00; /* F = 0, FT = 000 */ memset(tch_data + 1, 0, 14); for (i = 0, j = 8; i < 112; i++, j++) tch_data[j >> 3] |= (b_bits[i] << (7 - (j & 7))); } static void tch_hr_disassemble(ubit_t *b_bits, uint8_t *tch_data) { int i, j; for (i = 0, j = 8; i < 112; i++, j++) b_bits[i] = (tch_data[j >> 3] >> (7 - (j & 7))) & 1; } static void tch_efr_reassemble(uint8_t *tch_data, ubit_t *b_bits) { int i, j; tch_data[0] = 0xc << 4; memset(tch_data + 1, 0, 30); for (i = 0, j = 4; i < 244; i++, j++) tch_data[j >> 3] |= (b_bits[i] << (7 - (j & 7))); } static void tch_efr_disassemble(ubit_t *b_bits, uint8_t *tch_data) { int i, j; for (i = 0, j = 4; i < 244; i++, j++) b_bits[i] = (tch_data[j >> 3] >> (7 - (j & 7))) & 1; } static void tch_amr_reassemble(uint8_t *tch_data, ubit_t *d_bits, int len) { int i, j; memset(tch_data, 0, (len + 7) >> 3); for (i = 0, j = 0; i < len; i++, j++) tch_data[j >> 3] |= (d_bits[i] << (7 - (j & 7))); } static void tch_amr_disassemble(ubit_t *d_bits, uint8_t *tch_data, int len) { int i, j; for (i = 0, j = 0; i < len; i++, j++) d_bits[i] = (tch_data[j >> 3] >> (7 - (j & 7))) & 1; } static void tch_fr_d_to_b(ubit_t *b_bits, ubit_t *d_bits) { int i; for (i = 0; i < 260; i++) b_bits[gsm610_bitorder[i]] = d_bits[i]; } static void tch_fr_b_to_d(ubit_t *d_bits, ubit_t *b_bits) { int i; for (i = 0; i < 260; i++) d_bits[i] = b_bits[gsm610_bitorder[i]]; } static void tch_hr_d_to_b(ubit_t *b_bits, ubit_t *d_bits) { int i; const uint16_t *map; if (!d_bits[93] && !d_bits[94]) map = gsm620_unvoiced_bitorder; else map = gsm620_voiced_bitorder; for (i = 0; i < 112; i++) b_bits[map[i]] = d_bits[i]; } static void tch_hr_b_to_d(ubit_t *d_bits, ubit_t *b_bits) { int i; const uint16_t *map; if (!b_bits[34] && !b_bits[35]) map = gsm620_unvoiced_bitorder; else map = gsm620_voiced_bitorder; for (i = 0; i < 112; i++) d_bits[i] = b_bits[map[i]]; } static void tch_efr_d_to_w(ubit_t *b_bits, ubit_t *d_bits) { int i; for (i = 0; i < 260; i++) b_bits[gsm660_bitorder[i]] = d_bits[i]; } static void tch_efr_w_to_d(ubit_t *d_bits, ubit_t *b_bits) { int i; for (i = 0; i < 260; i++) d_bits[i] = b_bits[gsm660_bitorder[i]]; } static void tch_efr_protected(ubit_t *s_bits, ubit_t *b_bits) { int i; for (i = 0; i < 65; i++) b_bits[i] = s_bits[gsm0503_gsm_efr_protected_bits[i] - 1]; } static void tch_fr_unreorder(ubit_t *d, ubit_t *p, ubit_t *u) { int i; for (i = 0; i < 91; i++) { d[i << 1] = u[i]; d[(i << 1) + 1] = u[184 - i]; } for (i = 0; i < 3; i++) p[i] = u[91 + i]; } static void tch_fr_reorder(ubit_t *u, ubit_t *d, ubit_t *p) { int i; for (i = 0; i < 91; i++) { u[i] = d[i << 1]; u[184 - i] = d[(i << 1) + 1]; } for (i = 0; i < 3; i++) u[91 + i] = p[i]; } static void tch_hr_unreorder(ubit_t *d, ubit_t *p, ubit_t *u) { memcpy(d, u, 95); memcpy(p, u + 95, 3); } static void tch_hr_reorder(ubit_t *u, ubit_t *d, ubit_t *p) { memcpy(u, d, 95); memcpy(u + 95, p, 3); } static void tch_efr_reorder(ubit_t *w, ubit_t *s, ubit_t *p) { memcpy(w, s, 71); w[71] = w[72] = s[69]; memcpy(w + 73, s + 71, 50); w[123] = w[124] = s[119]; memcpy(w + 125, s + 121, 53); w[178] = w[179] = s[172]; memcpy(w + 180, s + 174, 50); w[230] = w[231] = s[222]; memcpy(w + 232, s + 224, 20); memcpy(w + 252, p, 8); } static void tch_efr_unreorder(ubit_t *s, ubit_t *p, ubit_t *w) { int sum; memcpy(s, w, 71); sum = s[69] + w[71] + w[72]; s[69] = (sum > 2); memcpy(s + 71, w + 73, 50); sum = s[119] + w[123] + w[124]; s[119] = (sum > 2); memcpy(s + 121, w + 125, 53); sum = s[172] + w[178] + w[179]; s[172] = (sum > 2); memcpy(s + 174, w + 180, 50); sum = s[220] + w[230] + w[231]; s[222] = (sum > 2); memcpy(s + 224, w + 232, 20); memcpy(p, w + 252, 8); } static void tch_amr_merge(ubit_t *u, ubit_t *d, ubit_t *p, int len, int prot) { memcpy(u, d, prot); memcpy(u + prot, p, 6); memcpy(u + prot + 6, d + prot, len - prot); } static void tch_amr_unmerge(ubit_t *d, ubit_t *p, ubit_t *u, int len, int prot) { memcpy(d, u, prot); memcpy(p, u+prot, 6); memcpy(d + prot, u + prot + 6, len - prot); } int gsm0503_tch_fr_decode(uint8_t *tch_data, sbit_t *bursts, int net_order, int efr, int *n_errors, int *n_bits_total) { sbit_t iB[912], cB[456], h; ubit_t conv[185], s[244], w[260], b[65], d[260], p[8]; int i, rv, len, steal = 0; for (i=0; i<8; i++) { gsm0503_tch_burst_unmap(&iB[i * 114], &bursts[i * 116], &h, i >> 2); steal -= h; } gsm0503_tch_fr_deinterleave(cB, iB); if (steal > 0) { rv = _xcch_decode_cB(tch_data, cB, n_errors, n_bits_total); if (rv) { /* Error decoding FACCH frame */ return -1; } return 23; } osmo_conv_decode_ber(&gsm0503_tch_fr, cB, conv, n_errors, n_bits_total); tch_fr_unreorder(d, p, conv); for (i = 0; i < 78; i++) d[i + 182] = (cB[i + 378] < 0) ? 1 : 0; rv = osmo_crc8gen_check_bits(&gsm0503_tch_fr_crc3, d, 50, p); if (rv) { /* Error checking CRC8 for the FR part of an EFR/FR frame */ return -1; } if (efr) { tch_efr_d_to_w(w, d); tch_efr_unreorder(s, p, w); tch_efr_protected(s, b); rv = osmo_crc8gen_check_bits(&gsm0503_tch_efr_crc8, b, 65, p); if (rv) { /* Error checking CRC8 for the EFR part of an EFR frame */ return -1; } tch_efr_reassemble(tch_data, s); len = GSM_EFR_BYTES; } else { tch_fr_d_to_b(w, d); tch_fr_reassemble(tch_data, w, net_order); len = GSM_FR_BYTES; } return len; } int gsm0503_tch_fr_encode(ubit_t *bursts, uint8_t *tch_data, int len, int net_order) { ubit_t iB[912], cB[456], h; ubit_t conv[185], w[260], b[65], s[244], d[260], p[8]; int i; switch (len) { case GSM_EFR_BYTES: /* TCH EFR */ tch_efr_disassemble(s, tch_data); tch_efr_protected(s, b); osmo_crc8gen_set_bits(&gsm0503_tch_efr_crc8, b, 65, p); tch_efr_reorder(w, s, p); tch_efr_w_to_d(d, w); goto coding_efr_fr; case GSM_FR_BYTES: /* TCH FR */ tch_fr_disassemble(w, tch_data, net_order); tch_fr_b_to_d(d, w); coding_efr_fr: osmo_crc8gen_set_bits(&gsm0503_tch_fr_crc3, d, 50, p); tch_fr_reorder(conv, d, p); memcpy(cB + 378, d + 182, 78); osmo_conv_encode(&gsm0503_tch_fr, conv, cB); h = 0; break; case GSM_MACBLOCK_LEN: /* FACCH */ _xcch_encode_cB(cB, tch_data); h = 1; break; default: return -1; } gsm0503_tch_fr_interleave(cB, iB); for (i = 0; i < 8; i++) { gsm0503_tch_burst_map(&iB[i * 114], &bursts[i * 116], &h, i >> 2); } return 0; } int gsm0503_tch_hr_decode(uint8_t *tch_data, sbit_t *bursts, int odd, int *n_errors, int *n_bits_total) { sbit_t iB[912], cB[456], h; ubit_t conv[98], b[112], d[112], p[3]; int i, rv, steal = 0; /* Only unmap the stealing bits */ if (!odd) { for (i = 0; i < 4; i++) { gsm0503_tch_burst_unmap(NULL, &bursts[i * 116], &h, 0); steal -= h; } for (i = 2; i < 5; i++) { gsm0503_tch_burst_unmap(NULL, &bursts[i * 116], &h, 1); steal -= h; } } /* If we found a stole FACCH, but only at correct alignment */ if (steal > 0) { for (i = 0; i < 6; i++) { gsm0503_tch_burst_unmap(&iB[i * 114], &bursts[i * 116], NULL, i >> 2); } for (i = 2; i < 4; i++) { gsm0503_tch_burst_unmap(&iB[i * 114 + 456], &bursts[i * 116], NULL, 1); } gsm0503_tch_fr_deinterleave(cB, iB); rv = _xcch_decode_cB(tch_data, cB, n_errors, n_bits_total); if (rv) { /* Error decoding FACCH frame */ return -1; } return GSM_MACBLOCK_LEN; } for (i = 0; i < 4; i++) { gsm0503_tch_burst_unmap(&iB[i * 114], &bursts[i * 116], NULL, i >> 1); } gsm0503_tch_hr_deinterleave(cB, iB); osmo_conv_decode_ber(&gsm0503_tch_hr, cB, conv, n_errors, n_bits_total); tch_hr_unreorder(d, p, conv); for (i = 0; i < 17; i++) d[i + 95] = (cB[i + 211] < 0) ? 1 : 0; rv = osmo_crc8gen_check_bits(&gsm0503_tch_fr_crc3, d + 73, 22, p); if (rv) { /* Error checking CRC8 for an HR frame */ return -1; } tch_hr_d_to_b(b, d); tch_hr_reassemble(tch_data, b); return 15; } int gsm0503_tch_hr_encode(ubit_t *bursts, uint8_t *tch_data, int len) { ubit_t iB[912], cB[456], h; ubit_t conv[98], b[112], d[112], p[3]; int i; switch (len) { case 15: /* TCH HR */ tch_hr_disassemble(b, tch_data); tch_hr_b_to_d(d, b); osmo_crc8gen_set_bits(&gsm0503_tch_fr_crc3, d + 73, 22, p); tch_hr_reorder(conv, d, p); osmo_conv_encode(&gsm0503_tch_hr, conv, cB); memcpy(cB + 211, d + 95, 17); h = 0; gsm0503_tch_hr_interleave(cB, iB); for (i = 0; i < 4; i++) { gsm0503_tch_burst_map(&iB[i * 114], &bursts[i * 116], &h, i >> 1); } break; case GSM_MACBLOCK_LEN: /* FACCH */ _xcch_encode_cB(cB, tch_data); h = 1; gsm0503_tch_fr_interleave(cB, iB); for (i=0; i<6; i++) { gsm0503_tch_burst_map(&iB[i * 114], &bursts[i * 116], &h, i >> 2); } for (i=2; i<4; i++) { gsm0503_tch_burst_map(&iB[i * 114 + 456], &bursts[i * 116], &h, 1); } break; default: return -1; } return 0; } int gsm0503_tch_afs_decode(uint8_t *tch_data, sbit_t *bursts, int codec_mode_req, uint8_t *codec, int codecs, uint8_t *ft, uint8_t *cmr, int *n_errors, int *n_bits_total) { sbit_t iB[912], cB[456], h; ubit_t d[244], p[6], conv[250]; int i, j, k, best = 0, rv, len, steal = 0, id = 0; *n_errors = 0; *n_bits_total = 0; for (i=0; i<8; i++) { gsm0503_tch_burst_unmap(&iB[i * 114], &bursts[i * 116], &h, i >> 2); steal -= h; } gsm0503_tch_fr_deinterleave(cB, iB); if (steal > 0) { rv = _xcch_decode_cB(tch_data, cB, n_errors, n_bits_total); if (rv) { /* Error decoding FACCH frame */ return -1; } return GSM_MACBLOCK_LEN; } for (i = 0; i < 4; i++) { for (j = 0, k = 0; j < 8; j++) k += abs(((int)gsm0503_afs_ic_sbit[i][j]) - ((int)cB[j])); if (i == 0 || k < best) { best = k; id = i; } } /* Check if indicated codec fits into range of codecs */ if (id >= codecs) { /* Codec mode out of range, return id */ return id; } switch ((codec_mode_req) ? codec[*ft] : codec[id]) { case 7: /* TCH/AFS12.2 */ osmo_conv_decode_ber(&gsm0503_tch_afs_12_2, cB + 8, conv, n_errors, n_bits_total); tch_amr_unmerge(d, p, conv, 244, 81); rv = osmo_crc8gen_check_bits(&gsm0503_amr_crc6, d, 81, p); if (rv) { /* Error checking CRC8 for an AMR 12.2 frame */ return -1; } tch_amr_reassemble(tch_data, d, 244); len = 31; break; case 6: /* TCH/AFS10.2 */ osmo_conv_decode_ber(&gsm0503_tch_afs_10_2, cB + 8, conv, n_errors, n_bits_total); tch_amr_unmerge(d, p, conv, 204, 65); rv = osmo_crc8gen_check_bits(&gsm0503_amr_crc6, d, 65, p); if (rv) { /* Error checking CRC8 for an AMR 10.2 frame */ return -1; } tch_amr_reassemble(tch_data, d, 204); len = 26; break; case 5: /* TCH/AFS7.95 */ osmo_conv_decode_ber(&gsm0503_tch_afs_7_95, cB + 8, conv, n_errors, n_bits_total); tch_amr_unmerge(d, p, conv, 159, 75); rv = osmo_crc8gen_check_bits(&gsm0503_amr_crc6, d, 75, p); if (rv) { /* Error checking CRC8 for an AMR 7.95 frame */ return -1; } tch_amr_reassemble(tch_data, d, 159); len = 20; break; case 4: /* TCH/AFS7.4 */ osmo_conv_decode_ber(&gsm0503_tch_afs_7_4, cB + 8, conv, n_errors, n_bits_total); tch_amr_unmerge(d, p, conv, 148, 61); rv = osmo_crc8gen_check_bits(&gsm0503_amr_crc6, d, 61, p); if (rv) { /* Error checking CRC8 for an AMR 7.4 frame */ return -1; } tch_amr_reassemble(tch_data, d, 148); len = 19; break; case 3: /* TCH/AFS6.7 */ osmo_conv_decode_ber(&gsm0503_tch_afs_6_7, cB + 8, conv, n_errors, n_bits_total); tch_amr_unmerge(d, p, conv, 134, 55); rv = osmo_crc8gen_check_bits(&gsm0503_amr_crc6, d, 55, p); if (rv) { /* Error checking CRC8 for an AMR 6.7 frame */ return -1; } tch_amr_reassemble(tch_data, d, 134); len = 17; break; case 2: /* TCH/AFS5.9 */ osmo_conv_decode_ber(&gsm0503_tch_afs_5_9, cB + 8, conv, n_errors, n_bits_total); tch_amr_unmerge(d, p, conv, 118, 55); rv = osmo_crc8gen_check_bits(&gsm0503_amr_crc6, d, 55, p); if (rv) { /* Error checking CRC8 for an AMR 5.9 frame */ return -1; } tch_amr_reassemble(tch_data, d, 118); len = 15; break; case 1: /* TCH/AFS5.15 */ osmo_conv_decode_ber(&gsm0503_tch_afs_5_15, cB + 8, conv, n_errors, n_bits_total); tch_amr_unmerge(d, p, conv, 103, 49); rv = osmo_crc8gen_check_bits(&gsm0503_amr_crc6, d, 49, p); if (rv) { /* Error checking CRC8 for an AMR 5.15 frame */ return -1; } tch_amr_reassemble(tch_data, d, 103); len = 13; break; case 0: /* TCH/AFS4.75 */ osmo_conv_decode_ber(&gsm0503_tch_afs_4_75, cB + 8, conv, n_errors, n_bits_total); tch_amr_unmerge(d, p, conv, 95, 39); rv = osmo_crc8gen_check_bits(&gsm0503_amr_crc6, d, 39, p); if (rv) { /* Error checking CRC8 for an AMR 4.75 frame */ return -1; } tch_amr_reassemble(tch_data, d, 95); len = 12; break; default: /* Unknown frame type */ *n_bits_total = 448; *n_errors = *n_bits_total; return -1; } /* Change codec request / indication, if frame is valid */ if (codec_mode_req) *cmr = id; else *ft = id; return len; } int gsm0503_tch_afs_encode(ubit_t *bursts, uint8_t *tch_data, int len, int codec_mode_req, uint8_t *codec, int codecs, uint8_t ft, uint8_t cmr) { ubit_t iB[912], cB[456], h; ubit_t d[244], p[6], conv[250]; int i; uint8_t id; if (len == GSM_MACBLOCK_LEN) { /* FACCH */ _xcch_encode_cB(cB, tch_data); h = 1; goto facch; } h = 0; if (codec_mode_req) { if (cmr >= codecs) { /* FIXME: CMR ID is not in codec list! */ return -1; } id = cmr; } else { if (ft >= codecs) { /* FIXME: FT ID is not in codec list! */ return -1; } id = ft; } switch (codec[ft]) { case 7: /* TCH/AFS12.2 */ if (len != 31) goto invalid_length; tch_amr_disassemble(d, tch_data, 244); osmo_crc8gen_set_bits(&gsm0503_amr_crc6, d, 81, p); tch_amr_merge(conv, d, p, 244, 81); osmo_conv_encode(&gsm0503_tch_afs_12_2, conv, cB + 8); break; case 6: /* TCH/AFS10.2 */ if (len != 26) goto invalid_length; tch_amr_disassemble(d, tch_data, 204); osmo_crc8gen_set_bits(&gsm0503_amr_crc6, d, 65, p); tch_amr_merge(conv, d, p, 204, 65); osmo_conv_encode(&gsm0503_tch_afs_10_2, conv, cB + 8); break; case 5: /* TCH/AFS7.95 */ if (len != 20) goto invalid_length; tch_amr_disassemble(d, tch_data, 159); osmo_crc8gen_set_bits(&gsm0503_amr_crc6, d, 75, p); tch_amr_merge(conv, d, p, 159, 75); osmo_conv_encode(&gsm0503_tch_afs_7_95, conv, cB + 8); break; case 4: /* TCH/AFS7.4 */ if (len != 19) goto invalid_length; tch_amr_disassemble(d, tch_data, 148); osmo_crc8gen_set_bits(&gsm0503_amr_crc6, d, 61, p); tch_amr_merge(conv, d, p, 148, 61); osmo_conv_encode(&gsm0503_tch_afs_7_4, conv, cB + 8); break; case 3: /* TCH/AFS6.7 */ if (len != 17) goto invalid_length; tch_amr_disassemble(d, tch_data, 134); osmo_crc8gen_set_bits(&gsm0503_amr_crc6, d, 55, p); tch_amr_merge(conv, d, p, 134, 55); osmo_conv_encode(&gsm0503_tch_afs_6_7, conv, cB + 8); break; case 2: /* TCH/AFS5.9 */ if (len != 15) goto invalid_length; tch_amr_disassemble(d, tch_data, 118); osmo_crc8gen_set_bits(&gsm0503_amr_crc6, d, 55, p); tch_amr_merge(conv, d, p, 118, 55); osmo_conv_encode(&gsm0503_tch_afs_5_9, conv, cB + 8); break; case 1: /* TCH/AFS5.15 */ if (len != 13) goto invalid_length; tch_amr_disassemble(d, tch_data, 103); osmo_crc8gen_set_bits(&gsm0503_amr_crc6, d, 49, p); tch_amr_merge(conv, d, p, 103, 49); osmo_conv_encode(&gsm0503_tch_afs_5_15, conv, cB + 8); break; case 0: /* TCH/AFS4.75 */ if (len != 12) goto invalid_length; tch_amr_disassemble(d, tch_data, 95); osmo_crc8gen_set_bits(&gsm0503_amr_crc6, d, 39, p); tch_amr_merge(conv, d, p, 95, 39); osmo_conv_encode(&gsm0503_tch_afs_4_75, conv, cB + 8); break; default: /* FIXME: FT %ft is not supported */ return -1; } memcpy(cB, gsm0503_afs_ic_ubit[id], 8); facch: gsm0503_tch_fr_interleave(cB, iB); for (i = 0; i < 8; i++) { gsm0503_tch_burst_map(&iB[i * 114], &bursts[i * 116], &h, i >> 2); } return 0; invalid_length: /* FIXME: payload length %len does not comply with codec type %ft */ return -1; } int gsm0503_tch_ahs_decode(uint8_t *tch_data, sbit_t *bursts, int odd, int codec_mode_req, uint8_t *codec, int codecs, uint8_t *ft, uint8_t *cmr, int *n_errors, int *n_bits_total) { sbit_t iB[912], cB[456], h; ubit_t d[244], p[6], conv[135]; int i, j, k, best = 0, rv, len, steal = 0, id = 0; /* only unmap the stealing bits */ if (!odd) { for (i = 0; i < 4; i++) { gsm0503_tch_burst_unmap(NULL, &bursts[i * 116], &h, 0); steal -= h; } for (i = 2; i < 5; i++) { gsm0503_tch_burst_unmap(NULL, &bursts[i * 116], &h, 1); steal -= h; } } /* if we found a stole FACCH, but only at correct alignment */ if (steal > 0) { for (i = 0; i < 6; i++) { gsm0503_tch_burst_unmap(&iB[i * 114], &bursts[i * 116], NULL, i >> 2); } for (i = 2; i < 4; i++) { gsm0503_tch_burst_unmap(&iB[i * 114 + 456], &bursts[i * 116], NULL, 1); } gsm0503_tch_fr_deinterleave(cB, iB); rv = _xcch_decode_cB(tch_data, cB, n_errors, n_bits_total); if (rv) { /* Error decoding FACCH frame */ return -1; } return GSM_MACBLOCK_LEN; } for (i = 0; i < 4; i++) { gsm0503_tch_burst_unmap(&iB[i * 114], &bursts[i * 116], NULL, i >> 1); } gsm0503_tch_hr_deinterleave(cB, iB); for (i = 0; i < 4; i++) { for (j = 0, k = 0; j < 4; j++) k += abs(((int)gsm0503_ahs_ic_sbit[i][j]) - ((int)cB[j])); if (i == 0 || k < best) { best = k; id = i; } } /* Check if indicated codec fits into range of codecs */ if (id >= codecs) { /* Codec mode out of range, return id */ return id; } switch ((codec_mode_req) ? codec[*ft] : codec[id]) { case 5: /* TCH/AHS7.95 */ osmo_conv_decode_ber(&gsm0503_tch_ahs_7_95, cB + 4, conv, n_errors, n_bits_total); tch_amr_unmerge(d, p, conv, 123, 67); rv = osmo_crc8gen_check_bits(&gsm0503_amr_crc6, d, 67, p); if (rv) { /* Error checking CRC8 for an AMR 7.95 frame */ return -1; } for (i = 0; i < 36; i++) d[i + 123] = (cB[i + 192] < 0) ? 1 : 0; tch_amr_reassemble(tch_data, d, 159); len = 20; break; case 4: /* TCH/AHS7.4 */ osmo_conv_decode_ber(&gsm0503_tch_ahs_7_4, cB + 4, conv, n_errors, n_bits_total); tch_amr_unmerge(d, p, conv, 120, 61); rv = osmo_crc8gen_check_bits(&gsm0503_amr_crc6, d, 61, p); if (rv) { /* Error checking CRC8 for an AMR 7.4 frame */ return -1; } for (i = 0; i < 28; i++) d[i + 120] = (cB[i + 200] < 0) ? 1 : 0; tch_amr_reassemble(tch_data, d, 148); len = 19; break; case 3: /* TCH/AHS6.7 */ osmo_conv_decode_ber(&gsm0503_tch_ahs_6_7, cB + 4, conv, n_errors, n_bits_total); tch_amr_unmerge(d, p, conv, 110, 55); rv = osmo_crc8gen_check_bits(&gsm0503_amr_crc6, d, 55, p); if (rv) { /* Error checking CRC8 for an AMR 6.7 frame */ return -1; } for (i = 0; i < 24; i++) d[i + 110] = (cB[i + 204] < 0) ? 1 : 0; tch_amr_reassemble(tch_data, d, 134); len = 17; break; case 2: /* TCH/AHS5.9 */ osmo_conv_decode_ber(&gsm0503_tch_ahs_5_9, cB + 4, conv, n_errors, n_bits_total); tch_amr_unmerge(d, p, conv, 102, 55); rv = osmo_crc8gen_check_bits(&gsm0503_amr_crc6, d, 55, p); if (rv) { /* Error checking CRC8 for an AMR 5.9 frame */ return -1; } for (i = 0; i < 16; i++) d[i + 102] = (cB[i + 212] < 0) ? 1 : 0; tch_amr_reassemble(tch_data, d, 118); len = 15; break; case 1: /* TCH/AHS5.15 */ osmo_conv_decode_ber(&gsm0503_tch_ahs_5_15, cB + 4, conv, n_errors, n_bits_total); tch_amr_unmerge(d, p, conv, 91, 49); rv = osmo_crc8gen_check_bits(&gsm0503_amr_crc6, d, 49, p); if (rv) { /* Error checking CRC8 for an AMR 5.15 frame */ return -1; } for (i = 0; i < 12; i++) d[i + 91] = (cB[i + 216] < 0) ? 1 : 0; tch_amr_reassemble(tch_data, d, 103); len = 13; break; case 0: /* TCH/AHS4.75 */ osmo_conv_decode_ber(&gsm0503_tch_ahs_4_75, cB + 4, conv, n_errors, n_bits_total); tch_amr_unmerge(d, p, conv, 83, 39); rv = osmo_crc8gen_check_bits(&gsm0503_amr_crc6, d, 39, p); if (rv) { /* Error checking CRC8 for an AMR 4.75 frame */ return -1; } for (i = 0; i < 12; i++) d[i + 83] = (cB[i + 216] < 0) ? 1 : 0; tch_amr_reassemble(tch_data, d, 95); len = 12; break; default: /* Unknown frame type */ *n_bits_total = 159; *n_errors = *n_bits_total; return -1; } /* Change codec request / indication, if frame is valid */ if (codec_mode_req) *cmr = id; else *ft = id; return len; } int gsm0503_tch_ahs_encode(ubit_t *bursts, uint8_t *tch_data, int len, int codec_mode_req, uint8_t *codec, int codecs, uint8_t ft, uint8_t cmr) { ubit_t iB[912], cB[456], h; ubit_t d[244], p[6], conv[135]; int i; uint8_t id; if (len == GSM_MACBLOCK_LEN) { /* FACCH */ _xcch_encode_cB(cB, tch_data); h = 1; gsm0503_tch_fr_interleave(cB, iB); for (i = 0; i < 6; i++) gsm0503_tch_burst_map(&iB[i * 114], &bursts[i * 116], &h, i >> 2); for (i = 2; i < 4; i++) gsm0503_tch_burst_map(&iB[i * 114 + 456], &bursts[i * 116], &h, 1); return 0; } h = 0; if (codec_mode_req) { if (cmr >= codecs) { /* FIXME: CMR ID %d not in codec list */ return -1; } id = cmr; } else { if (ft >= codecs) { /* FIXME: FT ID %d not in codec list */ return -1; } id = ft; } switch (codec[ft]) { case 5: /* TCH/AHS7.95 */ if (len != 20) goto invalid_length; tch_amr_disassemble(d, tch_data, 159); osmo_crc8gen_set_bits(&gsm0503_amr_crc6, d, 67, p); tch_amr_merge(conv, d, p, 123, 67); osmo_conv_encode(&gsm0503_tch_ahs_7_95, conv, cB + 4); memcpy(cB + 192, d + 123, 36); break; case 4: /* TCH/AHS7.4 */ if (len != 19) goto invalid_length; tch_amr_disassemble(d, tch_data, 148); osmo_crc8gen_set_bits(&gsm0503_amr_crc6, d, 61, p); tch_amr_merge(conv, d, p, 120, 61); osmo_conv_encode(&gsm0503_tch_ahs_7_4, conv, cB + 4); memcpy(cB + 200, d + 120, 28); break; case 3: /* TCH/AHS6.7 */ if (len != 17) goto invalid_length; tch_amr_disassemble(d, tch_data, 134); osmo_crc8gen_set_bits(&gsm0503_amr_crc6, d, 55, p); tch_amr_merge(conv, d, p, 110, 55); osmo_conv_encode(&gsm0503_tch_ahs_6_7, conv, cB + 4); memcpy(cB + 204, d + 110, 24); break; case 2: /* TCH/AHS5.9 */ if (len != 15) goto invalid_length; tch_amr_disassemble(d, tch_data, 118); osmo_crc8gen_set_bits(&gsm0503_amr_crc6, d, 55, p); tch_amr_merge(conv, d, p, 102, 55); osmo_conv_encode(&gsm0503_tch_ahs_5_9, conv, cB + 4); memcpy(cB + 212, d + 102, 16); break; case 1: /* TCH/AHS5.15 */ if (len != 13) goto invalid_length; tch_amr_disassemble(d, tch_data, 103); osmo_crc8gen_set_bits(&gsm0503_amr_crc6, d, 49, p); tch_amr_merge(conv, d, p, 91, 49); osmo_conv_encode(&gsm0503_tch_ahs_5_15, conv, cB + 4); memcpy(cB + 216, d + 91, 12); break; case 0: /* TCH/AHS4.75 */ if (len != 12) goto invalid_length; tch_amr_disassemble(d, tch_data, 95); osmo_crc8gen_set_bits(&gsm0503_amr_crc6, d, 39, p); tch_amr_merge(conv, d, p, 83, 39); osmo_conv_encode(&gsm0503_tch_ahs_4_75, conv, cB + 4); memcpy(cB + 216, d + 83, 12); break; default: /* FIXME: FT %ft is not supported */ return -1; } memcpy(cB, gsm0503_afs_ic_ubit[id], 4); gsm0503_tch_hr_interleave(cB, iB); for (i = 0; i < 4; i++) gsm0503_tch_burst_map(&iB[i * 114], &bursts[i * 116], &h, i >> 1); return 0; invalid_length: /* FIXME: payload length %len does not comply with codec type %ft */ return -1; } /* * GSM RACH transcoding */ /* * GSM RACH apply BSIC to parity * * p(j) = p(j) xor b(j) j = 0, ..., 5 * b(0) = MSB of PLMN colour code * b(5) = LSB of BS colour code */ static int rach_apply_bsic(ubit_t *d, uint8_t bsic) { int i; /* Apply it */ for (i = 0; i < 6; i++) d[8 + i] ^= ((bsic >> (5 - i)) & 1); return 0; } int gsm0503_rach_decode(uint8_t *ra, sbit_t *burst, uint8_t bsic) { ubit_t conv[14]; int rv; osmo_conv_decode(&gsm0503_rach, burst, conv); rach_apply_bsic(conv, bsic); rv = osmo_crc8gen_check_bits(&gsm0503_rach_crc6, conv, 8, conv + 8); if (rv) return -1; osmo_ubit2pbit_ext(ra, 0, conv, 0, 8, 1); return 0; } int gsm0503_rach_encode(ubit_t *burst, uint8_t *ra, uint8_t bsic) { ubit_t conv[14]; osmo_pbit2ubit_ext(conv, 0, ra, 0, 8, 1); osmo_crc8gen_set_bits(&gsm0503_rach_crc6, conv, 8, conv + 8); rach_apply_bsic(conv, bsic); osmo_conv_encode(&gsm0503_rach, conv, burst); return 0; } /* * GSM SCH transcoding */ int gsm0503_sch_decode(uint8_t *sb_info, sbit_t *burst) { ubit_t conv[35]; int rv; osmo_conv_decode(&gsm0503_sch, burst, conv); rv = osmo_crc16gen_check_bits(&gsm0503_sch_crc10, conv, 25, conv + 25); if (rv) return -1; osmo_ubit2pbit_ext(sb_info, 0, conv, 0, 25, 1); return 0; } int gsm0503_sch_encode(ubit_t *burst, uint8_t *sb_info) { ubit_t conv[35]; osmo_pbit2ubit_ext(conv, 0, sb_info, 0, 25, 1); osmo_crc16gen_set_bits(&gsm0503_sch_crc10, conv, 25, conv + 25); osmo_conv_encode(&gsm0503_sch, conv, burst); return 0; } gr-gsm-0.41.2/lib/decoding/osmocom/coding/gsm0503_coding.h000066400000000000000000000052741316153413000230320ustar00rootroot00000000000000/* * (C) 2013 by Andreas Eversberg * (C) 2015 by Alexander Chemeris * (C) 2016 by Tom Tsou * * All Rights Reserved * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #pragma once #include #include #define GSM0503_GPRS_BURSTS_NBITS (116 * 4) #define GSM0503_EGPRS_BURSTS_NBITS (348 * 4) #define NUM_BYTES(N) ((N + 8 - 1) / 8) int gsm0503_xcch_encode(ubit_t *bursts, uint8_t *l2_data); int gsm0503_xcch_decode(uint8_t *l2_data, sbit_t *bursts, int *n_errors, int *n_bits_total); int gsm0503_pdtch_encode(ubit_t *bursts, uint8_t *l2_data, uint8_t l2_len); int gsm0503_pdtch_decode(uint8_t *l2_data, sbit_t *bursts, uint8_t *usf_p, int *n_errors, int *n_bits_total); int gsm0503_tch_fr_encode(ubit_t *bursts, uint8_t *tch_data, int len, int net_order); int gsm0503_tch_fr_decode(uint8_t *tch_data, sbit_t *bursts, int net_order, int efr, int *n_errors, int *n_bits_total); int gsm0503_tch_hr_encode(ubit_t *bursts, uint8_t *tch_data, int len); int gsm0503_tch_hr_decode(uint8_t *tch_data, sbit_t *bursts, int odd, int *n_errors, int *n_bits_total); int gsm0503_tch_afs_encode(ubit_t *bursts, uint8_t *tch_data, int len, int codec_mode_req, uint8_t *codec, int codecs, uint8_t ft, uint8_t cmr); int gsm0503_tch_afs_decode(uint8_t *tch_data, sbit_t *bursts, int codec_mode_req, uint8_t *codec, int codecs, uint8_t *ft, uint8_t *cmr, int *n_errors, int *n_bits_total); int gsm0503_tch_ahs_encode(ubit_t *bursts, uint8_t *tch_data, int len, int codec_mode_req, uint8_t *codec, int codecs, uint8_t ft, uint8_t cmr); int gsm0503_tch_ahs_decode(uint8_t *tch_data, sbit_t *bursts, int odd, int codec_mode_req, uint8_t *codec, int codecs, uint8_t *ft, uint8_t *cmr, int *n_errors, int *n_bits_total); int gsm0503_rach_encode(ubit_t *burst, uint8_t *ra, uint8_t bsic); int gsm0503_rach_decode(uint8_t *ra, sbit_t *burst, uint8_t bsic); int gsm0503_sch_encode(ubit_t *burst, uint8_t *sb_info); int gsm0503_sch_decode(uint8_t *sb_info, sbit_t *burst); gr-gsm-0.41.2/lib/decoding/osmocom/coding/gsm0503_conv.c000066400000000000000000002103661316153413000225270ustar00rootroot00000000000000/* * Copyright (C) 2011-2016 Sylvain Munaut * Copyright (C) 2016 sysmocom s.f.m.c. GmbH * * All Rights Reserved * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include #include static const uint8_t xcch_state[][2] = { { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, }; static const uint8_t xcch_output[][2] = { { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 3, 0 }, { 2, 1 }, { 3, 0 }, { 2, 1 }, { 3, 0 }, { 2, 1 }, { 3, 0 }, { 2, 1 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, }; /** * xCCH convolutional code: * 228 bits blocks, rate 1/2, k = 5 * G0 = 1 + D3 + D4 * G1 = 1 + D + D3 + D4 */ const struct osmo_conv_code gsm0503_xcch = { .N = 2, .K = 5, .len = 224, .next_output = xcch_output, .next_state = xcch_state, }; static const uint8_t rach_state[][2] = { { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, }; static const uint8_t rach_output[][2] = { { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 3, 0 }, { 2, 1 }, { 3, 0 }, { 2, 1 }, { 3, 0 }, { 2, 1 }, { 3, 0 }, { 2, 1 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, }; /** * RACH convolutional code */ const struct osmo_conv_code gsm0503_rach = { .N = 2, .K = 5, .len = 14, .next_output = rach_output, .next_state = rach_state, }; static const uint8_t sch_state[][2] = { { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, }; static const uint8_t sch_output[][2] = { { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 3, 0 }, { 2, 1 }, { 3, 0 }, { 2, 1 }, { 3, 0 }, { 2, 1 }, { 3, 0 }, { 2, 1 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, }; /** * SCH convolutional code */ const struct osmo_conv_code gsm0503_sch = { .N = 2, .K = 5, .len = 35, .next_output = sch_output, .next_state = sch_state, }; static const uint8_t cs2_state[][2] = { { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, }; static const uint8_t cs2_output[][2] = { { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 3, 0 }, { 2, 1 }, { 3, 0 }, { 2, 1 }, { 3, 0 }, { 2, 1 }, { 3, 0 }, { 2, 1 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, }; static const int cs2_puncture[] = { 15, 19, 23, 27, 31, 35, 43, 47, 51, 55, 59, 63, 67, 71, 75, 79, 83, 91, 95, 99, 103, 107, 111, 115, 119, 123, 127, 131, 139, 143, 147, 151, 155, 159, 163, 167, 171, 175, 179, 187, 191, 195, 199, 203, 207, 211, 215, 219, 223, 227, 235, 239, 243, 247, 251, 255, 259, 263, 267, 271, 275, 283, 287, 291, 295, 299, 303, 307, 311, 315, 319, 323, 331, 335, 339, 343, 347, 351, 355, 359, 363, 367, 371, 379, 383, 387, 391, 395, 399, 403, 407, 411, 415, 419, 427, 431, 435, 439, 443, 447, 451, 455, 459, 463, 467, 475, 479, 483, 487, 491, 495, 499, 503, 507, 511, 515, 523, 527, 531, 535, 539, 543, 547, 551, 555, 559, 563, 571, 575, 579, 583, 587, -1, }; /** * CS2 convolutional code: * G0 = 1 + D3 + D4 * G1 = 1 + D + D3 + D4 */ const struct osmo_conv_code gsm0503_cs2 = { .N = 2, .K = 5, .len = 290, .next_output = cs2_output, .next_state = cs2_state, .puncture = cs2_puncture, }; static const uint8_t cs3_state[][2] = { { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, }; static const uint8_t cs3_output[][2] = { { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 3, 0 }, { 2, 1 }, { 3, 0 }, { 2, 1 }, { 3, 0 }, { 2, 1 }, { 3, 0 }, { 2, 1 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, }; static const int cs3_puncture[] = { 15, 17, 21, 23, 27, 29, 33, 35, 39, 41, 45, 47, 51, 53, 57, 59, 63, 65, 69, 71, 75, 77, 81, 83, 87, 89, 93, 95, 99, 101, 105, 107, 111, 113, 117, 119, 123, 125, 129, 131, 135, 137, 141, 143, 147, 149, 153, 155, 159, 161, 165, 167, 171, 173, 177, 179, 183, 185, 189, 191, 195, 197, 201, 203, 207, 209, 213, 215, 219, 221, 225, 227, 231, 233, 237, 239, 243, 245, 249, 251, 255, 257, 261, 263, 267, 269, 273, 275, 279, 281, 285, 287, 291, 293, 297, 299, 303, 305, 309, 311, 315, 317, 321, 323, 327, 329, 333, 335, 339, 341, 345, 347, 351, 353, 357, 359, 363, 365, 369, 371, 375, 377, 381, 383, 387, 389, 393, 395, 399, 401, 405, 407, 411, 413, 417, 419, 423, 425, 429, 431, 435, 437, 441, 443, 447, 449, 453, 455, 459, 461, 465, 467, 471, 473, 477, 479, 483, 485, 489, 491, 495, 497, 501, 503, 507, 509, 513, 515, 519, 521, 525, 527, 531, 533, 537, 539, 543, 545, 549, 551, 555, 557, 561, 563, 567, 569, 573, 575, 579, 581, 585, 587, 591, 593, 597, 599, 603, 605, 609, 611, 615, 617, 621, 623, 627, 629, 633, 635, 639, 641, 645, 647, 651, 653, 657, 659, 663, 665, 669, 671, -1, }; /** * CS3 convolutional code: * G0 = 1 + D3 + D4 * G1 = 1 + D + D3 + D4 */ const struct osmo_conv_code gsm0503_cs3 = { .N = 2, .K = 5, .len = 334, .next_output = cs3_output, .next_state = cs3_state, .puncture = cs3_puncture, }; static const uint8_t tch_afs_12_2_state[][2] = { { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 9, 8 }, { 11, 10 }, { 13, 12 }, { 15, 14 }, { 1, 0 }, { 3, 2 }, { 5, 4 }, { 7, 6 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, }; static const uint8_t tch_afs_12_2_output[][2] = { { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, }; static const uint8_t tch_afs_12_2_term_state[] = { 0, 2, 4, 6, 8, 10, 12, 14, 0, 2, 4, 6, 8, 10, 12, 14, }; static const uint8_t tch_afs_12_2_term_output[] = { 0, 1, 0, 1, 3, 2, 3, 2, 3, 2, 3, 2, 0, 1, 0, 1, }; static const int tch_afs_12_2_puncture[] = { 321, 325, 329, 333, 337, 341, 345, 349, 353, 357, 361, 363, 365, 369, 373, 377, 379, 381, 385, 389, 393, 395, 397, 401, 405, 409, 411, 413, 417, 421, 425, 427, 429, 433, 437, 441, 443, 445, 449, 453, 457, 459, 461, 465, 469, 473, 475, 477, 481, 485, 489, 491, 493, 495, 497, 499, 501, 503, 505, 507, -1, }; /** * TCH/AFS 12.2 kbits convolutional code: * 250 bits block, rate 1/2, punctured * G0/G0 = 1 * G1/G0 = 1 + D + D3 + D4 / 1 + D3 + D4 */ const struct osmo_conv_code gsm0503_tch_afs_12_2 = { .N = 2, .K = 5, .len = 250, .next_output = tch_afs_12_2_output, .next_state = tch_afs_12_2_state, .next_term_output = tch_afs_12_2_term_output, .next_term_state = tch_afs_12_2_term_state, .puncture = tch_afs_12_2_puncture, }; static const uint8_t tch_afs_10_2_state[][2] = { { 0, 1 }, { 3, 2 }, { 5, 4 }, { 6, 7 }, { 9, 8 }, { 10, 11 }, { 12, 13 }, { 15, 14 }, { 1, 0 }, { 2, 3 }, { 4, 5 }, { 7, 6 }, { 8, 9 }, { 11, 10 }, { 13, 12 }, { 14, 15 }, }; static const uint8_t tch_afs_10_2_output[][2] = { { 0, 7 }, { 2, 5 }, { 4, 3 }, { 6, 1 }, { 2, 5 }, { 0, 7 }, { 6, 1 }, { 4, 3 }, { 0, 7 }, { 2, 5 }, { 4, 3 }, { 6, 1 }, { 2, 5 }, { 0, 7 }, { 6, 1 }, { 4, 3 }, }; static const uint8_t tch_afs_10_2_term_state[] = { 0, 2, 4, 6, 8, 10, 12, 14, 0, 2, 4, 6, 8, 10, 12, 14, }; static const uint8_t tch_afs_10_2_term_output[] = { 0, 5, 3, 6, 5, 0, 6, 3, 7, 2, 4, 1, 2, 7, 1, 4, }; static const int tch_afs_10_2_puncture[] = { 1, 4, 7, 10, 16, 19, 22, 28, 31, 34, 40, 43, 46, 52, 55, 58, 64, 67, 70, 76, 79, 82, 88, 91, 94, 100, 103, 106, 112, 115, 118, 124, 127, 130, 136, 139, 142, 148, 151, 154, 160, 163, 166, 172, 175, 178, 184, 187, 190, 196, 199, 202, 208, 211, 214, 220, 223, 226, 232, 235, 238, 244, 247, 250, 256, 259, 262, 268, 271, 274, 280, 283, 286, 292, 295, 298, 304, 307, 310, 316, 319, 322, 325, 328, 331, 334, 337, 340, 343, 346, 349, 352, 355, 358, 361, 364, 367, 370, 373, 376, 379, 382, 385, 388, 391, 394, 397, 400, 403, 406, 409, 412, 415, 418, 421, 424, 427, 430, 433, 436, 439, 442, 445, 448, 451, 454, 457, 460, 463, 466, 469, 472, 475, 478, 481, 484, 487, 490, 493, 496, 499, 502, 505, 508, 511, 514, 517, 520, 523, 526, 529, 532, 535, 538, 541, 544, 547, 550, 553, 556, 559, 562, 565, 568, 571, 574, 577, 580, 583, 586, 589, 592, 595, 598, 601, 604, 607, 609, 610, 613, 616, 619, 621, 622, 625, 627, 628, 631, 633, 634, 636, 637, 639, 640, -1, }; /** * TCH/AFS 10.2 kbits convolutional code: * G1/G3 = 1 + D + D3 + D4 / 1 + D + D2 + D3 + D4 * G2/G3 = 1 + D2 + D4 / 1 + D + D2 + D3 + D4 * G3/G3 = 1 */ const struct osmo_conv_code gsm0503_tch_afs_10_2 = { .N = 3, .K = 5, .len = 210, .next_output = tch_afs_10_2_output, .next_state = tch_afs_10_2_state, .next_term_output = tch_afs_10_2_term_output, .next_term_state = tch_afs_10_2_term_state, .puncture = tch_afs_10_2_puncture, }; static const uint8_t tch_afs_7_95_state[][2] = { { 0, 1 }, { 2, 3 }, { 5, 4 }, { 7, 6 }, { 9, 8 }, { 11, 10 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 21, 20 }, { 23, 22 }, { 25, 24 }, { 27, 26 }, { 28, 29 }, { 30, 31 }, { 33, 32 }, { 35, 34 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 45, 44 }, { 47, 46 }, { 49, 48 }, { 51, 50 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 61, 60 }, { 63, 62 }, { 1, 0 }, { 3, 2 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 13, 12 }, { 15, 14 }, { 17, 16 }, { 19, 18 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 29, 28 }, { 31, 30 }, { 32, 33 }, { 34, 35 }, { 37, 36 }, { 39, 38 }, { 41, 40 }, { 43, 42 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 53, 52 }, { 55, 54 }, { 57, 56 }, { 59, 58 }, { 60, 61 }, { 62, 63 }, }; static const uint8_t tch_afs_7_95_output[][2] = { { 0, 7 }, { 3, 4 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 0, 7 }, { 3, 4 }, { 3, 4 }, { 0, 7 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 3, 4 }, { 0, 7 }, { 0, 7 }, { 3, 4 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 0, 7 }, { 3, 4 }, { 3, 4 }, { 0, 7 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 3, 4 }, { 0, 7 }, { 0, 7 }, { 3, 4 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 0, 7 }, { 3, 4 }, }; static const uint8_t tch_afs_7_95_term_state[] = { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, }; static const uint8_t tch_afs_7_95_term_output[] = { 0, 3, 5, 6, 5, 6, 0, 3, 3, 0, 6, 5, 6, 5, 3, 0, 4, 7, 1, 2, 1, 2, 4, 7, 7, 4, 2, 1, 2, 1, 7, 4, 7, 4, 2, 1, 2, 1, 7, 4, 4, 7, 1, 2, 1, 2, 4, 7, 3, 0, 6, 5, 6, 5, 3, 0, 0, 3, 5, 6, 5, 6, 0, 3, }; static const int tch_afs_7_95_puncture[] = { 1, 2, 4, 5, 8, 22, 70, 118, 166, 214, 262, 310, 317, 319, 325, 332, 334, 341, 343, 349, 356, 358, 365, 367, 373, 380, 382, 385, 389, 391, 397, 404, 406, 409, 413, 415, 421, 428, 430, 433, 437, 439, 445, 452, 454, 457, 461, 463, 469, 476, 478, 481, 485, 487, 490, 493, 500, 502, 503, 505, 506, 508, 509, 511, 512, -1, }; /** * TCH/AFS 7.95 kbits convolutional code: * G4/G4 = 1 * G5/G4 = 1 + D + D4 + D6 / 1 + D2 + D3 + D5 + D6 * G6/G4 = 1 + D + D2 + D3 + D4 + D6 / 1 + D2 + D3 + D5 + D6 */ const struct osmo_conv_code gsm0503_tch_afs_7_95 = { .N = 3, .K = 7, .len = 165, .next_output = tch_afs_7_95_output, .next_state = tch_afs_7_95_state, .next_term_output = tch_afs_7_95_term_output, .next_term_state = tch_afs_7_95_term_state, .puncture = tch_afs_7_95_puncture, }; static const uint8_t tch_afs_7_4_state[][2] = { { 0, 1 }, { 3, 2 }, { 5, 4 }, { 6, 7 }, { 9, 8 }, { 10, 11 }, { 12, 13 }, { 15, 14 }, { 1, 0 }, { 2, 3 }, { 4, 5 }, { 7, 6 }, { 8, 9 }, { 11, 10 }, { 13, 12 }, { 14, 15 }, }; static const uint8_t tch_afs_7_4_output[][2] = { { 0, 7 }, { 2, 5 }, { 4, 3 }, { 6, 1 }, { 2, 5 }, { 0, 7 }, { 6, 1 }, { 4, 3 }, { 0, 7 }, { 2, 5 }, { 4, 3 }, { 6, 1 }, { 2, 5 }, { 0, 7 }, { 6, 1 }, { 4, 3 }, }; static const uint8_t tch_afs_7_4_term_state[] = { 0, 2, 4, 6, 8, 10, 12, 14, 0, 2, 4, 6, 8, 10, 12, 14, }; static const uint8_t tch_afs_7_4_term_output[] = { 0, 5, 3, 6, 5, 0, 6, 3, 7, 2, 4, 1, 2, 7, 1, 4, }; static const int tch_afs_7_4_puncture[] = { 0, 355, 361, 367, 373, 379, 385, 391, 397, 403, 409, 415, 421, 427, 433, 439, 445, 451, 457, 460, 463, 466, 468, 469, 471, 472, -1, }; /** * TCH/AFS 7.4 kbits convolutional code: * G1/G3 = 1 + D + D3 + D4 / 1 + D + D2 + D3 + D4 * G2/G3 = 1 + D2 + D4 / 1 + D + D2 + D3 + D4 * G3/G3 = 1 */ const struct osmo_conv_code gsm0503_tch_afs_7_4 = { .N = 3, .K = 5, .len = 154, .next_output = tch_afs_7_4_output, .next_state = tch_afs_7_4_state, .next_term_output = tch_afs_7_4_term_output, .next_term_state = tch_afs_7_4_term_state, .puncture = tch_afs_7_4_puncture, }; static const uint8_t tch_afs_6_7_state[][2] = { { 0, 1 }, { 3, 2 }, { 5, 4 }, { 6, 7 }, { 9, 8 }, { 10, 11 }, { 12, 13 }, { 15, 14 }, { 1, 0 }, { 2, 3 }, { 4, 5 }, { 7, 6 }, { 8, 9 }, { 11, 10 }, { 13, 12 }, { 14, 15 }, }; static const uint8_t tch_afs_6_7_output[][2] = { { 0, 15 }, { 4, 11 }, { 8, 7 }, { 12, 3 }, { 4, 11 }, { 0, 15 }, { 12, 3 }, { 8, 7 }, { 0, 15 }, { 4, 11 }, { 8, 7 }, { 12, 3 }, { 4, 11 }, { 0, 15 }, { 12, 3 }, { 8, 7 }, }; static const uint8_t tch_afs_6_7_term_state[] = { 0, 2, 4, 6, 8, 10, 12, 14, 0, 2, 4, 6, 8, 10, 12, 14, }; static const uint8_t tch_afs_6_7_term_output[] = { 0, 11, 7, 12, 11, 0, 12, 7, 15, 4, 8, 3, 4, 15, 3, 8, }; static const int tch_afs_6_7_puncture[] = { 1, 3, 7, 11, 15, 27, 39, 55, 67, 79, 95, 107, 119, 135, 147, 159, 175, 187, 199, 215, 227, 239, 255, 267, 279, 287, 291, 295, 299, 303, 307, 311, 315, 319, 323, 327, 331, 335, 339, 343, 347, 351, 355, 359, 363, 367, 369, 371, 375, 377, 379, 383, 385, 387, 391, 393, 395, 399, 401, 403, 407, 409, 411, 415, 417, 419, 423, 425, 427, 431, 433, 435, 439, 441, 443, 447, 449, 451, 455, 457, 459, 463, 465, 467, 471, 473, 475, 479, 481, 483, 487, 489, 491, 495, 497, 499, 503, 505, 507, 511, 513, 515, 519, 521, 523, 527, 529, 531, 535, 537, 539, 543, 545, 547, 549, 551, 553, 555, 557, 559, 561, 563, 565, 567, 569, 571, 573, 575, -1, }; /** * TCH/AFS 6.7 kbits convolutional code: * G1/G3 = 1 + D + D3 + D4 / 1 + D + D2 + D3 + D4 * G2/G3 = 1 + D2 + D4 / 1 + D + D2 + D3 + D4 * G3/G3 = 1 * G3/G3 = 1 */ const struct osmo_conv_code gsm0503_tch_afs_6_7 = { .N = 4, .K = 5, .len = 140, .next_output = tch_afs_6_7_output, .next_state = tch_afs_6_7_state, .next_term_output = tch_afs_6_7_term_output, .next_term_state = tch_afs_6_7_term_state, .puncture = tch_afs_6_7_puncture, }; static const uint8_t tch_afs_5_9_state[][2] = { { 0, 1 }, { 3, 2 }, { 5, 4 }, { 6, 7 }, { 9, 8 }, { 10, 11 }, { 12, 13 }, { 15, 14 }, { 17, 16 }, { 18, 19 }, { 20, 21 }, { 23, 22 }, { 24, 25 }, { 27, 26 }, { 29, 28 }, { 30, 31 }, { 32, 33 }, { 35, 34 }, { 37, 36 }, { 38, 39 }, { 41, 40 }, { 42, 43 }, { 44, 45 }, { 47, 46 }, { 49, 48 }, { 50, 51 }, { 52, 53 }, { 55, 54 }, { 56, 57 }, { 59, 58 }, { 61, 60 }, { 62, 63 }, { 1, 0 }, { 2, 3 }, { 4, 5 }, { 7, 6 }, { 8, 9 }, { 11, 10 }, { 13, 12 }, { 14, 15 }, { 16, 17 }, { 19, 18 }, { 21, 20 }, { 22, 23 }, { 25, 24 }, { 26, 27 }, { 28, 29 }, { 31, 30 }, { 33, 32 }, { 34, 35 }, { 36, 37 }, { 39, 38 }, { 40, 41 }, { 43, 42 }, { 45, 44 }, { 46, 47 }, { 48, 49 }, { 51, 50 }, { 53, 52 }, { 54, 55 }, { 57, 56 }, { 58, 59 }, { 60, 61 }, { 63, 62 }, }; static const uint8_t tch_afs_5_9_output[][2] = { { 0, 15 }, { 8, 7 }, { 4, 11 }, { 12, 3 }, { 4, 11 }, { 12, 3 }, { 0, 15 }, { 8, 7 }, { 8, 7 }, { 0, 15 }, { 12, 3 }, { 4, 11 }, { 12, 3 }, { 4, 11 }, { 8, 7 }, { 0, 15 }, { 8, 7 }, { 0, 15 }, { 12, 3 }, { 4, 11 }, { 12, 3 }, { 4, 11 }, { 8, 7 }, { 0, 15 }, { 0, 15 }, { 8, 7 }, { 4, 11 }, { 12, 3 }, { 4, 11 }, { 12, 3 }, { 0, 15 }, { 8, 7 }, { 0, 15 }, { 8, 7 }, { 4, 11 }, { 12, 3 }, { 4, 11 }, { 12, 3 }, { 0, 15 }, { 8, 7 }, { 8, 7 }, { 0, 15 }, { 12, 3 }, { 4, 11 }, { 12, 3 }, { 4, 11 }, { 8, 7 }, { 0, 15 }, { 8, 7 }, { 0, 15 }, { 12, 3 }, { 4, 11 }, { 12, 3 }, { 4, 11 }, { 8, 7 }, { 0, 15 }, { 0, 15 }, { 8, 7 }, { 4, 11 }, { 12, 3 }, { 4, 11 }, { 12, 3 }, { 0, 15 }, { 8, 7 }, }; static const uint8_t tch_afs_5_9_term_state[] = { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, }; static const uint8_t tch_afs_5_9_term_output[] = { 0, 7, 11, 12, 11, 12, 0, 7, 7, 0, 12, 11, 12, 11, 7, 0, 8, 15, 3, 4, 3, 4, 8, 15, 15, 8, 4, 3, 4, 3, 15, 8, 15, 8, 4, 3, 4, 3, 15, 8, 8, 15, 3, 4, 3, 4, 8, 15, 7, 0, 12, 11, 12, 11, 7, 0, 0, 7, 11, 12, 11, 12, 0, 7, }; static const int tch_afs_5_9_puncture[] = { 0, 1, 3, 5, 7, 11, 15, 31, 47, 63, 79, 95, 111, 127, 143, 159, 175, 191, 207, 223, 239, 255, 271, 287, 303, 319, 327, 331, 335, 343, 347, 351, 359, 363, 367, 375, 379, 383, 391, 395, 399, 407, 411, 415, 423, 427, 431, 439, 443, 447, 455, 459, 463, 467, 471, 475, 479, 483, 487, 491, 495, 499, 503, 507, 509, 511, 512, 513, 515, 516, 517, 519, -1, }; /** * TCH/AFS 5.9 kbits convolutional code: * 124 bits * G4/G6 = 1 + D2 + D3 + D5 + D6 / 1 + D + D2 + D3 + D4 + D6 * G5/G6 = 1 + D + D4 + D6 / 1 + D + D2 + D3 + D4 + D6 * G6/G6 = 1 * G6/G6 = 1 */ const struct osmo_conv_code gsm0503_tch_afs_5_9 = { .N = 4, .K = 7, .len = 124, .next_output = tch_afs_5_9_output, .next_state = tch_afs_5_9_state, .next_term_output = tch_afs_5_9_term_output, .next_term_state = tch_afs_5_9_term_state, .puncture = tch_afs_5_9_puncture, }; static const uint8_t tch_afs_5_15_state[][2] = { { 0, 1 }, { 3, 2 }, { 5, 4 }, { 6, 7 }, { 9, 8 }, { 10, 11 }, { 12, 13 }, { 15, 14 }, { 1, 0 }, { 2, 3 }, { 4, 5 }, { 7, 6 }, { 8, 9 }, { 11, 10 }, { 13, 12 }, { 14, 15 }, }; static const uint8_t tch_afs_5_15_output[][2] = { { 0, 31 }, { 4, 27 }, { 24, 7 }, { 28, 3 }, { 4, 27 }, { 0, 31 }, { 28, 3 }, { 24, 7 }, { 0, 31 }, { 4, 27 }, { 24, 7 }, { 28, 3 }, { 4, 27 }, { 0, 31 }, { 28, 3 }, { 24, 7 }, }; static const uint8_t tch_afs_5_15_term_state[] = { 0, 2, 4, 6, 8, 10, 12, 14, 0, 2, 4, 6, 8, 10, 12, 14, }; static const uint8_t tch_afs_5_15_term_output[] = { 0, 27, 7, 28, 27, 0, 28, 7, 31, 4, 24, 3, 4, 31, 3, 24, }; static const int tch_afs_5_15_puncture[] = { 0, 4, 5, 9, 10, 14, 15, 20, 25, 30, 35, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300, 310, 315, 320, 325, 330, 334, 335, 340, 344, 345, 350, 354, 355, 360, 364, 365, 370, 374, 375, 380, 384, 385, 390, 394, 395, 400, 404, 405, 410, 414, 415, 420, 424, 425, 430, 434, 435, 440, 444, 445, 450, 454, 455, 460, 464, 465, 470, 474, 475, 480, 484, 485, 490, 494, 495, 500, 504, 505, 510, 514, 515, 520, 524, 525, 529, 530, 534, 535, 539, 540, 544, 545, 549, 550, 554, 555, 559, 560, 564, -1, }; /** * TCH/AFS 5.15 kbits convolutional code: * G1/G3 = 1 + D + D3 + D4 / 1 + D + D2 + D3 + D4 * G1/G3 = 1 + D + D3 + D4 / 1 + D + D2 + D3 + D4 * G2/G3 = 1 + D2 + D4 / 1 + D + D2 + D3 + D4 * G3/G3 = 1 * G3/G3 = 1 */ const struct osmo_conv_code gsm0503_tch_afs_5_15 = { .N = 5, .K = 5, .len = 109, .next_output = tch_afs_5_15_output, .next_state = tch_afs_5_15_state, .next_term_output = tch_afs_5_15_term_output, .next_term_state = tch_afs_5_15_term_state, .puncture = tch_afs_5_15_puncture, }; static const uint8_t tch_afs_4_75_state[][2] = { { 0, 1 }, { 3, 2 }, { 5, 4 }, { 6, 7 }, { 9, 8 }, { 10, 11 }, { 12, 13 }, { 15, 14 }, { 17, 16 }, { 18, 19 }, { 20, 21 }, { 23, 22 }, { 24, 25 }, { 27, 26 }, { 29, 28 }, { 30, 31 }, { 32, 33 }, { 35, 34 }, { 37, 36 }, { 38, 39 }, { 41, 40 }, { 42, 43 }, { 44, 45 }, { 47, 46 }, { 49, 48 }, { 50, 51 }, { 52, 53 }, { 55, 54 }, { 56, 57 }, { 59, 58 }, { 61, 60 }, { 62, 63 }, { 1, 0 }, { 2, 3 }, { 4, 5 }, { 7, 6 }, { 8, 9 }, { 11, 10 }, { 13, 12 }, { 14, 15 }, { 16, 17 }, { 19, 18 }, { 21, 20 }, { 22, 23 }, { 25, 24 }, { 26, 27 }, { 28, 29 }, { 31, 30 }, { 33, 32 }, { 34, 35 }, { 36, 37 }, { 39, 38 }, { 40, 41 }, { 43, 42 }, { 45, 44 }, { 46, 47 }, { 48, 49 }, { 51, 50 }, { 53, 52 }, { 54, 55 }, { 57, 56 }, { 58, 59 }, { 60, 61 }, { 63, 62 }, }; static const uint8_t tch_afs_4_75_output[][2] = { { 0, 31 }, { 24, 7 }, { 4, 27 }, { 28, 3 }, { 4, 27 }, { 28, 3 }, { 0, 31 }, { 24, 7 }, { 24, 7 }, { 0, 31 }, { 28, 3 }, { 4, 27 }, { 28, 3 }, { 4, 27 }, { 24, 7 }, { 0, 31 }, { 24, 7 }, { 0, 31 }, { 28, 3 }, { 4, 27 }, { 28, 3 }, { 4, 27 }, { 24, 7 }, { 0, 31 }, { 0, 31 }, { 24, 7 }, { 4, 27 }, { 28, 3 }, { 4, 27 }, { 28, 3 }, { 0, 31 }, { 24, 7 }, { 0, 31 }, { 24, 7 }, { 4, 27 }, { 28, 3 }, { 4, 27 }, { 28, 3 }, { 0, 31 }, { 24, 7 }, { 24, 7 }, { 0, 31 }, { 28, 3 }, { 4, 27 }, { 28, 3 }, { 4, 27 }, { 24, 7 }, { 0, 31 }, { 24, 7 }, { 0, 31 }, { 28, 3 }, { 4, 27 }, { 28, 3 }, { 4, 27 }, { 24, 7 }, { 0, 31 }, { 0, 31 }, { 24, 7 }, { 4, 27 }, { 28, 3 }, { 4, 27 }, { 28, 3 }, { 0, 31 }, { 24, 7 }, }; static const uint8_t tch_afs_4_75_term_state[] = { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, }; static const uint8_t tch_afs_4_75_term_output[] = { 0, 7, 27, 28, 27, 28, 0, 7, 7, 0, 28, 27, 28, 27, 7, 0, 24, 31, 3, 4, 3, 4, 24, 31, 31, 24, 4, 3, 4, 3, 31, 24, 31, 24, 4, 3, 4, 3, 31, 24, 24, 31, 3, 4, 3, 4, 24, 31, 7, 0, 28, 27, 28, 27, 7, 0, 0, 7, 27, 28, 27, 28, 0, 7, }; static const int tch_afs_4_75_puncture[] = { 0, 1, 2, 4, 5, 7, 9, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105, 115, 125, 135, 145, 155, 165, 175, 185, 195, 205, 215, 225, 235, 245, 255, 265, 275, 285, 295, 305, 315, 325, 335, 345, 355, 365, 375, 385, 395, 400, 405, 410, 415, 420, 425, 430, 435, 440, 445, 450, 455, 459, 460, 465, 470, 475, 479, 480, 485, 490, 495, 499, 500, 505, 509, 510, 515, 517, 519, 520, 522, 524, 525, 526, 527, 529, 530, 531, 532, 534, -1, }; /** * TCH/AFS 4.75 kbits convolutional code: * G4/G6 = 1 + D2 + D3 + D5 + D6 / 1 + D + D2 + D3 + D4 + D6 * G4/G6 = 1 + D2 + D3 + D5 + D6 / 1 + D + D2 + D3 + D4 + D6 * G5/G6 = 1 + D + D4 + D6 / 1 + D + D2 + D3 + D4 + D6 * G6/G6 = 1 * G6/G6 = 1 */ const struct osmo_conv_code gsm0503_tch_afs_4_75 = { .N = 5, .K = 7, .len = 101, .next_output = tch_afs_4_75_output, .next_state = tch_afs_4_75_state, .next_term_output = tch_afs_4_75_term_output, .next_term_state = tch_afs_4_75_term_state, .puncture = tch_afs_4_75_puncture, }; static const uint8_t tch_fr_state[][2] = { { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, }; static const uint8_t tch_fr_output[][2] = { { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 3, 0 }, { 2, 1 }, { 3, 0 }, { 2, 1 }, { 3, 0 }, { 2, 1 }, { 3, 0 }, { 2, 1 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, }; /** * TCH/F convolutional code */ const struct osmo_conv_code gsm0503_tch_fr = { .N = 2, .K = 5, .len = 185, .next_output = tch_fr_output, .next_state = tch_fr_state, }; static const uint8_t tch_hr_state[][2] = { { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, }; static const uint8_t tch_hr_output[][2] = { { 0, 7 }, { 3, 4 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 0, 7 }, { 3, 4 }, { 3, 4 }, { 0, 7 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 3, 4 }, { 0, 7 }, { 4, 3 }, { 7, 0 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 4, 3 }, { 7, 0 }, { 7, 0 }, { 4, 3 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 7, 0 }, { 4, 3 }, { 7, 0 }, { 4, 3 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 7, 0 }, { 4, 3 }, { 4, 3 }, { 7, 0 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 4, 3 }, { 7, 0 }, { 3, 4 }, { 0, 7 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 3, 4 }, { 0, 7 }, { 0, 7 }, { 3, 4 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 0, 7 }, { 3, 4 }, }; static const int tch_hr_puncture[] = { 1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49, 52, 55, 58, 61, 64, 67, 70, 73, 76, 79, 82, 85, 88, 91, 94, 97, 100, 103, 106, 109, 112, 115, 118, 121, 124, 127, 130, 133, 136, 139, 142, 145, 148, 151, 154, 157, 160, 163, 166, 169, 172, 175, 178, 181, 184, 187, 190, 193, 196, 199, 202, 205, 208, 211, 214, 217, 220, 223, 226, 229, 232, 235, 238, 241, 244, 247, 250, 253, 256, 259, 262, 265, 268, 271, 274, 277, 280, 283, 295, 298, 301, 304, 307, 310, -1, }; /** * TCH/H convolutional code */ const struct osmo_conv_code gsm0503_tch_hr = { .N = 3, .K = 7, .len = 98, .next_output = tch_hr_output, .next_state = tch_hr_state, .puncture = tch_hr_puncture, }; static const uint8_t tch_ahs_7_95_state[][2] = { { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 9, 8 }, { 11, 10 }, { 13, 12 }, { 15, 14 }, { 1, 0 }, { 3, 2 }, { 5, 4 }, { 7, 6 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, }; static const uint8_t tch_ahs_7_95_output[][2] = { { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, }; static const uint8_t tch_ahs_7_95_term_state[] = { 0, 2, 4, 6, 8, 10, 12, 14, 0, 2, 4, 6, 8, 10, 12, 14, }; static const uint8_t tch_ahs_7_95_term_output[] = { 0, 1, 0, 1, 3, 2, 3, 2, 3, 2, 3, 2, 0, 1, 0, 1, }; static const int tch_ahs_7_95_puncture[] = { 1, 3, 5, 7, 11, 15, 19, 23, 27, 31, 35, 43, 47, 51, 55, 59, 63, 67, 71, 79, 83, 87, 91, 95, 99, 103, 107, 115, 119, 123, 127, 131, 135, 139, 143, 151, 155, 159, 163, 167, 171, 175, 177, 179, 183, 185, 187, 191, 193, 195, 197, 199, 203, 205, 207, 211, 213, 215, 219, 221, 223, 227, 229, 231, 233, 235, 239, 241, 243, 247, 249, 251, 255, 257, 259, 261, 263, 265, -1, }; /** * TCH/AHS 7.95 kbits convolutional code */ const struct osmo_conv_code gsm0503_tch_ahs_7_95 = { .N = 2, .K = 5, .len = 129, .next_output = tch_ahs_7_95_output, .next_state = tch_ahs_7_95_state, .next_term_output = tch_ahs_7_95_term_output, .next_term_state = tch_ahs_7_95_term_state, .puncture = tch_ahs_7_95_puncture, }; static const uint8_t tch_ahs_7_4_state[][2] = { { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 9, 8 }, { 11, 10 }, { 13, 12 }, { 15, 14 }, { 1, 0 }, { 3, 2 }, { 5, 4 }, { 7, 6 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, }; static const uint8_t tch_ahs_7_4_output[][2] = { { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, }; static const uint8_t tch_ahs_7_4_term_state[] = { 0, 2, 4, 6, 8, 10, 12, 14, 0, 2, 4, 6, 8, 10, 12, 14, }; static const uint8_t tch_ahs_7_4_term_output[] = { 0, 1, 0, 1, 3, 2, 3, 2, 3, 2, 3, 2, 0, 1, 0, 1, }; static const int tch_ahs_7_4_puncture[] = { 1, 3, 7, 11, 19, 23, 27, 35, 39, 43, 51, 55, 59, 67, 71, 75, 83, 87, 91, 99, 103, 107, 115, 119, 123, 131, 135, 139, 143, 147, 151, 155, 159, 163, 167, 171, 175, 179, 183, 187, 191, 195, 199, 203, 207, 211, 215, 219, 221, 223, 227, 229, 231, 235, 237, 239, 243, 245, 247, 251, 253, 255, 257, 259, -1, }; /** * TCH/AHS 7.4 kbits convolutional code */ const struct osmo_conv_code gsm0503_tch_ahs_7_4 = { .N = 2, .K = 5, .len = 126, .next_output = tch_ahs_7_4_output, .next_state = tch_ahs_7_4_state, .next_term_output = tch_ahs_7_4_term_output, .next_term_state = tch_ahs_7_4_term_state, .puncture = tch_ahs_7_4_puncture, }; static const uint8_t tch_ahs_6_7_state[][2] = { { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 9, 8 }, { 11, 10 }, { 13, 12 }, { 15, 14 }, { 1, 0 }, { 3, 2 }, { 5, 4 }, { 7, 6 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, }; static const uint8_t tch_ahs_6_7_output[][2] = { { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, }; static const uint8_t tch_ahs_6_7_term_state[] = { 0, 2, 4, 6, 8, 10, 12, 14, 0, 2, 4, 6, 8, 10, 12, 14, }; static const uint8_t tch_ahs_6_7_term_output[] = { 0, 1, 0, 1, 3, 2, 3, 2, 3, 2, 3, 2, 0, 1, 0, 1, }; static const int tch_ahs_6_7_puncture[] = { 1, 3, 9, 19, 29, 39, 49, 59, 69, 79, 89, 99, 109, 119, 129, 139, 149, 159, 167, 169, 177, 179, 187, 189, 197, 199, 203, 207, 209, 213, 217, 219, 223, 227, 229, 231, 233, 235, 237, 239, -1, }; /** * TCH/AHS 6.7 kbits convolutional code */ const struct osmo_conv_code gsm0503_tch_ahs_6_7 = { .N = 2, .K = 5, .len = 116, .next_output = tch_ahs_6_7_output, .next_state = tch_ahs_6_7_state, .next_term_output = tch_ahs_6_7_term_output, .next_term_state = tch_ahs_6_7_term_state, .puncture = tch_ahs_6_7_puncture, }; static const uint8_t tch_ahs_5_9_state[][2] = { { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 9, 8 }, { 11, 10 }, { 13, 12 }, { 15, 14 }, { 1, 0 }, { 3, 2 }, { 5, 4 }, { 7, 6 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, }; static const uint8_t tch_ahs_5_9_output[][2] = { { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, { 0, 3 }, { 1, 2 }, }; static const uint8_t tch_ahs_5_9_term_state[] = { 0, 2, 4, 6, 8, 10, 12, 14, 0, 2, 4, 6, 8, 10, 12, 14, }; static const uint8_t tch_ahs_5_9_term_output[] = { 0, 1, 0, 1, 3, 2, 3, 2, 3, 2, 3, 2, 0, 1, 0, 1, }; static const int tch_ahs_5_9_puncture[] = { 1, 15, 71, 127, 139, 151, 163, 175, 187, 195, 203, 211, 215, 219, 221, 223, -1, }; /** * TCH/AHS 5.9 kbits convolutional code */ const struct osmo_conv_code gsm0503_tch_ahs_5_9 = { .N = 2, .K = 5, .len = 108, .next_output = tch_ahs_5_9_output, .next_state = tch_ahs_5_9_state, .next_term_output = tch_ahs_5_9_term_output, .next_term_state = tch_ahs_5_9_term_state, .puncture = tch_ahs_5_9_puncture, }; static const uint8_t tch_ahs_5_15_state[][2] = { { 0, 1 }, { 3, 2 }, { 5, 4 }, { 6, 7 }, { 9, 8 }, { 10, 11 }, { 12, 13 }, { 15, 14 }, { 1, 0 }, { 2, 3 }, { 4, 5 }, { 7, 6 }, { 8, 9 }, { 11, 10 }, { 13, 12 }, { 14, 15 }, }; static const uint8_t tch_ahs_5_15_output[][2] = { { 0, 7 }, { 2, 5 }, { 4, 3 }, { 6, 1 }, { 2, 5 }, { 0, 7 }, { 6, 1 }, { 4, 3 }, { 0, 7 }, { 2, 5 }, { 4, 3 }, { 6, 1 }, { 2, 5 }, { 0, 7 }, { 6, 1 }, { 4, 3 }, }; static const uint8_t tch_ahs_5_15_term_state[] = { 0, 2, 4, 6, 8, 10, 12, 14, 0, 2, 4, 6, 8, 10, 12, 14, }; static const uint8_t tch_ahs_5_15_term_output[] = { 0, 5, 3, 6, 5, 0, 6, 3, 7, 2, 4, 1, 2, 7, 1, 4, }; static const int tch_ahs_5_15_puncture[] = { 0, 1, 3, 4, 6, 9, 12, 15, 18, 21, 27, 33, 39, 45, 51, 54, 57, 63, 69, 75, 81, 87, 90, 93, 99, 105, 111, 117, 123, 126, 129, 135, 141, 147, 153, 159, 162, 165, 168, 171, 174, 177, 180, 183, 186, 189, 192, 195, 198, 201, 204, 207, 210, 213, 216, 219, 222, 225, 228, 231, 234, 237, 240, 243, 244, 246, 249, 252, 255, 256, 258, 261, 264, 267, 268, 270, 273, 276, 279, 280, 282, 285, 288, 289, 291, 294, 295, 297, 298, 300, 301, -1, }; /** * TCH/AHS 5.15 kbits convolutional code */ const struct osmo_conv_code gsm0503_tch_ahs_5_15 = { .N = 3, .K = 5, .len = 97, .next_output = tch_ahs_5_15_output, .next_state = tch_ahs_5_15_state, .next_term_output = tch_ahs_5_15_term_output, .next_term_state = tch_ahs_5_15_term_state, .puncture = tch_ahs_5_15_puncture, }; static const uint8_t tch_ahs_4_75_state[][2] = { { 0, 1 }, { 2, 3 }, { 5, 4 }, { 7, 6 }, { 9, 8 }, { 11, 10 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 21, 20 }, { 23, 22 }, { 25, 24 }, { 27, 26 }, { 28, 29 }, { 30, 31 }, { 33, 32 }, { 35, 34 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 45, 44 }, { 47, 46 }, { 49, 48 }, { 51, 50 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 61, 60 }, { 63, 62 }, { 1, 0 }, { 3, 2 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 13, 12 }, { 15, 14 }, { 17, 16 }, { 19, 18 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 29, 28 }, { 31, 30 }, { 32, 33 }, { 34, 35 }, { 37, 36 }, { 39, 38 }, { 41, 40 }, { 43, 42 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 53, 52 }, { 55, 54 }, { 57, 56 }, { 59, 58 }, { 60, 61 }, { 62, 63 }, }; static const uint8_t tch_ahs_4_75_output[][2] = { { 0, 7 }, { 3, 4 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 0, 7 }, { 3, 4 }, { 3, 4 }, { 0, 7 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 3, 4 }, { 0, 7 }, { 0, 7 }, { 3, 4 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 0, 7 }, { 3, 4 }, { 3, 4 }, { 0, 7 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 3, 4 }, { 0, 7 }, { 0, 7 }, { 3, 4 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 0, 7 }, { 3, 4 }, }; static const uint8_t tch_ahs_4_75_term_state[] = { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, }; static const uint8_t tch_ahs_4_75_term_output[] = { 0, 3, 5, 6, 5, 6, 0, 3, 3, 0, 6, 5, 6, 5, 3, 0, 4, 7, 1, 2, 1, 2, 4, 7, 7, 4, 2, 1, 2, 1, 7, 4, 7, 4, 2, 1, 2, 1, 7, 4, 4, 7, 1, 2, 1, 2, 4, 7, 3, 0, 6, 5, 6, 5, 3, 0, 0, 3, 5, 6, 5, 6, 0, 3, }; static const int tch_ahs_4_75_puncture[] = { 1, 2, 4, 5, 7, 8, 10, 13, 16, 22, 28, 34, 40, 46, 52, 58, 64, 70, 76, 82, 88, 94, 100, 106, 112, 118, 124, 130, 136, 142, 148, 151, 154, 160, 163, 166, 172, 175, 178, 184, 187, 190, 196, 199, 202, 208, 211, 214, 220, 223, 226, 232, 235, 238, 241, 244, 247, 250, 253, 256, 259, 262, 265, 268, 271, 274, 275, 277, 278, 280, 281, 283, 284, -1, }; /** * TCH/AHS 4.75 kbits convolutional code */ const struct osmo_conv_code gsm0503_tch_ahs_4_75 = { .N = 3, .K = 7, .len = 89, .next_output = tch_ahs_4_75_output, .next_state = tch_ahs_4_75_state, .next_term_output = tch_ahs_4_75_term_output, .next_term_state = tch_ahs_4_75_term_state, .puncture = tch_ahs_4_75_puncture, }; static const uint8_t mcs1_dl_hdr_state[][2] = { { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, }; static const uint8_t mcs1_dl_hdr_output[][2] = { { 0, 7 }, { 3, 4 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 0, 7 }, { 3, 4 }, { 1, 6 }, { 2, 5 }, { 7, 0 }, { 4, 3 }, { 7, 0 }, { 4, 3 }, { 1, 6 }, { 2, 5 }, { 4, 3 }, { 7, 0 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 4, 3 }, { 7, 0 }, { 5, 2 }, { 6, 1 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 5, 2 }, { 6, 1 }, { 7, 0 }, { 4, 3 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 7, 0 }, { 4, 3 }, { 6, 1 }, { 5, 2 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 6, 1 }, { 5, 2 }, { 3, 4 }, { 0, 7 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 3, 4 }, { 0, 7 }, { 2, 5 }, { 1, 6 }, { 4, 3 }, { 7, 0 }, { 4, 3 }, { 7, 0 }, { 2, 5 }, { 1, 6 }, }; /** * EDGE MCS-1 DL header convolutional code: * 42 bits blocks, rate 1/3, k = 7 * G4 = 1 + D2 + D3 + D5 + D6 * G7 = 1 + D + D2 + D3 + D6 * G5 = 1 + D + D4 + D6 */ const struct osmo_conv_code gsm0503_mcs1_dl_hdr = { .N = 3, .K = 7, .len = 36, .next_output = mcs1_dl_hdr_output, .next_state = mcs1_dl_hdr_state, .term = CONV_TERM_TAIL_BITING, }; static const uint8_t mcs1_ul_hdr_state[][2] = { { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, }; static const uint8_t mcs1_ul_hdr_output[][2] = { { 0, 7 }, { 3, 4 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 0, 7 }, { 3, 4 }, { 1, 6 }, { 2, 5 }, { 7, 0 }, { 4, 3 }, { 7, 0 }, { 4, 3 }, { 1, 6 }, { 2, 5 }, { 4, 3 }, { 7, 0 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 4, 3 }, { 7, 0 }, { 5, 2 }, { 6, 1 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 5, 2 }, { 6, 1 }, { 7, 0 }, { 4, 3 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 7, 0 }, { 4, 3 }, { 6, 1 }, { 5, 2 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 6, 1 }, { 5, 2 }, { 3, 4 }, { 0, 7 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 3, 4 }, { 0, 7 }, { 2, 5 }, { 1, 6 }, { 4, 3 }, { 7, 0 }, { 4, 3 }, { 7, 0 }, { 2, 5 }, { 1, 6 }, }; /** * EDGE MCS-1 UL header convolutional code: * 45 bits blocks, rate 1/3, k = 7 * G4 = 1 + D2 + D3 + D5 + D6 * G7 = 1 + D + D2 + D3 + D6 * G5 = 1 + D + D4 + D6 */ const struct osmo_conv_code gsm0503_mcs1_ul_hdr = { .N = 3, .K = 7, .len = 39, .next_output = mcs1_ul_hdr_output, .next_state = mcs1_ul_hdr_state, .term = CONV_TERM_TAIL_BITING, }; static const uint8_t mcs1_state[][2] = { { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, }; static const uint8_t mcs1_output[][2] = { { 0, 7 }, { 3, 4 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 0, 7 }, { 3, 4 }, { 1, 6 }, { 2, 5 }, { 7, 0 }, { 4, 3 }, { 7, 0 }, { 4, 3 }, { 1, 6 }, { 2, 5 }, { 4, 3 }, { 7, 0 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 4, 3 }, { 7, 0 }, { 5, 2 }, { 6, 1 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 5, 2 }, { 6, 1 }, { 7, 0 }, { 4, 3 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 7, 0 }, { 4, 3 }, { 6, 1 }, { 5, 2 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 6, 1 }, { 5, 2 }, { 3, 4 }, { 0, 7 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 3, 4 }, { 0, 7 }, { 2, 5 }, { 1, 6 }, { 4, 3 }, { 7, 0 }, { 4, 3 }, { 7, 0 }, { 2, 5 }, { 1, 6 }, }; /** * EDGE MCS-1 data convolutional code: * 196 bits blocks, rate 1/3, k = 7 * G4 = 1 + D2 + D3 + D5 + D6 * G7 = 1 + D + D2 + D3 + D6 * G5 = 1 + D + D4 + D6 */ const struct osmo_conv_code gsm0503_mcs1 = { .N = 3, .K = 7, .len = 190, .next_output = mcs1_output, .next_state = mcs1_state, }; static const uint8_t mcs2_state[][2] = { { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, }; static const uint8_t mcs2_output[][2] = { { 0, 7 }, { 3, 4 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 0, 7 }, { 3, 4 }, { 1, 6 }, { 2, 5 }, { 7, 0 }, { 4, 3 }, { 7, 0 }, { 4, 3 }, { 1, 6 }, { 2, 5 }, { 4, 3 }, { 7, 0 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 4, 3 }, { 7, 0 }, { 5, 2 }, { 6, 1 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 5, 2 }, { 6, 1 }, { 7, 0 }, { 4, 3 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 7, 0 }, { 4, 3 }, { 6, 1 }, { 5, 2 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 6, 1 }, { 5, 2 }, { 3, 4 }, { 0, 7 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 3, 4 }, { 0, 7 }, { 2, 5 }, { 1, 6 }, { 4, 3 }, { 7, 0 }, { 4, 3 }, { 7, 0 }, { 2, 5 }, { 1, 6 }, }; /** * EDGE MCS-2 data convolutional code: * 244 bits blocks, rate 1/3, k = 7 * G4 = 1 + D2 + D3 + D5 + D6 * G7 = 1 + D + D2 + D3 + D6 * G5 = 1 + D + D4 + D6 */ const struct osmo_conv_code gsm0503_mcs2 = { .N = 3, .K = 7, .len = 238, .next_output = mcs2_output, .next_state = mcs2_state, }; static const uint8_t mcs3_state[][2] = { { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, }; static const uint8_t mcs3_output[][2] = { { 0, 7 }, { 3, 4 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 0, 7 }, { 3, 4 }, { 1, 6 }, { 2, 5 }, { 7, 0 }, { 4, 3 }, { 7, 0 }, { 4, 3 }, { 1, 6 }, { 2, 5 }, { 4, 3 }, { 7, 0 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 4, 3 }, { 7, 0 }, { 5, 2 }, { 6, 1 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 5, 2 }, { 6, 1 }, { 7, 0 }, { 4, 3 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 7, 0 }, { 4, 3 }, { 6, 1 }, { 5, 2 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 6, 1 }, { 5, 2 }, { 3, 4 }, { 0, 7 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 3, 4 }, { 0, 7 }, { 2, 5 }, { 1, 6 }, { 4, 3 }, { 7, 0 }, { 4, 3 }, { 7, 0 }, { 2, 5 }, { 1, 6 }, }; /** * EDGE MCS-3 data convolutional code: * 316 bits blocks, rate 1/3, k = 7 * G4 = 1 + D2 + D3 + D5 + D6 * G7 = 1 + D + D2 + D3 + D6 * G5 = 1 + D + D4 + D6 */ const struct osmo_conv_code gsm0503_mcs3 = { .N = 3, .K = 7, .len = 310, .next_output = mcs3_output, .next_state = mcs3_state, }; static const uint8_t mcs4_state[][2] = { { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, }; static const uint8_t mcs4_output[][2] = { { 0, 7 }, { 3, 4 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 0, 7 }, { 3, 4 }, { 1, 6 }, { 2, 5 }, { 7, 0 }, { 4, 3 }, { 7, 0 }, { 4, 3 }, { 1, 6 }, { 2, 5 }, { 4, 3 }, { 7, 0 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 4, 3 }, { 7, 0 }, { 5, 2 }, { 6, 1 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 5, 2 }, { 6, 1 }, { 7, 0 }, { 4, 3 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 7, 0 }, { 4, 3 }, { 6, 1 }, { 5, 2 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 6, 1 }, { 5, 2 }, { 3, 4 }, { 0, 7 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 3, 4 }, { 0, 7 }, { 2, 5 }, { 1, 6 }, { 4, 3 }, { 7, 0 }, { 4, 3 }, { 7, 0 }, { 2, 5 }, { 1, 6 }, }; /** * EDGE MCS-4 data convolutional code: * 372 bits blocks, rate 1/3, k = 7 * G4 = 1 + D2 + D3 + D5 + D6 * G7 = 1 + D + D2 + D3 + D6 * G5 = 1 + D + D4 + D6 */ const struct osmo_conv_code gsm0503_mcs4 = { .N = 3, .K = 7, .len = 366, .next_output = mcs4_output, .next_state = mcs4_state, }; static const uint8_t mcs5_dl_hdr_state[][2] = { { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, }; static const uint8_t mcs5_dl_hdr_output[][2] = { { 0, 7 }, { 3, 4 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 0, 7 }, { 3, 4 }, { 1, 6 }, { 2, 5 }, { 7, 0 }, { 4, 3 }, { 7, 0 }, { 4, 3 }, { 1, 6 }, { 2, 5 }, { 4, 3 }, { 7, 0 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 4, 3 }, { 7, 0 }, { 5, 2 }, { 6, 1 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 5, 2 }, { 6, 1 }, { 7, 0 }, { 4, 3 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 7, 0 }, { 4, 3 }, { 6, 1 }, { 5, 2 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 6, 1 }, { 5, 2 }, { 3, 4 }, { 0, 7 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 3, 4 }, { 0, 7 }, { 2, 5 }, { 1, 6 }, { 4, 3 }, { 7, 0 }, { 4, 3 }, { 7, 0 }, { 2, 5 }, { 1, 6 }, }; /** * EDGE MCS-5 DL header convolutional code: * 39 bits blocks, rate 1/3, k = 7 * G4 = 1 + D2 + D3 + D5 + D6 * G7 = 1 + D + D2 + D3 + D6 * G5 = 1 + D + D4 + D6 */ const struct osmo_conv_code gsm0503_mcs5_dl_hdr = { .N = 3, .K = 7, .len = 33, .next_output = mcs5_dl_hdr_output, .next_state = mcs5_dl_hdr_state, .term = CONV_TERM_TAIL_BITING, }; static const uint8_t mcs5_ul_hdr_state[][2] = { { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, }; static const uint8_t mcs5_ul_hdr_output[][2] = { { 0, 7 }, { 3, 4 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 0, 7 }, { 3, 4 }, { 1, 6 }, { 2, 5 }, { 7, 0 }, { 4, 3 }, { 7, 0 }, { 4, 3 }, { 1, 6 }, { 2, 5 }, { 4, 3 }, { 7, 0 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 4, 3 }, { 7, 0 }, { 5, 2 }, { 6, 1 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 5, 2 }, { 6, 1 }, { 7, 0 }, { 4, 3 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 7, 0 }, { 4, 3 }, { 6, 1 }, { 5, 2 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 6, 1 }, { 5, 2 }, { 3, 4 }, { 0, 7 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 3, 4 }, { 0, 7 }, { 2, 5 }, { 1, 6 }, { 4, 3 }, { 7, 0 }, { 4, 3 }, { 7, 0 }, { 2, 5 }, { 1, 6 }, }; /** * EDGE MCS-5 UL header convolutional code: * 51 bits blocks, rate 1/3, k = 7 * G4 = 1 + D2 + D3 + D5 + D6 * G7 = 1 + D + D2 + D3 + D6 * G5 = 1 + D + D4 + D6 */ const struct osmo_conv_code gsm0503_mcs5_ul_hdr = { .N = 3, .K = 7, .len = 45, .next_output = mcs5_ul_hdr_output, .next_state = mcs5_ul_hdr_state, .term = CONV_TERM_TAIL_BITING, }; static const uint8_t mcs5_state[][2] = { { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, }; static const uint8_t mcs5_output[][2] = { { 0, 7 }, { 3, 4 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 0, 7 }, { 3, 4 }, { 1, 6 }, { 2, 5 }, { 7, 0 }, { 4, 3 }, { 7, 0 }, { 4, 3 }, { 1, 6 }, { 2, 5 }, { 4, 3 }, { 7, 0 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 4, 3 }, { 7, 0 }, { 5, 2 }, { 6, 1 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 5, 2 }, { 6, 1 }, { 7, 0 }, { 4, 3 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 7, 0 }, { 4, 3 }, { 6, 1 }, { 5, 2 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 6, 1 }, { 5, 2 }, { 3, 4 }, { 0, 7 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 3, 4 }, { 0, 7 }, { 2, 5 }, { 1, 6 }, { 4, 3 }, { 7, 0 }, { 4, 3 }, { 7, 0 }, { 2, 5 }, { 1, 6 }, }; /** * EDGE MCS-5 data convolutional code: * 468 bits blocks, rate 1/3, k = 7 * G4 = 1 + D2 + D3 + D5 + D6 * G7 = 1 + D + D2 + D3 + D6 * G5 = 1 + D + D4 + D6 */ const struct osmo_conv_code gsm0503_mcs5 = { .N = 3, .K = 7, .len = 462, .next_output = mcs5_output, .next_state = mcs5_state, }; static const uint8_t mcs6_state[][2] = { { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, }; static const uint8_t mcs6_output[][2] = { { 0, 7 }, { 3, 4 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 0, 7 }, { 3, 4 }, { 1, 6 }, { 2, 5 }, { 7, 0 }, { 4, 3 }, { 7, 0 }, { 4, 3 }, { 1, 6 }, { 2, 5 }, { 4, 3 }, { 7, 0 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 4, 3 }, { 7, 0 }, { 5, 2 }, { 6, 1 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 5, 2 }, { 6, 1 }, { 7, 0 }, { 4, 3 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 7, 0 }, { 4, 3 }, { 6, 1 }, { 5, 2 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 6, 1 }, { 5, 2 }, { 3, 4 }, { 0, 7 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 3, 4 }, { 0, 7 }, { 2, 5 }, { 1, 6 }, { 4, 3 }, { 7, 0 }, { 4, 3 }, { 7, 0 }, { 2, 5 }, { 1, 6 }, }; /** * EDGE MCS-6 data convolutional code: * 612 bits blocks, rate 1/3, k = 7 * G4 = 1 + D2 + D3 + D5 + D6 * G7 = 1 + D + D2 + D3 + D6 * G5 = 1 + D + D4 + D6 */ const struct osmo_conv_code gsm0503_mcs6 = { .N = 3, .K = 7, .len = 606, .next_output = mcs6_output, .next_state = mcs6_state, }; static const uint8_t mcs7_dl_hdr_state[][2] = { { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, }; static const uint8_t mcs7_dl_hdr_output[][2] = { { 0, 7 }, { 3, 4 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 0, 7 }, { 3, 4 }, { 1, 6 }, { 2, 5 }, { 7, 0 }, { 4, 3 }, { 7, 0 }, { 4, 3 }, { 1, 6 }, { 2, 5 }, { 4, 3 }, { 7, 0 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 4, 3 }, { 7, 0 }, { 5, 2 }, { 6, 1 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 5, 2 }, { 6, 1 }, { 7, 0 }, { 4, 3 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 7, 0 }, { 4, 3 }, { 6, 1 }, { 5, 2 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 6, 1 }, { 5, 2 }, { 3, 4 }, { 0, 7 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 3, 4 }, { 0, 7 }, { 2, 5 }, { 1, 6 }, { 4, 3 }, { 7, 0 }, { 4, 3 }, { 7, 0 }, { 2, 5 }, { 1, 6 }, }; /** * EDGE MCS-7 DL header convolutional code: * 51 bits blocks, rate 1/3, k = 7 * G4 = 1 + D2 + D3 + D5 + D6 * G7 = 1 + D + D2 + D3 + D6 * G5 = 1 + D + D4 + D6 */ const struct osmo_conv_code gsm0503_mcs7_dl_hdr = { .N = 3, .K = 7, .len = 45, .next_output = mcs7_dl_hdr_output, .next_state = mcs7_dl_hdr_state, .term = CONV_TERM_TAIL_BITING, }; static const uint8_t mcs7_ul_hdr_state[][2] = { { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, }; static const uint8_t mcs7_ul_hdr_output[][2] = { { 0, 7 }, { 3, 4 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 0, 7 }, { 3, 4 }, { 1, 6 }, { 2, 5 }, { 7, 0 }, { 4, 3 }, { 7, 0 }, { 4, 3 }, { 1, 6 }, { 2, 5 }, { 4, 3 }, { 7, 0 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 4, 3 }, { 7, 0 }, { 5, 2 }, { 6, 1 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 5, 2 }, { 6, 1 }, { 7, 0 }, { 4, 3 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 7, 0 }, { 4, 3 }, { 6, 1 }, { 5, 2 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 6, 1 }, { 5, 2 }, { 3, 4 }, { 0, 7 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 3, 4 }, { 0, 7 }, { 2, 5 }, { 1, 6 }, { 4, 3 }, { 7, 0 }, { 4, 3 }, { 7, 0 }, { 2, 5 }, { 1, 6 }, }; /** * EDGE MCS-7 UL header convolutional code: * 60 bits blocks, rate 1/3, k = 7 * G4 = 1 + D2 + D3 + D5 + D6 * G7 = 1 + D + D2 + D3 + D6 * G5 = 1 + D + D4 + D6 */ const struct osmo_conv_code gsm0503_mcs7_ul_hdr = { .N = 3, .K = 7, .len = 54, .next_output = mcs7_ul_hdr_output, .next_state = mcs7_ul_hdr_state, .term = CONV_TERM_TAIL_BITING, }; static const uint8_t mcs7_state[][2] = { { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, }; static const uint8_t mcs7_output[][2] = { { 0, 7 }, { 3, 4 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 0, 7 }, { 3, 4 }, { 1, 6 }, { 2, 5 }, { 7, 0 }, { 4, 3 }, { 7, 0 }, { 4, 3 }, { 1, 6 }, { 2, 5 }, { 4, 3 }, { 7, 0 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 4, 3 }, { 7, 0 }, { 5, 2 }, { 6, 1 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 5, 2 }, { 6, 1 }, { 7, 0 }, { 4, 3 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 7, 0 }, { 4, 3 }, { 6, 1 }, { 5, 2 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 6, 1 }, { 5, 2 }, { 3, 4 }, { 0, 7 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 3, 4 }, { 0, 7 }, { 2, 5 }, { 1, 6 }, { 4, 3 }, { 7, 0 }, { 4, 3 }, { 7, 0 }, { 2, 5 }, { 1, 6 }, }; /** * EDGE MCS-7 data convolutional code: * 468 bits blocks, rate 1/3, k = 7 * G4 = 1 + D2 + D3 + D5 + D6 * G7 = 1 + D + D2 + D3 + D6 * G5 = 1 + D + D4 + D6 */ const struct osmo_conv_code gsm0503_mcs7 = { .N = 3, .K = 7, .len = 462, .next_output = mcs7_output, .next_state = mcs7_state, }; static const uint8_t mcs8_state[][2] = { { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, }; static const uint8_t mcs8_output[][2] = { { 0, 7 }, { 3, 4 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 0, 7 }, { 3, 4 }, { 1, 6 }, { 2, 5 }, { 7, 0 }, { 4, 3 }, { 7, 0 }, { 4, 3 }, { 1, 6 }, { 2, 5 }, { 4, 3 }, { 7, 0 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 4, 3 }, { 7, 0 }, { 5, 2 }, { 6, 1 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 5, 2 }, { 6, 1 }, { 7, 0 }, { 4, 3 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 7, 0 }, { 4, 3 }, { 6, 1 }, { 5, 2 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 6, 1 }, { 5, 2 }, { 3, 4 }, { 0, 7 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 3, 4 }, { 0, 7 }, { 2, 5 }, { 1, 6 }, { 4, 3 }, { 7, 0 }, { 4, 3 }, { 7, 0 }, { 2, 5 }, { 1, 6 }, }; /** * EDGE MCS-8 data convolutional code: * 564 bits blocks, rate 1/3, k = 7 * G4 = 1 + D2 + D3 + D5 + D6 * G7 = 1 + D + D2 + D3 + D6 * G5 = 1 + D + D4 + D6 */ const struct osmo_conv_code gsm0503_mcs8 = { .N = 3, .K = 7, .len = 558, .next_output = mcs8_output, .next_state = mcs8_state, }; static const uint8_t mcs9_state[][2] = { { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, { 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 14, 15 }, { 16, 17 }, { 18, 19 }, { 20, 21 }, { 22, 23 }, { 24, 25 }, { 26, 27 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { 52, 53 }, { 54, 55 }, { 56, 57 }, { 58, 59 }, { 60, 61 }, { 62, 63 }, }; static const uint8_t mcs9_output[][2] = { { 0, 7 }, { 3, 4 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 0, 7 }, { 3, 4 }, { 1, 6 }, { 2, 5 }, { 7, 0 }, { 4, 3 }, { 7, 0 }, { 4, 3 }, { 1, 6 }, { 2, 5 }, { 4, 3 }, { 7, 0 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 4, 3 }, { 7, 0 }, { 5, 2 }, { 6, 1 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 5, 2 }, { 6, 1 }, { 7, 0 }, { 4, 3 }, { 1, 6 }, { 2, 5 }, { 1, 6 }, { 2, 5 }, { 7, 0 }, { 4, 3 }, { 6, 1 }, { 5, 2 }, { 0, 7 }, { 3, 4 }, { 0, 7 }, { 3, 4 }, { 6, 1 }, { 5, 2 }, { 3, 4 }, { 0, 7 }, { 5, 2 }, { 6, 1 }, { 5, 2 }, { 6, 1 }, { 3, 4 }, { 0, 7 }, { 2, 5 }, { 1, 6 }, { 4, 3 }, { 7, 0 }, { 4, 3 }, { 7, 0 }, { 2, 5 }, { 1, 6 }, }; /** * EDGE MCS-9 data convolutional code: * 612 bits blocks, rate 1/3, k = 7 * G4 = 1 + D2 + D3 + D5 + D6 * G7 = 1 + D + D2 + D3 + D6 * G5 = 1 + D + D4 + D6 */ const struct osmo_conv_code gsm0503_mcs9 = { .N = 3, .K = 7, .len = 606, .next_output = mcs9_output, .next_state = mcs9_state, }; gr-gsm-0.41.2/lib/decoding/osmocom/coding/gsm0503_interleaving.c000066400000000000000000000265371316153413000242560ustar00rootroot00000000000000/* * (C) 2013 by Andreas Eversberg * (C) 2016 by Tom Tsou * * All Rights Reserved * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include #include #include #include "gsm0503_tables.h" #include "gsm0503_interleaving.h" /* * GSM xCCH interleaving and burst mapping * * Interleaving: * * Given 456 coded input bits, form 4 blocks of 114 bits: * * i(B, j) = c(n, k) k = 0, ..., 455 * n = 0, ..., N, N + 1, ... * B = B_0 + 4n + (k mod 4) * j = 2(49k mod 57) + ((k mod 8) div 4) * * Mapping on Burst: * * e(B, j) = i(B, j) * e(B, 59 + j) = i(B, 57 + j) j = 0, ..., 56 * e(B, 57) = h_l(B) * e(B, 58) = h_n(B) * * Where hl(B) and hn(B) are bits in burst B indicating flags. */ void gsm0503_xcch_deinterleave(sbit_t *cB, const sbit_t *iB) { int j, k, B; for (k = 0; k < 456; k++) { B = k & 3; j = 2 * ((49 * k) % 57) + ((k & 7) >> 2); cB[k] = iB[B * 114 + j]; } } void gsm0503_xcch_interleave(ubit_t *cB, ubit_t *iB) { int j, k, B; for (k = 0; k < 456; k++) { B = k & 3; j = 2 * ((49 * k) % 57) + ((k & 7) >> 2); iB[B * 114 + j] = cB[k]; } } void gsm0503_mcs1_dl_deinterleave(sbit_t *u, sbit_t *hc, sbit_t *dc, const sbit_t *iB) { int k; sbit_t c[452]; sbit_t cp[456]; gsm0503_xcch_deinterleave(cp, iB); for (k = 0; k < 25; k++) c[k] = cp[k]; for (k = 26; k < 82; k++) c[k - 1] = cp[k]; for (k = 83; k < 139; k++) c[k - 2] = cp[k]; for (k = 140; k < 424; k++) c[k - 3] = cp[k]; for (k = 425; k < 456; k++) c[k - 4] = cp[k]; if (u) { for (k = 0; k < 12; k++) u[k] = c[k]; } if (hc) { for (k = 12; k < 80; k++) hc[k - 12] = c[k]; } if (dc) { for (k = 80; k < 452; k++) dc[k - 80] = c[k]; } } void gsm0503_mcs1_dl_interleave(const ubit_t *up, const ubit_t *hc, const ubit_t *dc, ubit_t *iB) { int k; ubit_t c[452]; ubit_t cp[456]; for (k = 0; k < 12; k++) c[k] = up[k]; for (k = 12; k < 80; k++) c[k] = hc[k - 12]; for (k = 80; k < 452; k++) c[k] = dc[k - 80]; for (k = 0; k < 25; k++) cp[k] = c[k]; for (k = 26; k < 82; k++) cp[k] = c[k - 1]; for (k = 83; k < 139; k++) cp[k] = c[k - 2]; for (k = 140; k < 424; k++) cp[k] = c[k - 3]; for (k = 425; k < 456; k++) cp[k] = c[k - 4]; cp[25] = 0; cp[82] = 0; cp[139] = 0; cp[424] = 0; gsm0503_xcch_interleave(cp, iB); } void gsm0503_mcs1_ul_deinterleave(sbit_t *hc, sbit_t *dc, const sbit_t *iB) { int k; sbit_t c[452]; sbit_t cp[456]; gsm0503_xcch_deinterleave(cp, iB); for (k = 0; k < 25; k++) c[k] = cp[k]; for (k = 26; k < 82; k++) c[k - 1] = cp[k]; for (k = 83; k < 139; k++) c[k - 2] = cp[k]; for (k = 140; k < 424; k++) c[k - 3] = cp[k]; for (k = 425; k < 456; k++) c[k - 4] = cp[k]; if (hc) { for (k = 0; k < 80; k++) hc[k] = c[k]; } if (dc) { for (k = 80; k < 452; k++) dc[k - 80] = c[k]; } } void gsm0503_mcs1_ul_interleave(const ubit_t *hc, const ubit_t *dc, ubit_t *iB) { int k; ubit_t c[452]; ubit_t cp[456]; for (k = 0; k < 80; k++) c[k] = hc[k]; for (k = 80; k < 452; k++) c[k] = dc[k - 80]; for (k = 0; k < 25; k++) cp[k] = c[k]; for (k = 26; k < 82; k++) cp[k] = c[k - 1]; for (k = 83; k < 139; k++) cp[k] = c[k - 2]; for (k = 140; k < 424; k++) cp[k] = c[k - 3]; for (k = 425; k < 456; k++) cp[k] = c[k - 4]; cp[25] = 0; cp[82] = 0; cp[139] = 0; cp[424] = 0; gsm0503_xcch_interleave(cp, iB); } void gsm0503_mcs5_ul_interleave(const ubit_t *hc, const ubit_t *dc, ubit_t *hi, ubit_t *di) { int j, k; /* Header */ for (k = 0; k < 136; k++) { j = 34 * (k % 4) + 2 * (11 * k % 17) + k % 8 / 4; hi[j] = hc[k]; } /* Data */ for (k = 0; k < 1248; k++) { j = gsm0503_interleave_mcs5[k]; di[j] = dc[k]; } } void gsm0503_mcs5_ul_deinterleave(sbit_t *hc, sbit_t *dc, const sbit_t *hi, const sbit_t *di) { int j, k; /* Header */ if (hc) { for (k = 0; k < 136; k++) { j = 34 * (k % 4) + 2 * (11 * k % 17) + k % 8 / 4; hc[k] = hi[j]; } } /* Data */ if (dc) { for (k = 0; k < 1248; k++) { j = gsm0503_interleave_mcs5[k]; dc[k] = di[j]; } } } void gsm0503_mcs5_dl_interleave(const ubit_t *hc, const ubit_t *dc, ubit_t *hi, ubit_t *di) { int j, k; /* Header */ for (k = 0; k < 100; k++) { j = 25 * (k % 4) + ((17 * k) % 25); hi[j] = hc[k]; } /* Data */ for (k = 0; k < 1248; k++) { j = gsm0503_interleave_mcs5[k]; di[j] = dc[k]; } } void gsm0503_mcs5_dl_deinterleave(sbit_t *hc, sbit_t *dc, const sbit_t *hi, const sbit_t *di) { int j, k; /* Header */ if (hc) { for (k = 0; k < 100; k++) { j = 25 * (k % 4) + ((17 * k) % 25); hc[k] = hi[j]; } } /* Data */ if (dc) { for (k = 0; k < 1248; k++) { j = gsm0503_interleave_mcs5[k]; dc[k] = di[j]; } } } void gsm0503_mcs7_dl_interleave(const ubit_t *hc, const ubit_t *c1, const ubit_t *c2, ubit_t *hi, ubit_t *di) { int j, k; ubit_t dc[1224]; /* Header */ for (k = 0; k < 124; k++) { j = 31 * (k % 4) + ((17 * k) % 31); hi[j] = hc[k]; } memcpy(&dc[0], c1, 612); memcpy(&dc[612], c2, 612); /* Data */ for (k = 0; k < 1224; k++) { j = 306 * (k % 4) + 3 * (44 * k % 102 + k / 4 % 2) + (k + 2 - k / 408) % 3; di[j] = dc[k]; } } void gsm0503_mcs7_dl_deinterleave(sbit_t *hc, sbit_t *c1, sbit_t *c2, const sbit_t *hi, const sbit_t *di) { int j, k; ubit_t dc[1224]; /* Header */ if (hc) { for (k = 0; k < 124; k++) { j = 31 * (k % 4) + ((17 * k) % 31); hc[k] = hi[j]; } } /* Data */ if (c1 && c2) { for (k = 0; k < 1224; k++) { j = 306 * (k % 4) + 3 * (44 * k % 102 + k / 4 % 2) + (k + 2 - k / 408) % 3; dc[k] = di[j]; } memcpy(c1, &dc[0], 612); memcpy(c2, &dc[612], 612); } } void gsm0503_mcs7_ul_interleave(const ubit_t *hc, const ubit_t *c1, const ubit_t *c2, ubit_t *hi, ubit_t *di) { int j, k; ubit_t dc[1224]; /* Header */ for (k = 0; k < 160; k++) { j = 40 * (k % 4) + 2 * (13 * (k / 8) % 20) + k % 8 / 4; hi[j] = hc[k]; } memcpy(&dc[0], c1, 612); memcpy(&dc[612], c2, 612); /* Data */ for (k = 0; k < 1224; k++) { j = 306 * (k % 4) + 3 * (44 * k % 102 + k / 4 % 2) + (k + 2 - k / 408) % 3; di[j] = dc[k]; } } void gsm0503_mcs7_ul_deinterleave(sbit_t *hc, sbit_t *c1, sbit_t *c2, const sbit_t *hi, const sbit_t *di) { int j, k; ubit_t dc[1224]; /* Header */ if (hc) { for (k = 0; k < 160; k++) { j = 40 * (k % 4) + 2 * (13 * (k / 8) % 20) + k % 8 / 4; hc[k] = hi[j]; } } /* Data */ if (c1 && c2) { for (k = 0; k < 1224; k++) { j = 306 * (k % 4) + 3 * (44 * k % 102 + k / 4 % 2) + (k + 2 - k / 408) % 3; dc[k] = di[j]; } memcpy(c1, &dc[0], 612); memcpy(c2, &dc[612], 612); } } void gsm0503_mcs8_ul_interleave(const ubit_t *hc, const ubit_t *c1, const ubit_t *c2, ubit_t *hi, ubit_t *di) { int j, k; ubit_t dc[1224]; /* Header */ for (k = 0; k < 160; k++) { j = 40 * (k % 4) + 2 * (13 * (k / 8) % 20) + k % 8 / 4; hi[j] = hc[k]; } memcpy(&dc[0], c1, 612); memcpy(&dc[612], c2, 612); /* Data */ for (k = 0; k < 1224; k++) { j = 306 * (2 * (k / 612) + (k % 2)) + 3 * (74 * k % 102 + k / 2 % 2) + (k + 2 - k / 204) % 3; di[j] = dc[k]; } } void gsm0503_mcs8_ul_deinterleave(sbit_t *hc, sbit_t *c1, sbit_t *c2, const sbit_t *hi, const sbit_t *di) { int j, k; ubit_t dc[1224]; /* Header */ if (hc) { for (k = 0; k < 160; k++) { j = 40 * (k % 4) + 2 * (13 * (k / 8) % 20) + k % 8 / 4; hc[k] = hi[j]; } } /* Data */ if (c1 && c2) { for (k = 0; k < 1224; k++) { j = 306 * (2 * (k / 612) + (k % 2)) + 3 * (74 * k % 102 + k / 2 % 2) + (k + 2 - k / 204) % 3; dc[k] = di[j]; } memcpy(c1, &dc[0], 612); memcpy(c2, &dc[612], 612); } } void gsm0503_mcs8_dl_interleave(const ubit_t *hc, const ubit_t *c1, const ubit_t *c2, ubit_t *hi, ubit_t *di) { int j, k; ubit_t dc[1224]; /* Header */ for (k = 0; k < 124; k++) { j = 31 * (k % 4) + ((17 * k) % 31); hi[j] = hc[k]; } memcpy(&dc[0], c1, 612); memcpy(&dc[612], c2, 612); /* Data */ for (k = 0; k < 1224; k++) { j = 306 * (2 * (k / 612) + (k % 2)) + 3 * (74 * k % 102 + k / 2 % 2) + (k + 2 - k / 204) % 3; di[j] = dc[k]; } } void gsm0503_mcs8_dl_deinterleave(sbit_t *hc, sbit_t *c1, sbit_t *c2, const sbit_t *hi, const sbit_t *di) { int j, k; ubit_t dc[1224]; /* Header */ if (hc) { for (k = 0; k < 124; k++) { j = 31 * (k % 4) + ((17 * k) % 31); hc[k] = hi[j]; } } /* Data */ if (c1 && c2) { for (k = 0; k < 1224; k++) { j = 306 * (2 * (k / 612) + (k % 2)) + 3 * (74 * k % 102 + k / 2 % 2) + (k + 2 - k / 204) % 3; dc[k] = di[j]; } memcpy(c1, &dc[0], 612); memcpy(c2, &dc[612], 612); } } /* * GSM TCH FR/EFR/AFS interleaving and burst mapping * * Interleaving: * * Given 456 coded input bits, form 8 blocks of 114 bits, * where even bits of the first 4 blocks and odd bits of the last 4 blocks * are used: * * i(B, j) = c(n, k) k = 0, ..., 455 * n = 0, ..., N, N + 1, ... * B = B_0 + 4n + (k mod 8) * j = 2(49k mod 57) + ((k mod 8) div 4) * * Mapping on Burst: * * e(B, j) = i(B, j) * e(B, 59 + j) = i(B, 57 + j) j = 0, ..., 56 * e(B, 57) = h_l(B) * e(B, 58) = h_n(B) * * Where hl(B) and hn(B) are bits in burst B indicating flags. */ void gsm0503_tch_fr_deinterleave(sbit_t *cB, sbit_t *iB) { int j, k, B; for (k = 0; k < 456; k++) { B = k & 7; j = 2 * ((49 * k) % 57) + ((k & 7) >> 2); cB[k] = iB[B * 114 + j]; } } void gsm0503_tch_fr_interleave(ubit_t *cB, ubit_t *iB) { int j, k, B; for (k = 0; k < 456; k++) { B = k & 7; j = 2 * ((49 * k) % 57) + ((k & 7) >> 2); iB[B * 114 + j] = cB[k]; } } /* * GSM TCH HR/AHS interleaving and burst mapping * * Interleaving: * * Given 288 coded input bits, form 4 blocks of 114 bits, * where even bits of the first 2 blocks and odd bits of the last 2 blocks * are used: * * i(B, j) = c(n, k) k = 0, ..., 227 * n = 0, ..., N, N + 1, ... * B = B_0 + 2n + b * j, b = table[k]; * * Mapping on Burst: * * e(B, j) = i(B, j) * e(B, 59 + j) = i(B, 57 + j) j = 0, ..., 56 * e(B, 57) = h_l(B) * e(B, 58) = h_n(B) * * Where hl(B) and hn(B) are bits in burst B indicating flags. */ void gsm0503_tch_hr_deinterleave(sbit_t *cB, sbit_t *iB) { int j, k, B; for (k = 0; k < 228; k++) { B = gsm0503_tch_hr_interleaving[k][1]; j = gsm0503_tch_hr_interleaving[k][0]; cB[k] = iB[B * 114 + j]; } } void gsm0503_tch_hr_interleave(ubit_t *cB, ubit_t *iB) { int j, k, B; for (k = 0; k < 228; k++) { B = gsm0503_tch_hr_interleaving[k][1]; j = gsm0503_tch_hr_interleaving[k][0]; iB[B * 114 + j] = cB[k]; } } gr-gsm-0.41.2/lib/decoding/osmocom/coding/gsm0503_interleaving.h000066400000000000000000000054561316153413000242600ustar00rootroot00000000000000/* * (C) 2013 by Andreas Eversberg * (C) 2016 by Tom Tsou * * All Rights Reserved * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #pragma once #include void gsm0503_xcch_deinterleave(sbit_t *cB, const sbit_t *iB); void gsm0503_xcch_interleave(ubit_t *cB, ubit_t *iB); void gsm0503_tch_fr_deinterleave(sbit_t *cB, sbit_t *iB); void gsm0503_tch_fr_interleave(ubit_t *cB, ubit_t *iB); void gsm0503_tch_hr_deinterleave(sbit_t *cB, sbit_t *iB); void gsm0503_tch_hr_interleave(ubit_t *cB, ubit_t *iB); void gsm0503_mcs1_ul_deinterleave(sbit_t *hc, sbit_t *dc, const sbit_t *iB); void gsm0503_mcs1_ul_interleave(const ubit_t *hc, const ubit_t *dc, ubit_t *iB); void gsm0503_mcs1_dl_deinterleave(sbit_t *u, sbit_t *hc, sbit_t *dc, const sbit_t *iB); void gsm0503_mcs1_dl_interleave(const ubit_t *up, const ubit_t *hc, const ubit_t *dc, ubit_t *iB); void gsm0503_mcs5_ul_deinterleave(sbit_t *hc, sbit_t *dc, const sbit_t *hi, const sbit_t *di); void gsm0503_mcs5_ul_interleave(const ubit_t *hc, const ubit_t *dc, ubit_t *hi, ubit_t *di); void gsm0503_mcs5_dl_deinterleave(sbit_t *hc, sbit_t *dc, const sbit_t *hi, const sbit_t *di); void gsm0503_mcs5_dl_interleave(const ubit_t *hc, const ubit_t *dc, ubit_t *hi, ubit_t *di); void gsm0503_mcs7_ul_deinterleave(sbit_t *hc, sbit_t *c1, sbit_t *c2, const sbit_t *hi, const sbit_t *di); void gsm0503_mcs7_ul_interleave(const ubit_t *hc, const ubit_t *c1, const ubit_t *c2, ubit_t *hi, ubit_t *di); void gsm0503_mcs7_dl_deinterleave(sbit_t *hc, sbit_t *c1, sbit_t *c2, const sbit_t *hi, const sbit_t *di); void gsm0503_mcs7_dl_interleave(const ubit_t *hc, const ubit_t *c1, const ubit_t *c2, ubit_t *hi, ubit_t *di); void gsm0503_mcs8_ul_deinterleave(sbit_t *hc, sbit_t *c1, sbit_t *c2, const sbit_t *hi, const sbit_t *di); void gsm0503_mcs8_ul_interleave(const ubit_t *hc, const ubit_t *c1, const ubit_t *c2, ubit_t *hi, ubit_t *di); void gsm0503_mcs8_dl_deinterleave(sbit_t *hc, sbit_t *c1, sbit_t *c2, const sbit_t *hi, const sbit_t *di); void gsm0503_mcs8_dl_interleave(const ubit_t *hc, const ubit_t *c1, const ubit_t *c2, ubit_t *hi, ubit_t *di); gr-gsm-0.41.2/lib/decoding/osmocom/coding/gsm0503_mapping.c000066400000000000000000000144261316153413000232140ustar00rootroot00000000000000/* * (C) 2013 by Andreas Eversberg * (C) 2016 by Tom Tsou * * All Rights Reserved * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include #include #include #include "gsm0503_mapping.h" void gsm0503_xcch_burst_unmap(sbit_t *iB, const sbit_t *eB, sbit_t *hl, sbit_t *hn) { memcpy(iB, eB, 57); memcpy(iB + 57, eB + 59, 57); if (hl) *hl = eB[57]; if (hn) *hn = eB[58]; } void gsm0503_xcch_burst_map(ubit_t *iB, ubit_t *eB, const ubit_t *hl, const ubit_t *hn) { memcpy(eB, iB, 57); memcpy(eB + 59, iB + 57, 57); if (hl) eB[57] = *hl; if (hn) eB[58] = *hn; } void gsm0503_tch_burst_unmap(sbit_t *iB, sbit_t *eB, sbit_t *h, int odd) { int i; /* brainfuck: only copy even or odd bits */ if (iB) { for (i = odd; i < 57; i += 2) iB[i] = eB[i]; for (i = 58 - odd; i < 114; i += 2) iB[i] = eB[i + 2]; } if (h) { if (!odd) *h = eB[58]; else *h = eB[57]; } } void gsm0503_tch_burst_map(ubit_t *iB, ubit_t *eB, const ubit_t *h, int odd) { int i; /* brainfuck: only copy even or odd bits */ if (eB) { for (i = odd; i < 57; i += 2) eB[i] = iB[i]; for (i = 58 - odd; i < 114; i += 2) eB[i + 2] = iB[i]; } if (h) { if (!odd) eB[58] = *h; else eB[57] = *h; } } void gsm0503_mcs5_dl_burst_map(const ubit_t *di, ubit_t *eB, const ubit_t *hi, const ubit_t *up, int B) { int j; int q[8] = { 0, 0, 0, 0, 0, 0, 0, 0, }; for (j = 0; j < 156; j++) eB[j] = di[312 * B + j]; for (j = 156; j < 168; j++) eB[j] = hi[25 * B + j - 156]; for (j = 168; j < 174; j++) eB[j] = up[9 * B + j - 168]; for (j = 174; j < 176; j++) eB[j] = q[2 * B + j - 174]; for (j = 176; j < 179; j++) eB[j] = up[9 * B + j - 170]; for (j = 179; j < 192; j++) eB[j] = hi[25 * B + j - 167]; for (j = 192; j < 348; j++) eB[j] = di[312 * B + j - 36]; } void gsm0503_mcs5_dl_burst_unmap(sbit_t *di, const sbit_t *eB, sbit_t *hi, sbit_t *up, int B) { int j; for (j = 0; j < 156; j++) di[312 * B + j] = eB[j]; for (j = 156; j < 168; j++) hi[25 * B + j - 156] = eB[j]; for (j = 168; j < 174; j++) up[9 * B + j - 168] = eB[j]; for (j = 176; j < 179; j++) up[9 * B + j - 170] = eB[j]; for (j = 179; j < 192; j++) hi[25 * B + j - 167] = eB[j]; for (j = 192; j < 348; j++) di[312 * B + j - 36] = eB[j]; } void gsm0503_mcs5_ul_burst_map(const ubit_t *di, ubit_t *eB, const ubit_t *hi, int B) { int j; for (j = 0; j < 156; j++) eB[j] = di[312 * B + j]; for (j = 156; j < 174; j++) eB[j] = hi[34 * B + j - 156]; for (j = 174; j < 176; j++) eB[j] = 0; for (j = 176; j < 192; j++) eB[j] = hi[34 * B + j - 158]; for (j = 192; j < 348; j++) eB[j] = di[312 * B + j - 36]; } void gsm0503_mcs5_ul_burst_unmap(sbit_t *di, const sbit_t *eB, sbit_t *hi, int B) { int j; for (j = 0; j < 156; j++) di[312 * B + j] = eB[j]; for (j = 156; j < 174; j++) hi[34 * B + j - 156] = eB[j]; for (j = 176; j < 192; j++) hi[34 * B + j - 158] = eB[j]; for (j = 192; j < 348; j++) di[312 * B + j - 36] = eB[j]; } void gsm0503_mcs7_dl_burst_map(const ubit_t *di, ubit_t *eB, const ubit_t *hi, const ubit_t *up, int B) { int j; int q[8] = { 1, 1, 1, 0, 0, 1, 1, 1, }; for (j = 0; j < 153; j++) eB[j] = di[306 * B + j]; for (j = 153; j < 168; j++) eB[j] = hi[31 * B + j - 153]; for (j = 168; j < 174; j++) eB[j] = up[9 * B + j - 168]; for (j = 174; j < 176; j++) eB[j] = q[2 * B + j - 174]; for (j = 176; j < 179; j++) eB[j] = up[9 * B + j - 170]; for (j = 179; j < 195; j++) eB[j] = hi[31 * B + j - 164]; for (j = 195; j < 348; j++) eB[j] = di[306 * B + j - 42]; } void gsm0503_mcs7_dl_burst_unmap(sbit_t *di, const sbit_t *eB, sbit_t *hi, sbit_t *up, int B) { int j; for (j = 0; j < 153; j++) di[306 * B + j] = eB[j]; for (j = 153; j < 168; j++) hi[31 * B + j - 153] = eB[j]; for (j = 168; j < 174; j++) up[9 * B + j - 168] = eB[j]; for (j = 176; j < 179; j++) up[9 * B + j - 170] = eB[j]; for (j = 179; j < 195; j++) hi[31 * B + j - 164] = eB[j]; for (j = 195; j < 348; j++) di[306 * B + j - 42] = eB[j]; } void gsm0503_mcs7_ul_burst_map(const ubit_t *di, ubit_t *eB, const ubit_t *hi, int B) { int j; int q[8] = { 1, 1, 1, 0, 0, 1, 1, 1, }; for (j = 0; j < 153; j++) eB[j] = di[306 * B + j]; for (j = 153; j < 174; j++) eB[j] = hi[40 * B + j - 153]; for (j = 174; j < 176; j++) eB[j] = q[2 * B + j - 174]; for (j = 176; j < 195; j++) eB[j] = hi[40 * B + j - 155]; for (j = 195; j < 348; j++) eB[j] = di[306 * B + j - 42]; } void gsm0503_mcs7_ul_burst_unmap(sbit_t *di, const sbit_t *eB, sbit_t *hi, int B) { int j; for (j = 0; j < 153; j++) di[306 * B + j] = eB[j]; for (j = 153; j < 174; j++) hi[40 * B + j - 153] = eB[j]; for (j = 176; j < 195; j++) hi[40 * B + j - 155] = eB[j]; for (j = 195; j < 348; j++) di[306 * B + j - 42] = eB[j]; } void gsm0503_mcs5_burst_swap(sbit_t *eB) { sbit_t t[14]; t[0] = eB[155]; t[1] = eB[158]; t[2] = eB[161]; t[3] = eB[164]; t[4] = eB[167]; t[5] = eB[170]; t[6] = eB[173]; t[7] = eB[195]; t[8] = eB[196]; t[9] = eB[198]; t[10] = eB[199]; t[11] = eB[201]; t[12] = eB[202]; t[13] = eB[204]; eB[155] = eB[142]; eB[158] = eB[144]; eB[161] = eB[145]; eB[164] = eB[147]; eB[167] = eB[148]; eB[170] = eB[150]; eB[173] = eB[151]; eB[195] = eB[176]; eB[196] = eB[179]; eB[198] = eB[182]; eB[199] = eB[185]; eB[201] = eB[188]; eB[202] = eB[191]; eB[204] = eB[194]; eB[142] = t[0]; eB[144] = t[1]; eB[145] = t[2]; eB[147] = t[3]; eB[148] = t[4]; eB[150] = t[5]; eB[151] = t[6]; eB[176] = t[7]; eB[179] = t[8]; eB[182] = t[9]; eB[185] = t[10]; eB[188] = t[11]; eB[191] = t[12]; eB[194] = t[13]; } gr-gsm-0.41.2/lib/decoding/osmocom/coding/gsm0503_mapping.h000066400000000000000000000037501316153413000232170ustar00rootroot00000000000000/* * (C) 2013 by Andreas Eversberg * (C) 2016 by Tom Tsou * * All Rights Reserved * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #pragma once #include void gsm0503_xcch_burst_unmap(sbit_t *iB, const sbit_t *eB, sbit_t *hl, sbit_t *hn); void gsm0503_xcch_burst_map(ubit_t *iB, ubit_t *eB, const ubit_t *hl, const ubit_t *hn); void gsm0503_tch_burst_unmap(sbit_t *iB, sbit_t *eB, sbit_t *h, int odd); void gsm0503_tch_burst_map(ubit_t *iB, ubit_t *eB, const ubit_t *h, int odd); void gsm0503_mcs5_ul_burst_map(const ubit_t *di, ubit_t *eB, const ubit_t *hi, int B); void gsm0503_mcs5_ul_burst_unmap(sbit_t *di, const sbit_t *eB, sbit_t *hi, int B); void gsm0503_mcs7_ul_burst_map(const ubit_t *di, ubit_t *eB, const ubit_t *hi, int B); void gsm0503_mcs7_ul_burst_unmap(sbit_t *di, const sbit_t *eB, sbit_t *hi, int B); void gsm0503_mcs5_dl_burst_map(const ubit_t *di, ubit_t *eB, const ubit_t *hi, const ubit_t *up, int B); void gsm0503_mcs5_dl_burst_unmap(sbit_t *di, const sbit_t *eB, sbit_t *hi, sbit_t *up, int B); void gsm0503_mcs7_dl_burst_map(const ubit_t *di, ubit_t *eB, const ubit_t *hi, const ubit_t *up, int B); void gsm0503_mcs7_dl_burst_unmap(sbit_t *di, const sbit_t *eB, sbit_t *hi, sbit_t *up, int B); void gsm0503_mcs5_burst_swap(sbit_t *eB); gr-gsm-0.41.2/lib/decoding/osmocom/coding/gsm0503_parity.c000066400000000000000000000052041316153413000230630ustar00rootroot00000000000000/* * (C) 2013 by Andreas Eversberg * (C) 2016 by Tom Tsou * * All Rights Reserved * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include #include #include "gsm0503_parity.h" /* * GSM (SACCH) parity (FIRE code) * * g(x) = (x^23 + 1)(x^17 + x^3 + 1) * = x^40 + x^26 + x^23 + x^17 + x^3 + a1 */ const struct osmo_crc64gen_code gsm0503_fire_crc40 = { .bits = 40, .poly = 0x0004820009ULL, .init = 0x0000000000ULL, .remainder = 0xffffffffffULL, }; /* * GSM PDTCH CS-2, CS-3, CS-4 parity * * g(x) = x^16 + x^12 + x^5 + 1 */ const struct osmo_crc16gen_code gsm0503_cs234_crc16 = { .bits = 16, .poly = 0x1021, .init = 0x0000, .remainder = 0xffff, }; /* * EDGE MCS header parity * */ const struct osmo_crc8gen_code gsm0503_mcs_crc8_hdr = { .bits = 8, .poly = 0x49, .init = 0x00, .remainder = 0xff, }; /* * EDGE MCS data parity * */ const struct osmo_crc16gen_code gsm0503_mcs_crc12 = { .bits = 12, .poly = 0x0d31, .init = 0x0000, .remainder = 0x0fff, }; /* * GSM RACH parity * * g(x) = x^6 + x^5 + x^3 + x^2 + x^1 + 1 */ const struct osmo_crc8gen_code gsm0503_rach_crc6 = { .bits = 6, .poly = 0x2f, .init = 0x00, .remainder = 0x3f, }; /* * GSM SCH parity * * g(x) = x^10 + x^8 + x^6 + x^5 + x^4 + x^2 + 1 */ const struct osmo_crc16gen_code gsm0503_sch_crc10 = { .bits = 10, .poly = 0x175, .init = 0x000, .remainder = 0x3ff, }; /* * GSM TCH FR/HR/EFR parity * * g(x) = x^3 + x + 1 */ const struct osmo_crc8gen_code gsm0503_tch_fr_crc3 = { .bits = 3, .poly = 0x3, .init = 0x0, .remainder = 0x7, }; /* * GSM TCH EFR parity * * g(x) = x^8 + x^4 + x^3 + x^2 + 1 */ const struct osmo_crc8gen_code gsm0503_tch_efr_crc8 = { .bits = 8, .poly = 0x1d, .init = 0x00, .remainder = 0x00, }; /* * GSM AMR parity * * g(x) = x^6 + x^5 + x^3 + x^2 + x^1 + 1 */ const struct osmo_crc8gen_code gsm0503_amr_crc6 = { .bits = 6, .poly = 0x2f, .init = 0x00, .remainder = 0x3f, }; gr-gsm-0.41.2/lib/decoding/osmocom/coding/gsm0503_parity.h000066400000000000000000000025261316153413000230740ustar00rootroot00000000000000/* * (C) 2013 by Andreas Eversberg * (C) 2016 by Tom Tsou * * All Rights Reserved * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #pragma once #include const struct osmo_crc64gen_code gsm0503_fire_crc40; const struct osmo_crc16gen_code gsm0503_cs234_crc16; const struct osmo_crc8gen_code gsm0503_mcs_crc8_hdr; const struct osmo_crc16gen_code gsm0503_mcs_crc12; const struct osmo_crc8gen_code gsm0503_rach_crc6; const struct osmo_crc16gen_code gsm0503_sch_crc10; const struct osmo_crc8gen_code gsm0503_tch_fr_crc3; const struct osmo_crc8gen_code gsm0503_tch_efr_crc8; const struct osmo_crc8gen_code gsm0503_amr_crc6; gr-gsm-0.41.2/lib/decoding/osmocom/coding/gsm0503_tables.c000066400000000000000000002527741316153413000230450ustar00rootroot00000000000000/* * (C) 2013 by Andreas Eversberg * (C) 2016 by Tom Tsou * * All Rights Reserved * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include #include #include "gsm0503_tables.h" const ubit_t gsm0503_pdtch_hl_hn_ubit[4][8] = { { 1,1, 1,1, 1,1, 1,1 }, { 1,1, 0,0, 1,0, 0,0 }, { 0,0, 1,0, 0,0, 0,1 }, { 0,0, 0,1, 0,1, 1,0 }, }; const ubit_t gsm0503_pdtch_edge_hl_hn_ubit[3][8] = { { 0,0, 0,1, 0,1, 1,0 }, { 0,0, 0,0, 0,0, 0,0 }, { 1,1, 1,0, 0,1, 1,1 }, }; const sbit_t gsm0503_pdtch_hl_hn_sbit[4][8] = { { -127,-127, -127,-127, -127,-127, -127,-127 }, { -127,-127, 127, 127, -127, 127, 127, 127 }, { 127, 127, -127, 127, 127, 127, 127,-127 }, { 127, 127, 127,-127, 127,-127, -127, 127 }, }; const sbit_t gsm0503_pdtch_edge_hl_hn_sbit[3][8] = { { 127, 127, 127,-127, 127,-127, -127, 127 }, { 127, 127, 127, 127, 127, 127, 127, 127 }, { -127,-127, -127, 127, 127,-127, -127,-127 }, }; const ubit_t gsm0503_usf2six[8][6] = { { 0,0,0, 0,0,0 }, { 1,0,0, 1,0,1 }, { 0,1,0, 1,1,0 }, { 1,1,0, 0,1,1 }, { 0,0,1, 0,1,1 }, { 1,0,1, 1,1,0 }, { 0,1,1, 1,0,1 }, { 1,1,1, 0,0,0 }, }; const ubit_t gsm0503_usf2twelve_ubit[8][12] = { { 0,0,0, 0,0,0, 0,0,0, 0,0,0 }, { 1,1,0, 1,0,0, 0,0,1, 0,1,1 }, { 0,0,1, 1,0,1, 1,1,0, 1,1,0 }, { 1,1,1, 0,0,1, 1,1,1, 1,0,1 }, { 0,0,0, 0,1,1, 0,1,1, 1,0,1 }, { 1,1,0, 1,1,1, 0,1,0, 1,1,0 }, { 0,0,1, 1,1,0, 1,0,1, 0,1,1 }, { 1,1,1, 0,1,0, 1,0,0, 0,0,0 }, }; const sbit_t gsm0503_usf2twelve_sbit[8][12] = { { 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }, { -127,-127, 127, -127, 127, 127, 127, 127,-127, 127,-127,-127 }, { 127, 127,-127, -127, 127,-127, -127,-127, 127, -127,-127, 127 }, { -127,-127,-127, 127, 127,-127, -127,-127,-127, -127, 127,-127 }, { 127, 127, 127, 127,-127,-127, 127,-127,-127, -127, 127,-127 }, { -127,-127, 127, -127,-127,-127, 127,-127, 127, -127,-127, 127 }, { 127, 127,-127, -127,-127, 127, -127, 127,-127, 127,-127,-127 }, { -127,-127,-127, 127,-127, 127, -127, 127, 127, 127, 127, 127 }, }; const uint8_t gsm0503_puncture_cs2[588] = { 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,0, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,0, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,0, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,0, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,0, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,0, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,0, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,0, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,0, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,0, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,0, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,0, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1, 0,0,0,1 }; const uint8_t gsm0503_puncture_cs3[676] = { 0,0,0,0,0,0, 0,0,0,0,0,0, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,1,0,1, 0,0,0,0 }; const uint8_t gsm0503_puncture_mcs1_dl_hdr[108] = { 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,1,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,1,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,1,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,1,1, }; const uint8_t gsm0503_puncture_mcs1_ul_hdr[117] = { 0,0,0,0,0,1,0,0,1,0,0,1, 0,0,0,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1, }; const uint8_t gsm0503_puncture_mcs1_p1[588] = { 0,0,1,0,0,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,0,0,1,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,1, }; const uint8_t gsm0503_puncture_mcs1_p2[588] = { 0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0, 0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0, 0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0, 0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,0,1,0, 0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0, 0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0, 0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,0,1,0, 0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0, 0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0, 0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,0,1,0, 0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0, 0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0, 0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,0,1,0, 0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0, 0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0, 0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,0,1,0, 0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0, 0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0, 0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,0,1,0, 0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0, 0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0, 0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,0,1,0, 0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0, 0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0, 0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,0,1,0, 0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0, 0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0, 0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0, }; const uint8_t gsm0503_puncture_mcs2_p1[732] = { 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,0,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,0,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,0,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,0,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,0,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,0,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, 0,0,1,1,1,0, }; const uint8_t gsm0503_puncture_mcs2_p2[732] = { 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 0,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 0,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 0,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 0,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 0,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 0,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, 1,1,0,0,0,1, }; const uint8_t gsm0503_puncture_mcs3_p1[948] = { 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0, 0,0,1,0,1,1,0,1,1,1,0,1, }; const uint8_t gsm0503_puncture_mcs3_p2[948] = { 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1, }; const uint8_t gsm0503_puncture_mcs3_p3[948] = { 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0, }; const uint8_t gsm0503_puncture_mcs4_p1[1116] = { 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, }; const uint8_t gsm0503_puncture_mcs4_p2[1116] = { 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, }; const uint8_t gsm0503_puncture_mcs4_p3[1116] = { 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, }; const uint8_t gsm0503_puncture_mcs5_p1[1404] = { 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0, 0,0,1,0,0,1,0,0,1, 0,0,1,0,0,1,0,0,1, }; const uint8_t gsm0503_puncture_mcs5_p2[1404] = { 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0, 0,1,0,0,1,0,0,1,0, 0,1,0,0,1,0,0,1,0, }; const uint8_t gsm0503_puncture_mcs6_p1[1836] = { 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,0, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,0, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,0, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,0, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,0, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,0, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,0, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,0, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,0, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,0, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,0, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,0, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,0, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,0, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,0, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,0, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,0, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,0, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,0, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,0, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,0, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,0, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,0, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,0, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, }; const uint8_t gsm0503_puncture_mcs6_p2[1836] = { 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,0,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,0,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,0,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,0,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,0,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,0,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,0,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,0,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,0,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,0,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,0,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,0,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,0,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,0,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,0,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,0,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,0,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,0,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,0,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,0,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,0,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,0,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,0,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,0,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,1,0, }; const uint8_t gsm0503_puncture_mcs7_dl_hdr[135] = { 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,1,0,0,0,0,0, 0,0,0,1,0,0,0,0,0,0, 0,0,0,1,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 1,0,0,0,0,0,0,0,0,1, 0,0,0,0,0,0,0,0,0,1, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,1,0,0,0, 0,0,0,0,0,1,0,0,0,0, 0,0,0,0,0,1,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0,0, 0,1,0,0,0, }; const uint8_t gsm0503_puncture_mcs7_ul_hdr[162] = { 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,1,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0, }; const uint8_t gsm0503_puncture_mcs7_p1[1404] = { 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, 0,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1, }; const uint8_t gsm0503_puncture_mcs7_p2[1404] = { 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,1,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,1,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,1,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,1,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,1,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,1,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,1,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,1,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,1,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,1,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,1,0, 1,1,0,0,1,0,0,1,1,1,0,1,1,1,0,1,1,0, }; const uint8_t gsm0503_puncture_mcs7_p3[1404] = { 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, 1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,0,1, }; const uint8_t gsm0503_puncture_mcs8_p1[1692] = { 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,0,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, 0,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0, }; const uint8_t gsm0503_puncture_mcs8_p2[1692] = { 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,0,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, 1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1, }; const uint8_t gsm0503_puncture_mcs8_p3[1692] = { 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,0,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, 1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,0,1, }; const uint8_t gsm0503_puncture_mcs9_p1[1836] = { 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, 0,1,1, }; const uint8_t gsm0503_puncture_mcs9_p2[1836] = { 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, }; const uint8_t gsm0503_puncture_mcs9_p3[1836] = { 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, 1,1,0, }; const uint16_t gsm0503_interleave_mcs5[1248] = { 0, 463, 890, 1038, 220, 371, 795, 946, 582, 733, 1160, 63, 490, 641, 277, 428, 852, 1003, 185, 333, 1223, 120, 547, 698, 1122, 28, 915, 1066, 242, 390, 817, 968, 610, 761, 1185, 85, 512, 660, 305, 453, 880, 1031, 204, 355, 782, 1242, 148, 575, 723, 1150, 50, 474, 625, 1088, 267, 418, 845, 993, 169, 320, 1207, 113, 537, 688, 1115, 12, 902, 1050, 232, 383, 807, 958, 594, 745, 1172, 75, 502, 653, 289, 440, 864, 1015, 197, 345, 1235, 132, 559, 710, 1134, 40, 927, 1078, 254, 402, 829, 980, 159, 622, 773, 1197, 97, 524, 672, 1099, 5, 465, 892, 1043, 216, 367, 794, 942, 587, 735, 1162, 62, 486, 637, 279, 430, 857, 1005, 181, 332, 1219, 125, 549, 700, 1127, 24, 914, 1062, 244, 395, 819, 970, 606, 757, 1184, 87, 514, 665, 301, 452, 876, 1027, 209, 357, 784, 1247, 144, 571, 722, 1146, 52, 479, 627, 1090, 266, 414, 841, 992, 171, 322, 1209, 109, 536, 684, 1111, 17, 904, 1055, 228, 379, 806, 954, 599, 747, 1174, 74, 498, 649, 291, 442, 869, 1017, 193, 344, 1231, 137, 561, 712, 1139, 36, 926, 1074, 256, 407, 831, 982, 158, 618, 769, 1196, 99, 526, 677, 1101, 7, 458, 894, 1033, 227, 363, 802, 941, 577, 740, 1152, 70, 485, 645, 284, 420, 859, 998, 189, 328, 1215, 127, 542, 702, 1117, 35, 922, 1061, 246, 385, 824, 960, 605, 765, 1180, 92, 504, 667, 309, 448, 887, 1023, 211, 350, 786, 1237, 155, 567, 730, 1145, 54, 469, 632, 1080, 274, 413, 849, 988, 176, 312, 1202, 117, 532, 695, 1107, 19, 906, 1045, 239, 375, 814, 953, 589, 752, 1164, 82, 497, 657, 296, 432, 871, 1010, 201, 340, 1227, 139, 554, 714, 1129, 47, 934, 1073, 258, 397, 836, 972, 166, 617, 777, 1192, 104, 516, 679, 1094, 9, 460, 899, 1035, 223, 362, 798, 937, 579, 742, 1157, 66, 481, 644, 286, 425, 861, 1000, 188, 324, 1214, 129, 544, 707, 1119, 31, 918, 1057, 251, 387, 826, 965, 601, 764, 1176, 94, 509, 669, 308, 444, 883, 1022, 213, 352, 791, 1239, 151, 566, 726, 1141, 59, 471, 634, 1085, 270, 409, 848, 984, 178, 317, 1204, 116, 528, 691, 1106, 21, 911, 1047, 235, 374, 810, 949, 591, 754, 1169, 78, 493, 656, 298, 437, 873, 1012, 200, 336, 1226, 141, 556, 719, 1131, 43, 930, 1069, 263, 399, 838, 977, 162, 613, 776, 1188, 106, 521, 681, 1096, 2, 462, 889, 1040, 219, 370, 797, 945, 584, 732, 1159, 65, 489, 640, 276, 427, 854, 1002, 184, 335, 1222, 122, 546, 697, 1124, 27, 917, 1065, 241, 392, 816, 967, 609, 760, 1187, 84, 511, 662, 304, 455, 879, 1030, 206, 354, 781, 1244, 147, 574, 725, 1149, 49, 476, 624, 1087, 269, 417, 844, 995, 168, 319, 1206, 112, 539, 687, 1114, 14, 901, 1052, 231, 382, 809, 957, 596, 744, 1171, 77, 501, 652, 288, 439, 866, 1014, 196, 347, 1234, 134, 558, 709, 1136, 39, 929, 1077, 253, 404, 828, 979, 161, 621, 772, 1199, 96, 523, 674, 1098, 4, 467, 891, 1042, 218, 366, 793, 944, 586, 737, 1161, 61, 488, 636, 281, 429, 856, 1007, 180, 331, 1218, 124, 551, 699, 1126, 26, 913, 1064, 243, 394, 821, 969, 608, 756, 1183, 89, 513, 664, 300, 451, 878, 1026, 208, 359, 783, 1246, 146, 570, 721, 1148, 51, 478, 629, 1089, 265, 416, 840, 991, 173, 321, 1211, 108, 535, 686, 1110, 16, 903, 1054, 230, 378, 805, 956, 598, 749, 1173, 73, 500, 648, 293, 441, 868, 1019, 192, 343, 1230, 136, 563, 711, 1138, 38, 925, 1076, 255, 406, 833, 981, 157, 620, 768, 1195, 101, 525, 676, 1103, 6, 457, 896, 1032, 226, 365, 801, 940, 576, 739, 1154, 69, 484, 647, 283, 422, 858, 997, 191, 327, 1217, 126, 541, 704, 1116, 34, 921, 1060, 248, 384, 823, 962, 604, 767, 1179, 91, 506, 666, 311, 447, 886, 1025, 210, 349, 788, 1236, 154, 569, 729, 1144, 56, 468, 631, 1082, 273, 412, 851, 987, 175, 314, 1201, 119, 531, 694, 1109, 18, 908, 1044, 238, 377, 813, 952, 588, 751, 1166, 81, 496, 659, 295, 434, 870, 1009, 203, 339, 1229, 138, 553, 716, 1128, 46, 933, 1072, 260, 396, 835, 974, 165, 616, 779, 1191, 103, 518, 678, 1093, 11, 459, 898, 1037, 222, 361, 800, 936, 581, 741, 1156, 68, 480, 643, 285, 424, 863, 999, 187, 326, 1213, 131, 543, 706, 1121, 30, 920, 1056, 250, 389, 825, 964, 600, 763, 1178, 93, 508, 671, 307, 446, 882, 1021, 215, 351, 790, 1241, 150, 565, 728, 1140, 58, 473, 633, 1084, 272, 408, 847, 986, 177, 316, 1203, 115, 530, 690, 1105, 23, 910, 1049, 234, 373, 812, 948, 593, 753, 1168, 80, 492, 655, 297, 436, 875, 1011, 199, 338, 1225, 143, 555, 718, 1133, 42, 932, 1068, 262, 401, 837, 976, 164, 612, 775, 1190, 105, 520, 683, 1095, 1, 464, 888, 1039, 221, 369, 796, 947, 583, 734, 1158, 64, 491, 639, 278, 426, 853, 1004, 183, 334, 1221, 121, 548, 696, 1123, 29, 916, 1067, 240, 391, 818, 966, 611, 759, 1186, 86, 510, 661, 303, 454, 881, 1029, 205, 356, 780, 1243, 149, 573, 724, 1151, 48, 475, 626, 1086, 268, 419, 843, 994, 170, 318, 1208, 111, 538, 689, 1113, 13, 900, 1051, 233, 381, 808, 959, 595, 746, 1170, 76, 503, 651, 290, 438, 865, 1016, 195, 346, 1233, 133, 560, 708, 1135, 41, 928, 1079, 252, 403, 830, 978, 160, 623, 771, 1198, 98, 522, 673, 1100, 3, 466, 893, 1041, 217, 368, 792, 943, 585, 736, 1163, 60, 487, 638, 280, 431, 855, 1006, 182, 330, 1220, 123, 550, 701, 1125, 25, 912, 1063, 245, 393, 820, 971, 607, 758, 1182, 88, 515, 663, 302, 450, 877, 1028, 207, 358, 785, 1245, 145, 572, 720, 1147, 53, 477, 628, 1091, 264, 415, 842, 990, 172, 323, 1210, 110, 534, 685, 1112, 15, 905, 1053, 229, 380, 804, 955, 597, 748, 1175, 72, 499, 650, 292, 443, 867, 1018, 194, 342, 1232, 135, 562, 713, 1137, 37, 924, 1075, 257, 405, 832, 983, 156, 619, 770, 1194, 100, 527, 675, 1102, 8, 456, 895, 1034, 225, 364, 803, 939, 578, 738, 1153, 71, 483, 646, 282, 421, 860, 996, 190, 329, 1216, 128, 540, 703, 1118, 33, 923, 1059, 247, 386, 822, 961, 603, 766, 1181, 90, 505, 668, 310, 449, 885, 1024, 212, 348, 787, 1238, 153, 568, 731, 1143, 55, 470, 630, 1081, 275, 411, 850, 989, 174, 313, 1200, 118, 533, 693, 1108, 20, 907, 1046, 237, 376, 815, 951, 590, 750, 1165, 83, 495, 658, 294, 433, 872, 1008, 202, 341, 1228, 140, 552, 715, 1130, 45, 935, 1071, 259, 398, 834, 973, 167, 615, 778, 1193, 102, 517, 680, 1092, 10, 461, 897, 1036, 224, 360, 799, 938, 580, 743, 1155, 67, 482, 642, 287, 423, 862, 1001, 186, 325, 1212, 130, 545, 705, 1120, 32, 919, 1058, 249, 388, 827, 963, 602, 762, 1177, 95, 507, 670, 306, 445, 884, 1020, 214, 353, 789, 1240, 152, 564, 727, 1142, 57, 472, 635, 1083, 271, 410, 846, 985, 179, 315, 1205, 114, 529, 692, 1104, 22, 909, 1048, 236, 372, 811, 950, 592, 755, 1167, 79, 494, 654, 299, 435, 874, 1013, 198, 337, 1224, 142, 557, 717, 1132, 44, 931, 1070, 261, 400, 839, 975, 163, 614, 774, 1189, 107, 519, 682, 1097, }; /* this corresponds to the bit-lengths of the individual codec * parameters as indicated in Table 1.1 of TS 06.10 */ const uint8_t gsm0503_gsm_fr_map[76] = { 6, 6, 5, 5, 4, 4, 3, 3, 7, 2, 2, 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7, 2, 2, 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7, 2, 2, 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7, 2, 2, 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }; /* this table describes the 65 most importaint bits from EFR coded * bits as indicated in TS 05.03 (3.1.1.1) */ const uint8_t gsm0503_gsm_efr_protected_bits[65] = { 39, 40, 41, 42, 43, 44, 48, 87, 45, 2, 3, 8, 10, 18, 19, 24, 46, 47,142,143, 144,145,146,147, 92, 93,195,196, 98,137, 148, 94,197,149,150, 95,198, 4, 5, 11, 12, 16, 9, 6, 7, 13, 17, 20, 96,199, 1, 14, 15, 21, 25, 26, 28,151,201,190, 240, 88,138,191,241 }; /* Encoded in-band data for speech frames */ const ubit_t gsm0503_afs_ic_ubit[4][8] = { { 0,0,0,0,0,0,0,0 }, { 0,1,0,1,1,1,0,1 }, { 1,0,1,1,1,0,1,0 }, { 1,1,1,0,0,1,1,1 }, }; const sbit_t gsm0503_afs_ic_sbit[4][8] = { { 127, 127, 127, 127, 127, 127, 127, 127 }, { 127,-127, 127,-127,-127,-127, 127,-127 }, { -127, 127,-127,-127,-127, 127,-127, 127 }, { -127,-127,-127, 127, 127,-127,-127,-127 }, }; const ubit_t gsm0503_ahs_ic_ubit[4][4] = { { 0,0,0,0 }, { 1,0,0,1 }, { 1,1,1,0 }, { 0,1,1,1 }, }; const sbit_t gsm0503_ahs_ic_sbit[4][4] = { { 127, 127, 127, 127 }, { -127, 127, 127,-127 }, { -127,-127,-127, 127 }, { 127,-127,-127,-127 }, }; const uint8_t gsm0503_tch_hr_interleaving[228][2] = { { 0 ,0 }, { 1 ,2 }, { 78 ,1 }, { 79 ,3 }, { 48 ,0 }, { 49 ,2 }, { 54 ,1 }, { 55 ,3 }, { 24 ,0 }, { 25 ,2 }, { 30 ,1 }, { 31 ,3 }, { 72 ,0 }, { 73 ,2 }, { 6 ,1 }, { 7 ,3 }, { 96 ,0 }, { 97 ,2 }, { 12 ,0 }, { 13 ,2 }, { 102,1 }, { 103,3 }, { 60 ,0 }, { 61 ,2 }, { 66 ,1 }, { 67 ,3 }, { 90 ,1 }, { 91 ,3 }, { 36 ,0 }, { 37 ,2 }, { 42 ,1 }, { 43 ,3 }, { 18 ,1 }, { 19 ,3 }, { 84 ,0 }, { 85 ,2 }, { 108,0 }, { 109,2 }, { 2 ,0 }, { 3 ,2 }, { 80 ,1 }, { 81 ,3 }, { 50 ,0 }, { 51 ,2 }, { 56 ,1 }, { 57 ,3 }, { 26 ,0 }, { 27 ,2 }, { 32 ,1 }, { 33 ,3 }, { 74 ,0 }, { 75 ,2 }, { 8 ,1 }, { 9 ,3 }, { 98 ,0 }, { 99 ,2 }, { 14 ,0 }, { 15 ,2 }, { 104,1 }, { 105,3 }, { 62 ,0 }, { 63 ,2 }, { 68 ,1 }, { 69 ,3 }, { 92 ,1 }, { 93 ,3 }, { 38 ,0 }, { 39 ,2 }, { 44 ,1 }, { 45 ,3 }, { 20 ,1 }, { 21 ,3 }, { 86 ,0 }, { 87 ,2 }, { 110,0 }, { 111,2 }, { 4 ,0 }, { 5 ,2 }, { 82 ,1 }, { 83 ,3 }, { 52 ,0 }, { 53 ,2 }, { 58 ,1 }, { 59 ,3 }, { 28 ,0 }, { 29 ,2 }, { 34 ,1 }, { 35 ,3 }, { 76 ,0 }, { 77 ,2 }, { 10 ,1 }, { 12 ,3 }, { 100,0 }, { 101,2 }, { 16 ,0 }, { 17 ,2 }, { 106,1 }, { 107,3 }, { 64 ,0 }, { 65 ,2 }, { 70 ,1 }, { 71 ,3 }, { 94 ,1 }, { 95 ,3 }, { 40 ,0 }, { 41 ,2 }, { 46 ,1 }, { 47 ,3 }, { 22 ,1 }, { 23 ,3 }, { 88 ,0 }, { 89 ,2 }, { 112,0 }, { 113,2 }, { 6 ,0 }, { 7 ,2 }, { 84 ,1 }, { 85 ,3 }, { 54 ,0 }, { 55 ,2 }, { 60 ,1 }, { 61 ,3 }, { 30 ,0 }, { 31 ,2 }, { 36 ,1 }, { 37 ,3 }, { 78 ,0 }, { 79 ,2 }, { 12 ,1 }, { 13 ,3 }, { 102,0 }, { 103,2 }, { 18 ,0 }, { 19 ,2 }, { 108,1 }, { 109,3 }, { 66 ,0 }, { 67 ,2 }, { 72 ,1 }, { 73 ,3 }, { 96 ,1 }, { 97 ,3 }, { 42 ,0 }, { 43 ,2 }, { 48 ,1 }, { 49 ,3 }, { 24 ,1 }, { 25 ,3 }, { 90 ,0 }, { 91 ,2 }, { 0 ,1 }, { 1 ,3 }, { 8 ,0 }, { 9 ,2 }, { 86 ,1 }, { 87 ,3 }, { 56 ,0 }, { 57 ,2 }, { 62 ,1 }, { 63 ,3 }, { 32 ,0 }, { 33 ,2 }, { 38 ,1 }, { 39 ,3 }, { 80 ,0 }, { 81 ,2 }, { 14 ,1 }, { 15 ,3 }, { 104,0 }, { 105,2 }, { 20 ,0 }, { 21 ,2 }, { 110,1 }, { 111,3 }, { 68 ,0 }, { 69 ,2 }, { 74 ,1 }, { 75 ,3 }, { 98 ,1 }, { 99 ,3 }, { 44 ,0 }, { 45 ,2 }, { 50 ,1 }, { 51 ,3 }, { 26 ,1 }, { 27 ,3 }, { 92 ,0 }, { 93 ,2 }, { 2 ,1 }, { 3 ,3 }, { 10 ,0 }, { 11 ,2 }, { 88 ,1 }, { 89 ,3 }, { 58 ,0 }, { 59 ,2 }, { 64 ,1 }, { 65 ,3 }, { 34 ,0 }, { 35 ,2 }, { 40 ,1 }, { 41 ,3 }, { 82 ,0 }, { 83 ,2 }, { 16 ,1 }, { 17 ,3 }, { 106,0 }, { 107,2 }, { 22 ,0 }, { 23 ,2 }, { 112,1 }, { 113,3 }, { 70 ,0 }, { 71 ,2 }, { 76 ,1 }, { 77 ,3 }, { 100,1 }, { 101,3 }, { 46 ,0 }, { 47 ,2 }, { 52 ,1 }, { 53 ,3 }, { 28 ,1 }, { 29 ,3 }, { 94 ,0 }, { 95 ,2 }, { 4 ,1 }, { 5 ,3 }, }; /* * 3GPP TS 05.03 5.1.9.1.2 "USF precoding" */ const ubit_t gsm0503_mcs5_usf_precode_table[8][36] = { { 0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0, }, { 1,1,1,1,1,0,0,0,0, 1,1,1,1,0,0,0,0,0, 1,1,1,1,1,1,0,0,0, 1,1,1,1,1,0,0,0,1, }, { 1,1,1,0,0,1,1,1,0, 1,1,1,0,1,1,1,0,0, 1,1,0,0,0,0,1,1,0, 1,1,0,0,0,1,1,0,0, }, { 1,0,0,1,1,1,1,0,0, 1,1,0,0,0,0,0,1,1, 1,0,1,1,1,0,1,1,1, 0,0,1,0,0,1,1,1,1, }, { 0,0,0,1,1,0,0,1,1, 0,0,1,0,1,1,0,1,0, 1,0,0,0,0,1,1,0,1, 1,1,1,1,1,1,1,1,0, }, { 1,1,0,1,0,1,0,1,1, 0,0,0,1,1,0,1,0,1, 0,1,1,1,0,1,0,1,1, 1,0,0,1,0,1,0,1,1, }, { 0,0,1,0,0,1,1,0,1, 1,0,1,1,1,1,1,1,1, 0,1,1,0,1,0,0,0,1, 0,0,1,1,1,0,1,0,0, }, { 0,1,1,0,1,0,1,1,1, 0,1,0,1,0,1,1,1,1, 0,0,0,1,1,1,1,1,0, 0,1,0,0,1,0,0,1,1, }, }; gr-gsm-0.41.2/lib/decoding/osmocom/coding/gsm0503_tables.h000066400000000000000000000063141316153413000230350ustar00rootroot00000000000000/* * (C) 2013 by Andreas Eversberg * (C) 2016 by Tom Tsou * * All Rights Reserved * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #pragma once #include #include extern const ubit_t gsm0503_pdtch_hl_hn_ubit[4][8]; extern const ubit_t gsm0503_pdtch_edge_hl_hn_ubit[3][8]; extern const sbit_t gsm0503_pdtch_hl_hn_sbit[4][8]; extern const sbit_t gsm0503_pdtch_edge_hl_hn_sbit[3][8]; extern const ubit_t gsm0503_usf2six[8][6]; extern const ubit_t gsm0503_usf2twelve_ubit[8][12]; extern const sbit_t gsm0503_usf2twelve_sbit[8][12]; extern const uint8_t gsm0503_puncture_cs2[588]; extern const uint8_t gsm0503_puncture_cs3[676]; extern const uint8_t gsm0503_puncture_mcs1_dl_hdr[108]; extern const uint8_t gsm0503_puncture_mcs1_ul_hdr[117]; extern const uint8_t gsm0503_puncture_mcs1_p1[588]; extern const uint8_t gsm0503_puncture_mcs1_p2[588]; extern const uint8_t gsm0503_puncture_mcs2_p1[732]; extern const uint8_t gsm0503_puncture_mcs2_p2[732]; extern const uint8_t gsm0503_puncture_mcs3_p1[948]; extern const uint8_t gsm0503_puncture_mcs3_p2[948]; extern const uint8_t gsm0503_puncture_mcs3_p3[948]; extern const uint8_t gsm0503_puncture_mcs4_p1[1116]; extern const uint8_t gsm0503_puncture_mcs4_p2[1116]; extern const uint8_t gsm0503_puncture_mcs4_p3[1116]; extern const uint8_t gsm0503_puncture_mcs5_p1[1404]; extern const uint8_t gsm0503_puncture_mcs5_p2[1404]; extern const uint8_t gsm0503_puncture_mcs6_p1[1836]; extern const uint8_t gsm0503_puncture_mcs6_p2[1836]; extern const uint8_t gsm0503_puncture_mcs7_dl_hdr[135]; extern const uint8_t gsm0503_puncture_mcs7_ul_hdr[162]; extern const uint8_t gsm0503_puncture_mcs7_p1[1404]; extern const uint8_t gsm0503_puncture_mcs7_p2[1404]; extern const uint8_t gsm0503_puncture_mcs7_p3[1404]; extern const uint8_t gsm0503_puncture_mcs8_p1[1692]; extern const uint8_t gsm0503_puncture_mcs8_p2[1692]; extern const uint8_t gsm0503_puncture_mcs8_p3[1692]; extern const uint8_t gsm0503_puncture_mcs9_p1[1836]; extern const uint8_t gsm0503_puncture_mcs9_p2[1836]; extern const uint8_t gsm0503_puncture_mcs9_p3[1836]; extern const uint16_t gsm0503_interleave_mcs5[1248]; extern const uint8_t gsm0503_gsm_fr_map[76]; extern const uint8_t gsm0503_gsm_efr_protected_bits[65]; extern const ubit_t gsm0503_afs_ic_ubit[4][8]; extern const sbit_t gsm0503_afs_ic_sbit[4][8]; extern const ubit_t gsm0503_ahs_ic_ubit[4][4]; extern const sbit_t gsm0503_ahs_ic_sbit[4][4]; extern const uint8_t gsm0503_tch_hr_interleaving[228][2]; extern const ubit_t gsm0503_mcs5_usf_precode_table[8][36]; gr-gsm-0.41.2/lib/decoding/sch.c000066400000000000000000000064451316153413000162430ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2014 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #include #include "gsm_constants.h" #include "osmocom/coding/gsm0503_coding.h" #include static int ubits2sbits(ubit_t *ubits, sbit_t *sbits, int count) { int i; for (i = 0; i < count; i++) { if (*ubits == 0x23) { ubits++; sbits++; continue; } if ((*ubits++) & 1) *sbits++ = -127; else *sbits++ = 127; } return count; } int decode_sch(const unsigned char *buf, int * t1_o, int * t2_o, int * t3_o, int * ncc_o, int * bcc_o) { int t1, t2, t3p, t3, ncc, bcc; uint8_t result[4]; ubit_t bursts_u[SCH_DATA_LEN*2]; sbit_t bursts_s[SCH_DATA_LEN*2]; // extract encoded data from synchronization burst /* buf, 39 bit */ /* buf + 39 + 64 = 103, 39 */ memcpy(bursts_u, buf, SCH_DATA_LEN); memcpy(bursts_u + SCH_DATA_LEN, buf + SCH_DATA_LEN + N_SYNC_BITS, SCH_DATA_LEN); ubits2sbits(bursts_u, bursts_s, SCH_DATA_LEN*2); if(gsm0503_sch_decode(result, bursts_s)==-1){ return 1; } // Synchronization channel information, 44.018 page 171. (V7.2.0) uint8_t decoded_data[25]; osmo_pbit2ubit_ext(decoded_data, 0, result, 0, 25, 1); ncc = (decoded_data[ 7] << 2) | (decoded_data[ 6] << 1) | (decoded_data[ 5] << 0); bcc = (decoded_data[ 4] << 2) | (decoded_data[ 3] << 1) | (decoded_data[ 2] << 0); t1 = (decoded_data[ 1] << 10) | (decoded_data[ 0] << 9) | (decoded_data[15] << 8) | (decoded_data[14] << 7) | (decoded_data[13] << 6) | (decoded_data[12] << 5) | (decoded_data[11] << 4) | (decoded_data[10] << 3) | (decoded_data[ 9] << 2) | (decoded_data[ 8] << 1) | (decoded_data[23] << 0); t2 = (decoded_data[22] << 4) | (decoded_data[21] << 3) | (decoded_data[20] << 2) | (decoded_data[19] << 1) | (decoded_data[18] << 0); t3p = (decoded_data[17] << 2) | (decoded_data[16] << 1) | (decoded_data[24] << 0); t3 = 10 * t3p + 1; // modulo arithmetic t3 - t2 mod 26 // tt = ((t3 + 26) - t2) % 26; // fn = (51 * 26 * t1) + (51 * tt) + t3; /* * BSIC: Base Station Identification Code * BCC: Base station Color Code * NCC: Network Color Code * * FN: Frame Number */ // printf("bsic: %x (bcc: %u; ncc: %u)\tFN: %u\n", bsic, bsic & 7, // (bsic >> 3) & 7, fn); // if (fn_o) // *fn_o = fn; // if (bsic_o) if (t1_o && t2_o && t3_o && ncc_o && bcc_o) { *t1_o = t1; *t2_o = t2; *t3_o = t3; *bcc_o = bcc; *ncc_o = ncc; } return 0; } gr-gsm-0.41.2/lib/decoding/tch_f_decoder_impl.cc000066400000000000000000000453321316153413000214200ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2015 by Roman Khassraf * (C) 2017 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "stdio.h" #include "tch_f_decoder_impl.h" extern "C" { #include "osmocom/coding/gsm0503_coding.h" } #define DATA_BYTES 23 namespace gr { namespace gsm { static int ubits2sbits(ubit_t *ubits, sbit_t *sbits, int count) { int i; for (i = 0; i < count; i++) { if (*ubits == 0x23) { ubits++; sbits++; continue; } if ((*ubits++) & 1) *sbits++ = -127; else *sbits++ = 127; } return count; } tch_f_decoder::sptr tch_f_decoder::make(tch_mode mode, bool boundary_check) { return gnuradio::get_initial_sptr (new tch_f_decoder_impl(mode, boundary_check)); } /* * Constructor */ tch_f_decoder_impl::tch_f_decoder_impl(tch_mode mode, bool boundary_check) : gr::block("tch_f_decoder", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), d_tch_mode(mode), d_collected_bursts_num(0), d_boundary_check(boundary_check), d_boundary_decode(!boundary_check), d_header_sent(false), mBlockCoder(0x10004820009ULL, 40, 224), mU(228), mP(mU.segment(184,40)), mD(mU.head(184)), mDP(mU.head(224)), mC(CONV_SIZE), mClass1_c(mC.head(378)), mClass2_c(mC.segment(378, 78)), mTCHU(189), mTCHD(260), mClass1A_d(mTCHD.head(50)), mTCHParity(0x0b, 3, 50) { //setup input/output ports message_port_register_in(pmt::mp("bursts")); set_msg_handler(pmt::mp("bursts"), boost::bind(&tch_f_decoder_impl::decode, this, _1)); message_port_register_out(pmt::mp("msgs")); message_port_register_out(pmt::mp("voice")); int j, k, B; for (k = 0; k < CONV_SIZE; k++) { B = k % 8; j = 2 * ((49 * k) % 57) + ((k % 8) / 4); interleave_trans[k] = B * 114 + j; } setCodingMode(mode); } tch_f_decoder_impl::~tch_f_decoder_impl() { } void tch_f_decoder_impl::decode(pmt::pmt_t msg) { if(!d_header_sent) { if (d_tch_mode != TCH_FS) { const unsigned char amr_nb_magic[7] = "#!AMR\n"; message_port_pub(pmt::mp("voice"), pmt::cons(pmt::PMT_NIL, pmt::make_blob(amr_nb_magic,6))); } d_header_sent = true; } d_bursts[d_collected_bursts_num] = msg; d_collected_bursts_num++; bool stolen = false; if (d_collected_bursts_num == 8) { ubit_t bursts_u[116 * 8]; d_collected_bursts_num = 0; // reorganize data for (int ii = 0; ii < 8; ii++) { pmt::pmt_t header_plus_burst = pmt::cdr(d_bursts[ii]); int8_t * burst_bits = (int8_t *)(pmt::blob_data(header_plus_burst))+sizeof(gsmtap_hdr); memcpy(&bursts_u[ii*116], &burst_bits[3],58); memcpy(&bursts_u[ii*116+58], &burst_bits[3+57+1+26],58); for (int jj = 0; jj < 57; jj++) { iBLOCK[ii*114+jj] = burst_bits[jj + 3]; iBLOCK[ii*114+jj+57] = burst_bits[jj + 88]; //88 = 3+57+1+26+1 } if ((ii <= 3 && static_cast(burst_bits[87]) == 1) || (ii >= 4 && static_cast(burst_bits[60]) == 1)) { stolen = true; } } // deinterleave for (int k = 0; k < CONV_SIZE; k++) { mC[k] = iBLOCK[interleave_trans[k]]; } // Decode stolen frames as FACCH/F if (stolen) { mVR204Coder.decode(mC, mU); mP.invert(); unsigned syndrome = mBlockCoder.syndrome(mDP); if (syndrome == 0) { unsigned char outmsg[28]; unsigned char sbuf_len=224; int i, j, c, pos=0; for(i = 0; i < sbuf_len; i += 8) { for(j = 0, c = 0; (j < 8) && (i + j < sbuf_len); j++){ c |= (!!mU.bit(i + j)) << j; } outmsg[pos++] = c & 0xff; } pmt::pmt_t first_header_plus_burst = pmt::cdr(d_bursts[0]); gsmtap_hdr * header = (gsmtap_hdr *)pmt::blob_data(first_header_plus_burst); int8_t header_plus_data[sizeof(gsmtap_hdr)+DATA_BYTES]; memcpy(header_plus_data, header, sizeof(gsmtap_hdr)); memcpy(header_plus_data+sizeof(gsmtap_hdr), outmsg, DATA_BYTES); ((gsmtap_hdr*)header_plus_data)->type = GSMTAP_TYPE_UM; pmt::pmt_t msg_binary_blob = pmt::make_blob(header_plus_data,DATA_BYTES+sizeof(gsmtap_hdr)); pmt::pmt_t msg_out = pmt::cons(pmt::PMT_NIL, msg_binary_blob); message_port_pub(pmt::mp("msgs"), msg_out); // if d_boundary_check is enabled, we set d_boundary_decode to true, when a // "Connect" or "Connect Acknowledge" message is received, and // we set d_boundary_decode back to false, when "Release" message is received if (d_boundary_check) { // check if this is a call control message if ((outmsg[3] & 0x0f) == 0x03) { // Connect specified in GSM 04.08, 9.3.5 if ((outmsg[4] & 0x3f) == 0x07) { d_boundary_decode = true; } // Connect Acknowledge specified in GSM 04.08, 9.3.6 else if ((outmsg[4] & 0x3f) == 0x0f) { d_boundary_decode = true; } // Release specified in GSM 04.08, 9.3.18 else if ((outmsg[4] & 0x3f) == 0x2d) { d_boundary_decode = false; } } } // if we are in an AMR-mode and we receive a channel mode modify message, // we set the mode according to the multirate configuration from the message // see GSM 04.18, section 9.1.5 and 10.5.2.21aa if (d_tch_mode != TCH_FS && d_tch_mode != TCH_EFR) { if (outmsg[3] == 0x06 && outmsg[4] == 0x10) { // Verify that multirate version 1 is set if ((outmsg[11] >> 5) == 1) { // the set of active codecs, max 4 modes // active_codec_set[0] corresponds to CODEC_MODE_1 with lowest bit rate // active_codec_set[3] corresponds to CODEC_MODE_4 with highest bit rate tch_mode active_codec_set[4]; uint8_t mode_count = 0; for (i = 0; i<8; i++) { if (((outmsg[12] >> i) & 0x1) == 1 && mode_count < 4) { active_codec_set[mode_count++] = static_cast(7-i); } } // check Initial Codec Mode Indicator ICMI // if ICMI == 1, then use the one defined in start mode field // else use implicit rule defined in GSM 05.09, section 3.4.3 if (((outmsg[11] >> 3) & 0x1) == 1) { // from start field setCodingMode(active_codec_set[ (outmsg[11] & 0x3) ]); } else { // implicit mode // if the set contains only 1 codec, we use that one // else if there are 2 or 3 codecs in the set, we use the one with lowest bitrate if (mode_count >= 1 && mode_count <= 3) { setCodingMode(active_codec_set[0]); } // if there are 4 codecs in the set, we use the second lowest bitrate else if (mode_count == 4) { setCodingMode(active_codec_set[1]); } } } } } } } // if voice boundary_check is enabled and d_boundary_decode is false, we are done if (d_boundary_check && !d_boundary_decode) { return; } // Decode voice frames and send to the output if (d_tch_mode == TCH_FS || d_tch_mode == TCH_EFR) { mVR204Coder.decode(mClass1_c, mTCHU); mClass2_c.sliced().copyToSegment(mTCHD, 182); // 3.1.2.1 // copy class 1 bits u[] to d[] for (unsigned k = 0; k <= 90; k++) { mTCHD[2*k] = mTCHU[k]; mTCHD[2*k+1] = mTCHU[184-k]; } // 3.1.2.1 // check parity of class 1A unsigned sentParity = (~mTCHU.peekField(91, 3)) & 0x07; unsigned calcParity = mClass1A_d.parity(mTCHParity) & 0x07; unsigned tail = mTCHU.peekField(185, 4); bool good = (sentParity == calcParity) && (tail == 0); if (good) { uint8_t frameBuffer[33]; sbit_t bursts_s[116 * 8]; int n_errors, n_bits_total; unsigned int mTCHFrameLength; ubits2sbits(bursts_u, bursts_s, 116 * 8); if (d_tch_mode == TCH_FS) // GSM-FR { mTCHFrameLength = 33; gsm0503_tch_fr_decode(frameBuffer, bursts_s, 1, 0, &n_errors, &n_bits_total); //std::cout << "Errors: " << n_errors << std::endl; } else if (d_tch_mode == TCH_EFR) // GSM-EFR { unsigned char mFrameHeader = 0x3c; // AMR Frame, consisting of a 8 bit frame header, plus the payload from decoding BitVector amrFrame(244 + 8); // Same output length as AMR 12.2 BitVector payload = amrFrame.tail(8); BitVector TCHW(260), EFRBits(244); // write frame header amrFrame.fillField(0, mFrameHeader, 8); // Undo Um's EFR bit ordering. mTCHD.unmap(GSM::g660BitOrder, 260, TCHW); // Remove repeating bits and CRC to get raw EFR frame (244 bits) for (unsigned k=0; k<71; k++) EFRBits[k] = TCHW[k] & 1; for (unsigned k=73; k<123; k++) EFRBits[k-2] = TCHW[k] & 1; for (unsigned k=125; k<178; k++) EFRBits[k-4] = TCHW[k] & 1; for (unsigned k=180; k<230; k++) EFRBits[k-6] = TCHW[k] & 1; for (unsigned k=232; k<252; k++) EFRBits[k-8] = TCHW[k] & 1; // Map bits as AMR 12.2k EFRBits.map(GSM::gAMRBitOrderTCH_AFS12_2, 244, payload); // Put the whole frame (hdr + payload) mTCHFrameLength = 32; amrFrame.pack(frameBuffer); //when itegrating with libosmocore lines above can be removed and line below uncommented, efr decoding with libosmocore need to be tested however //gsm0503_tch_fr_decode(frameBuffer, bursts_s, 1, 1, &n_errors, &n_bits_total); } message_port_pub(pmt::mp("voice"), pmt::cons(pmt::PMT_NIL, pmt::make_blob(frameBuffer,mTCHFrameLength))); } } else { // Handle inband bits, see 3.9.4.1 // OpenBTS source takes last 8 bits as inband bits for some reason. This may be either a // divergence between their implementation and GSM specification, which works because // both their encoder and decoder do it same way, or they handle the issue at some other place // SoftVector cMinus8 = mC.segment(0, mC.size() - 8); SoftVector cMinus8 = mC.segment(8, mC.size()); cMinus8.copyUnPunctured(mTCHUC, mPuncture, mPunctureLth); // 3.9.4.4 // decode from uc[] to u[] mViterbi->decode(mTCHUC, mTCHU); // 3.9.4.3 -- class 1a bits in u[] to d[] for (unsigned k=0; k < mClass1ALth; k++) { mTCHD[k] = mTCHU[k]; } // 3.9.4.3 -- class 1b bits in u[] to d[] for (unsigned k=0; k < mClass1BLth; k++) { mTCHD[k+mClass1ALth] = mTCHU[k+mClass1ALth+6]; } // Check parity unsigned sentParity = (~mTCHU.peekField(mClass1ALth,6)) & 0x3f; BitVector class1A = mTCHU.segment(0, mClass1ALth); unsigned calcParity = class1A.parity(mTCHParity) & 0x3f; bool good = (sentParity == calcParity); if (good) { unsigned char frameBuffer[mAMRFrameLth]; // AMR Frame, consisting of a 8 bit frame header, plus the payload from decoding BitVector amrFrame(mKd + 8); BitVector payload = amrFrame.tail(8); // write frame header amrFrame.fillField(0, mAMRFrameHeader, 8); // We don't unmap here, but copy the decoded bits directly // Decoder already delivers correct bit order // mTCHD.unmap(mAMRBitOrder, payload.size(), payload); mTCHD.copyTo(payload); amrFrame.pack(frameBuffer); message_port_pub(pmt::mp("voice"), pmt::cons(pmt::PMT_NIL, pmt::make_blob(frameBuffer,mAMRFrameLth))); } } } } void tch_f_decoder_impl::setCodingMode(tch_mode mode) { if (mode != TCH_FS && d_tch_mode != TCH_EFR) { d_tch_mode = mode; mKd = GSM::gAMRKd[d_tch_mode]; mTCHD.resize(mKd); mTCHU.resize(mKd+6); mTCHParity = Parity(0x06f,6, GSM::gAMRClass1ALth[d_tch_mode]); mAMRBitOrder = GSM::gAMRBitOrder[d_tch_mode]; mClass1ALth = GSM::gAMRClass1ALth[d_tch_mode]; mClass1BLth = GSM::gAMRKd[d_tch_mode] - GSM::gAMRClass1ALth[d_tch_mode]; mTCHUC.resize(GSM::gAMRTCHUCLth[d_tch_mode]); mPuncture = GSM::gAMRPuncture[d_tch_mode]; mPunctureLth = GSM::gAMRPunctureLth[d_tch_mode]; mClass1A_d.dup(mTCHD.head(mClass1ALth)); switch (d_tch_mode) { case TCH_AFS12_2: mViterbi = new ViterbiTCH_AFS12_2(); mAMRFrameLth = 32; mAMRFrameHeader = 0x3c; break; case TCH_AFS10_2: mViterbi = new ViterbiTCH_AFS10_2(); mAMRFrameLth = 27; mAMRFrameHeader = 0x3c; break; case TCH_AFS7_95: mViterbi = new ViterbiTCH_AFS7_95(); mAMRFrameLth = 21; mAMRFrameHeader = 0x3c; break; case TCH_AFS7_4: mViterbi = new ViterbiTCH_AFS7_4(); mAMRFrameLth = 20; mAMRFrameHeader = 0x3c; break; case TCH_AFS6_7: mViterbi = new ViterbiTCH_AFS6_7(); mAMRFrameLth = 18; mAMRFrameHeader = 0x3c; break; case TCH_AFS5_9: mViterbi = new ViterbiTCH_AFS5_9(); mAMRFrameLth = 16; mAMRFrameHeader = 0x14; break; case TCH_AFS5_15: mViterbi = new ViterbiTCH_AFS5_15(); mAMRFrameLth = 14; mAMRFrameHeader = 0x3c; break; case TCH_AFS4_75: mViterbi = new ViterbiTCH_AFS4_75(); mAMRFrameLth = 13; mAMRFrameHeader = 0x3c; break; default: mViterbi = new ViterbiTCH_AFS12_2(); mAMRFrameLth = 32; mAMRFrameHeader = 0x3c; break; } } } } /* namespace gsm */ } /* namespace gr */ gr-gsm-0.41.2/lib/decoding/tch_f_decoder_impl.h000066400000000000000000000060751316153413000212630ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GSM_TCH_F_DECODER_IMPL_H #define INCLUDED_GSM_TCH_F_DECODER_IMPL_H #include "openbts/AmrCoder.h" #include "openbts/BitVector.h" #include "openbts/GSM503Tables.h" #include "openbts/GSM610Tables.h" #include "openbts/GSM660Tables.h" #include "openbts/ViterbiR204.h" #include #define DATA_BLOCK_SIZE 184 #define PARITY_SIZE 40 #define FLUSH_BITS_SIZE 4 #define PARITY_OUTPUT_SIZE (DATA_BLOCK_SIZE + PARITY_SIZE + FLUSH_BITS_SIZE) #define CONV_INPUT_SIZE PARITY_OUTPUT_SIZE #define CONV_SIZE (2 * CONV_INPUT_SIZE) #define BLOCKS 8 #define iBLOCK_SIZE (CONV_SIZE / BLOCKS) namespace gr { namespace gsm { class tch_f_decoder_impl : public tch_f_decoder { private: unsigned int d_collected_bursts_num; unsigned short interleave_trans[CONV_SIZE]; pmt::pmt_t d_bursts[8]; enum tch_mode d_tch_mode; bool d_boundary_check; bool d_boundary_decode; bool d_header_sent; BitVector mU; BitVector mP; BitVector mD; BitVector mDP; BitVector mTCHU; BitVector mTCHD; BitVector mClass1A_d; SoftVector mC; SoftVector mClass1_c; SoftVector mClass2_c; SoftVector mTCHUC; Parity mBlockCoder; Parity mTCHParity; ViterbiR2O4 mVR204Coder; ViterbiBase *mViterbi; unsigned char iBLOCK[2*BLOCKS*iBLOCK_SIZE]; unsigned char mAMRFrameHeader; const unsigned *mAMRBitOrder; const unsigned *mPuncture; unsigned mClass1ALth; unsigned mClass1BLth; unsigned mPunctureLth; uint8_t mAMRFrameLth; uint8_t mKd; void decode(pmt::pmt_t msg); void setCodingMode(tch_mode mode); public: tch_f_decoder_impl(tch_mode mode, bool boundary_check=false); ~tch_f_decoder_impl(); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_TCH_F_DECODER_IMPL_H */ gr-gsm-0.41.2/lib/decryption/000077500000000000000000000000001316153413000157155ustar00rootroot00000000000000gr-gsm-0.41.2/lib/decryption/CMakeLists.txt000066400000000000000000000014661316153413000204640ustar00rootroot00000000000000# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. add_sources( decryption_impl.cc ) gr-gsm-0.41.2/lib/decryption/decryption_impl.cc000066400000000000000000000122321316153413000214250ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2014 by Piotr Krysik * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "decryption_impl.h" extern "C" { #include } const uint32_t BURST_SIZE=148; namespace gr { namespace gsm { decryption::sptr decryption::make(const std::vector & k_c, unsigned int a5_version) { return gnuradio::get_initial_sptr (new decryption_impl(k_c, a5_version)); } /* * The private constructor */ decryption_impl::decryption_impl(const std::vector & k_c, unsigned int a5_version) : gr::block("decryption", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), d_k_c_valid(false) { set_k_c(k_c); set_a5_version(a5_version); validate_k_c(); message_port_register_in(pmt::mp("bursts")); set_msg_handler(pmt::mp("bursts"), boost::bind(&decryption_impl::decrypt, this, _1)); message_port_register_out(pmt::mp("bursts")); } /* * Virtual destructor */ decryption_impl::~decryption_impl() { } void decryption_impl::set_k_c(const std::vector & k_c) { d_k_c = k_c; } void decryption_impl::set_a5_version(unsigned int a5_version) { d_a5_version = 1; if (a5_version >= 1 && a5_version <= 4) { d_a5_version = a5_version; } } void decryption_impl::validate_k_c() { if (d_k_c.size() == 0) { d_k_c_valid = false; return; } else if ((d_a5_version < 4 && d_k_c.size() != 8) || (d_a5_version == 4 && d_k_c.size() != 16)) { d_k_c_valid = false; return; } else { for (int i=0; iframe_number); bool uplink_burst = (be16toh(header->arfcn) & 0x4000) ? true : false; if(uplink_burst){ //process uplink burst osmo_a5(d_a5_version, &d_k_c[0], frame_number, NULL, keystream); } else { //process downlink burst osmo_a5(d_a5_version, &d_k_c[0], frame_number, keystream, NULL); } /* guard bits */ for (int i = 0; i < 3; i++) { decrypted_data[i] = burst_binary[i]; } //decrypt first part of the burst for (int i = 0; i < 57; i++) { decrypted_data[i+3] = keystream[i] ^ burst_binary[i+3]; } /* stealing bits and midamble */ for (int i = 60; i < 88; i++) { decrypted_data[i] = burst_binary[i]; } //decrypt second part of the burst for (int i = 0; i < 57; i++) { decrypted_data[i+88] = keystream[i+57] ^ burst_binary[i+88]; } /* guard bits */ for (int i = 145; i < 148; i++) { decrypted_data[i] = burst_binary[i]; } uint8_t new_header_plus_burst[sizeof(gsmtap_hdr)+BURST_SIZE]; memcpy(new_header_plus_burst, header, sizeof(gsmtap_hdr)); memcpy(new_header_plus_burst+sizeof(gsmtap_hdr), decrypted_data, BURST_SIZE); pmt::pmt_t msg_binary_blob = pmt::make_blob(new_header_plus_burst, sizeof(gsmtap_hdr)+BURST_SIZE); pmt::pmt_t msg_out = pmt::cons(pmt::PMT_NIL, msg_binary_blob); message_port_pub(pmt::mp("bursts"), msg_out); } return; } } /* namespace gsm */ } /* namespace gr */ gr-gsm-0.41.2/lib/decryption/decryption_impl.h000066400000000000000000000030011316153413000212610ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2014 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GSM_DECRYPTION_IMPL_H #define INCLUDED_GSM_DECRYPTION_IMPL_H #include #include namespace gr { namespace gsm { class decryption_impl : public decryption { private: std::vector d_k_c; bool d_k_c_valid; uint8_t d_a5_version; void decrypt(pmt::pmt_t msg); void validate_k_c(); public: decryption_impl(const std::vector & k_c, unsigned int a5_version); ~decryption_impl(); virtual void set_k_c(const std::vector & k_c); virtual void set_a5_version(unsigned int a5_version); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_DECRYPTION_IMPL_H */ gr-gsm-0.41.2/lib/demapping/000077500000000000000000000000001316153413000155015ustar00rootroot00000000000000gr-gsm-0.41.2/lib/demapping/CMakeLists.txt000066400000000000000000000015531316153413000202450ustar00rootroot00000000000000# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. add_sources( tch_f_chans_demapper_impl.cc universal_ctrl_chans_demapper_impl.cc ) gr-gsm-0.41.2/lib/demapping/tch_f_chans_demapper_impl.cc000066400000000000000000000211451316153413000231500ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "tch_f_chans_demapper_impl.h" #include #include #define BURST_SIZE 148 namespace gr { namespace gsm { tch_f_chans_demapper::sptr tch_f_chans_demapper::make(unsigned int timeslot_nr) { return gnuradio::get_initial_sptr (new tch_f_chans_demapper_impl(timeslot_nr)); } /* * The private constructor * */ tch_f_chans_demapper_impl::tch_f_chans_demapper_impl(unsigned int timeslot_nr) : gr::block("tch_f_chans_demapper", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), d_timeslot(timeslot_nr) { // for (int ii=0; ii<3; ii++) // { // d_bursts_stolen[ii] = false; // } message_port_register_in(pmt::mp("bursts")); set_msg_handler(pmt::mp("bursts"), boost::bind(&tch_f_chans_demapper_impl::filter_tch_chans, this, _1)); message_port_register_out(pmt::mp("tch_bursts")); message_port_register_out(pmt::mp("acch_bursts")); } /* * Our virtual destructor. */ tch_f_chans_demapper_impl::~tch_f_chans_demapper_impl() { } void tch_f_chans_demapper_impl::filter_tch_chans(pmt::pmt_t msg) { pmt::pmt_t header_plus_burst = pmt::cdr(msg); gsmtap_hdr * header = (gsmtap_hdr *)pmt::blob_data(header_plus_burst); uint32_t frame_nr = be32toh(header->frame_number); uint32_t fn_mod26 = frame_nr % 26; uint32_t fn_mod13 = frame_nr % 13; int8_t * burst_bits = (int8_t *)(pmt::blob_data(header_plus_burst))+sizeof(gsmtap_hdr); if(header->timeslot == d_timeslot){ int8_t new_msg[sizeof(gsmtap_hdr)+BURST_SIZE]; gsmtap_hdr * new_hdr = (gsmtap_hdr*)new_msg; memcpy(new_msg, header, sizeof(gsmtap_hdr)+BURST_SIZE); new_hdr->sub_type = GSMTAP_CHANNEL_TCH_F; if (fn_mod13 == 12) new_hdr->sub_type = GSMTAP_CHANNEL_ACCH|GSMTAP_CHANNEL_TCH_F; pmt::pmt_t msg_binary_blob = pmt::make_blob(new_msg,sizeof(gsmtap_hdr)+BURST_SIZE); pmt::pmt_t msg_out = pmt::cons(pmt::PMT_NIL, msg_binary_blob); //distinguishing uplink and downlink bursts bool uplink_burst = (be16toh(header->arfcn) & 0x4000) ? true : false; if(uplink_burst) { sacch_tch_demapper(fn_mod13, fn_mod26, frame_nr,d_bursts_sacch_ul, d_frame_numbers_sacch_ul, d_bursts_ul, d_frame_numbers_ul, msg_out); } else { sacch_tch_demapper(fn_mod13, fn_mod26, frame_nr,d_bursts_sacch_dl, d_frame_numbers_sacch_dl, d_bursts_dl, d_frame_numbers_dl, msg_out); } } } void tch_f_chans_demapper_impl::sacch_tch_demapper(uint32_t fn_mod13, u_int32_t fn_mod26, uint32_t frame_nr, pmt::pmt_t *d_bursts_sacch, uint32_t *d_frame_numbers_sacch, pmt::pmt_t d_bursts[3][8], uint32_t d_frame_numbers[3][8], pmt::pmt_t msg_out) { bool frames_are_consecutive = true; if (fn_mod13 == 12) { // position of SACCH burst based on timeslot // see specification gsm 05.02 uint32_t index; bool is_sacch = false; if (d_timeslot % 2 == 0 && fn_mod26 == 12) { index = (((frame_nr - 12) / 26) - (d_timeslot / 2)) % 4; is_sacch = true; } else if (d_timeslot % 2 == 1 && fn_mod26 == 25) { index = (((frame_nr - 25) / 26) - ((d_timeslot - 1) / 2)) % 4; is_sacch = true; } if (is_sacch) { d_bursts_sacch[index] = msg_out; d_frame_numbers_sacch[index] = frame_nr; if (index == 3) { //check for a situation where some bursts were lost //in this situation frame numbers won't be consecutive frames_are_consecutive = true; for(int jj=1; jj<4; jj++) { if((d_frame_numbers_sacch[jj]-d_frame_numbers_sacch[jj-1]) != 26) { frames_are_consecutive = false; } } if(frames_are_consecutive) { //send bursts to the output for(int jj=0; jj<4; jj++) { message_port_pub(pmt::mp("acch_bursts"), d_bursts_sacch[jj]); } } } } } else { if (fn_mod13 <= 3) { // add to b1 and b3 d_bursts[0][fn_mod13] = msg_out; d_bursts[2][fn_mod13 + 4] = msg_out; // set framenumber for later checking of continuity d_frame_numbers[0][fn_mod13] = frame_nr; d_frame_numbers[2][fn_mod13 + 4] = frame_nr; } else if (fn_mod13 >= 4 && fn_mod13 <= 7) { // add to b1 and b2 d_bursts[0][fn_mod13] = msg_out; d_bursts[1][fn_mod13 - 4] = msg_out; // set framenumber for later checking of continuity d_frame_numbers[0][fn_mod13] = frame_nr; d_frame_numbers[1][fn_mod13 - 4] = frame_nr; } else if (fn_mod13 >= 8 && fn_mod13 <= 11) { // add to b2 and b3 d_bursts[1][fn_mod13 - 4] = msg_out; d_bursts[2][fn_mod13 - 8] = msg_out; // set framenumber for later checking of continuity d_frame_numbers[1][fn_mod13 - 4] = frame_nr; d_frame_numbers[2][fn_mod13 - 8] = frame_nr; } // send burst 1 or burst 2 to output if (fn_mod13 == 3 || fn_mod13 == 7 || fn_mod13 == 11) { int tch_burst_nr = 0; if (fn_mod13 == 11) { tch_burst_nr = 1; } else if (fn_mod13 == 3) { tch_burst_nr = 2; } //check for a situation where some bursts were lost //in this situation frame numbers won't be consecutive frames_are_consecutive = true; for(int jj=1; jj<8; jj++) { if (((d_frame_numbers[tch_burst_nr][jj] - d_frame_numbers[tch_burst_nr][jj-1]) != 1) && frames_are_consecutive) { frames_are_consecutive = false; // burst 3 has 1 sacch burst in between if (tch_burst_nr == 2 && jj == 4 && d_frame_numbers[tch_burst_nr][jj] - d_frame_numbers[tch_burst_nr][jj - 1] == 2) { frames_are_consecutive = true; } } } if(frames_are_consecutive) { //send bursts to the output for(int jj=0; jj<8; jj++) { message_port_pub(pmt::mp("tch_bursts"), d_bursts[tch_burst_nr][jj]); } // useless // d_bursts_stolen[tch_burst_nr] = false; } } } } } /* namespace gsm */ } /* namespace gr */ gr-gsm-0.41.2/lib/demapping/tch_f_chans_demapper_impl.h000066400000000000000000000046601316153413000230150ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GSM_UNIVERSAL_TCH_CHANS_DEMAPPER_IMPL_H #define INCLUDED_GSM_UNIVERSAL_TCH_CHANS_DEMAPPER_IMPL_H #include namespace gr { namespace gsm { class tch_f_chans_demapper_impl : public tch_f_chans_demapper { private: unsigned int d_timeslot; // Downlink uint32_t d_frame_numbers_dl[3][8]; // for checking consecutive frame numbers of tch uint32_t d_frame_numbers_sacch_dl[4]; // for checking consecutive frame numbers of sacch pmt::pmt_t d_bursts_dl[3][8]; // for tch output headers+bursts pmt::pmt_t d_bursts_sacch_dl[4]; // for sacch output bursts // bool d_bursts_stolen[3]; // useless! // Uplink uint32_t d_frame_numbers_ul[3][8]; // for checking consecutive frame numbers of tch uint32_t d_frame_numbers_sacch_ul[4]; // for checking consecutive frame numbers of sacch pmt::pmt_t d_bursts_ul[3][8]; // for tch output headers+bursts pmt::pmt_t d_bursts_sacch_ul[4]; // for sacch output bursts void sacch_tch_demapper(uint32_t fn_mod13, u_int32_t fn_mod26, uint32_t frame_nr, pmt::pmt_t *d_bursts_sacch, uint32_t *d_frame_numbers_sacch, pmt::pmt_t d_bursts[3][8], uint32_t d_frame_numbers[3][8], pmt::pmt_t msg_out); public: tch_f_chans_demapper_impl(unsigned int timeslot_nr); ~tch_f_chans_demapper_impl(); void filter_tch_chans(pmt::pmt_t msg); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_UNIVERSAL_TCH_CHANS_DEMAPPER_IMPL_H */ gr-gsm-0.41.2/lib/demapping/universal_ctrl_chans_demapper_impl.cc000066400000000000000000000175141316153413000251260ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2016 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "universal_ctrl_chans_demapper_impl.h" #include #include #include #define BURST_SIZE 148 namespace gr { namespace gsm { universal_ctrl_chans_demapper::sptr universal_ctrl_chans_demapper::make(unsigned int timeslot_nr, const std::vector &downlink_starts_fn_mod51, const std::vector &downlink_channel_types, const std::vector &downlink_subslots, const std::vector &uplink_starts_fn_mod51, const std::vector &uplink_channel_types, const std::vector &uplink_subslots) { return gnuradio::get_initial_sptr (new universal_ctrl_chans_demapper_impl(timeslot_nr, downlink_starts_fn_mod51, downlink_channel_types, downlink_subslots, uplink_starts_fn_mod51, uplink_channel_types, uplink_subslots)); } /* * The private constructor */ universal_ctrl_chans_demapper_impl::universal_ctrl_chans_demapper_impl(unsigned int timeslot_nr, const std::vector &downlink_starts_fn_mod51, const std::vector &downlink_channel_types, const std::vector &downlink_subslots, const std::vector &uplink_starts_fn_mod51, const std::vector &uplink_channel_types, const std::vector &uplink_subslots) : gr::block("universal_ctrl_chans_demapper", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), d_timeslot_nr(timeslot_nr), d_downlink_starts_fn_mod51(51, 0), d_downlink_channel_types(51, 0), d_downlink_subslots(102, 0), d_uplink_starts_fn_mod51(51, 0), d_uplink_channel_types(51, 0), d_uplink_subslots(102, 0) { if(downlink_starts_fn_mod51.size() != 51 || downlink_channel_types.size() != 51 || downlink_subslots.size() != 102 || uplink_starts_fn_mod51.size() != 51 || uplink_channel_types.size() != 51 || uplink_subslots.size() != 102 ) { std::cout << "Check lengths of the vectors passed to the universal demapper - _starts_fn_mod15 and _sublots should have 51 elements, _subslots should have 102 elements" << std::endl; std::runtime_error("Check lengths of the vectors passed to the universal demapper - _starts_fn_mod15 and _sublots should have 51 elements, _subslots should have 102 elements"); } std::copy(downlink_starts_fn_mod51.begin(), downlink_starts_fn_mod51.end(), d_downlink_starts_fn_mod51.begin()); std::copy(downlink_channel_types.begin(), downlink_channel_types.end(), d_downlink_channel_types.begin()); std::copy(downlink_subslots.begin(), downlink_subslots.end(), d_downlink_subslots.begin()); std::copy(uplink_starts_fn_mod51.begin(), uplink_starts_fn_mod51.end(), d_uplink_starts_fn_mod51.begin()); std::copy(uplink_channel_types.begin(), uplink_channel_types.end(), d_uplink_channel_types.begin()); std::copy(uplink_subslots.begin(), uplink_subslots.end(), d_uplink_subslots.begin()); message_port_register_in(pmt::mp("bursts")); set_msg_handler(pmt::mp("bursts"), boost::bind(&universal_ctrl_chans_demapper_impl::filter_ctrl_chans, this, _1)); message_port_register_out(pmt::mp("bursts")); } /* * Our virtual destructor. */ universal_ctrl_chans_demapper_impl::~universal_ctrl_chans_demapper_impl() { } void universal_ctrl_chans_demapper_impl::filter_ctrl_chans(pmt::pmt_t burst_in) { pmt::pmt_t header_plus_burst = pmt::cdr(burst_in); int8_t * burst_in_int8 = (int8_t *)pmt::blob_data(header_plus_burst); gsmtap_hdr * header = (gsmtap_hdr *)(burst_in_int8); if(header->timeslot==d_timeslot_nr) { int * starts_fn_mod51; int * channel_types; int * subslots; uint32_t * frame_numbers; pmt::pmt_t * bursts; uint32_t frame_nr = be32toh(header->frame_number); //get frame number uint32_t fn_mod51 = frame_nr % 51; //frame number modulo 51 uint32_t fn_mod102 = frame_nr % 102; //frame number modulo 102 //create new burst int8_t burst_tmp[sizeof(gsmtap_hdr)+BURST_SIZE]; memcpy(burst_tmp, burst_in_int8, sizeof(gsmtap_hdr)+BURST_SIZE); pmt::pmt_t msg_binary_blob = pmt::make_blob(burst_tmp,sizeof(gsmtap_hdr)+BURST_SIZE); pmt::pmt_t burst_out = pmt::cons(pmt::PMT_NIL, msg_binary_blob); gsmtap_hdr * new_header = (gsmtap_hdr *)pmt::blob_data(msg_binary_blob); //get information if burst is from uplink or downlink bool uplink_burst = (be16toh(header->arfcn) & 0x4000) ? true : false; //select right set of configuration and history for uplink or downlink if(uplink_burst) { starts_fn_mod51 = &d_uplink_starts_fn_mod51[0]; channel_types = &d_uplink_channel_types[0]; subslots = &d_uplink_subslots[0]; frame_numbers = d_uplink_frame_numbers; bursts = d_uplink_bursts; } else { starts_fn_mod51 = &d_downlink_starts_fn_mod51[0]; channel_types = &d_downlink_channel_types[0]; subslots = &d_downlink_subslots[0]; frame_numbers = d_downlink_frame_numbers; bursts = d_downlink_bursts; } uint32_t fn51_start = starts_fn_mod51[fn_mod51]; uint32_t fn51_stop = fn51_start + 3; //set type new_header->type = GSMTAP_TYPE_UM; //set type of the channel uint32_t ch_type = channel_types[fn_mod51]; if(ch_type != 0) { new_header->sub_type = ch_type; } new_header->sub_slot = subslots[fn_mod51 + (51 * (frame_nr % 2))]; if(fn_mod51>=fn51_start && fn_mod51<=fn51_stop) { uint32_t ii = fn_mod51 - fn51_start; frame_numbers[ii] = frame_nr; bursts[ii] = burst_out; } if(fn_mod51==fn51_stop) { //check for a situation where some bursts were lost //in this situation frame numbers won't be consecutive bool frames_are_consecutive = true; for(int jj=1; jj<4; jj++) { if((frame_numbers[jj] - frame_numbers[jj-1])!=1) { frames_are_consecutive = false; } } if(frames_are_consecutive) { //send bursts to the output for(int jj=0; jj<4; jj++) { message_port_pub(pmt::mp("bursts"), bursts[jj]); } } } } } } /* namespace gsm */ } /* namespace gr */ gr-gsm-0.41.2/lib/demapping/universal_ctrl_chans_demapper_impl.h000066400000000000000000000044771316153413000247740ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2016 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GSM_UNIVERSAL_CTRL_CHANS_DEMAPPER_IMPL_H #define INCLUDED_GSM_UNIVERSAL_CTRL_CHANS_DEMAPPER_IMPL_H #include #include namespace gr { namespace gsm { typedef enum {downlink=0,uplink=1} um_radio_link_direction; class universal_ctrl_chans_demapper_impl : public universal_ctrl_chans_demapper { private: //configuration of the block unsigned int d_timeslot_nr; std::vector d_downlink_starts_fn_mod51; std::vector d_downlink_channel_types; std::vector d_downlink_subslots; std::vector d_uplink_starts_fn_mod51; std::vector d_uplink_channel_types; std::vector d_uplink_subslots; //history of the downlink and uplink bursts uint32_t d_downlink_frame_numbers[4]; pmt::pmt_t d_downlink_bursts[4]; uint32_t d_uplink_frame_numbers[4]; pmt::pmt_t d_uplink_bursts[4]; public: universal_ctrl_chans_demapper_impl(unsigned int timeslot_nr, const std::vector &downlink_starts_fn_mod51, const std::vector &downlink_channel_types, const std::vector &downlink_subslots, const std::vector &uplink_starts_fn_mod51, const std::vector &uplink_channel_types, const std::vector &uplink_subslots); ~universal_ctrl_chans_demapper_impl(); void filter_ctrl_chans(pmt::pmt_t msg); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_UNIVERSAL_CTRL_CHANS_DEMAPPER_IMPL_H */ gr-gsm-0.41.2/lib/flow_control/000077500000000000000000000000001316153413000162445ustar00rootroot00000000000000gr-gsm-0.41.2/lib/flow_control/CMakeLists.txt000066400000000000000000000020271316153413000210050ustar00rootroot00000000000000# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. add_sources( burst_fnr_filter_impl.cc burst_sdcch_subslot_filter_impl.cc burst_sdcch_subslot_splitter_impl.cc burst_timeslot_filter_impl.cc burst_timeslot_splitter_impl.cc dummy_burst_filter_impl.cc uplink_downlink_splitter_impl.cc ) gr-gsm-0.41.2/lib/flow_control/burst_fnr_filter_impl.cc000066400000000000000000000065741316153413000231610ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "burst_fnr_filter_impl.h" #include #include #include namespace gr { namespace gsm { burst_fnr_filter::sptr burst_fnr_filter::make(filter_mode mode, unsigned int fnr) { return gnuradio::get_initial_sptr (new burst_fnr_filter_impl(mode, fnr)); } /* * The private constructor */ burst_fnr_filter_impl::burst_fnr_filter_impl(filter_mode mode, unsigned int fnr) : gr::block("burst_fnr_filter", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), d_mode(mode), d_framenr(fnr), d_filter_policy(FILTER_POLICY_DEFAULT) { message_port_register_in(pmt::mp("in")); message_port_register_out(pmt::mp("out")); set_msg_handler(pmt::mp("in"), boost::bind(&burst_fnr_filter_impl::process_burst, this, _1)); } /* * Our virtual destructor. */ burst_fnr_filter_impl::~burst_fnr_filter_impl() {} void burst_fnr_filter_impl::process_burst(pmt::pmt_t msg) { if (d_filter_policy == FILTER_POLICY_DROP_ALL) return; if (d_filter_policy == FILTER_POLICY_PASS_ALL) { message_port_pub(pmt::mp("out"), msg); return; } pmt::pmt_t header_plus_burst = pmt::cdr(msg); gsmtap_hdr * header = (gsmtap_hdr *)pmt::blob_data(header_plus_burst); unsigned int frame_nr = be32toh(header->frame_number); if ((d_mode == FILTER_LESS_OR_EQUAL && frame_nr <= d_framenr) || (d_mode == FILTER_GREATER_OR_EQUAL && frame_nr >= d_framenr)) { message_port_pub(pmt::mp("out"), msg); } } /* External API */ unsigned int burst_fnr_filter_impl::get_fn(void) { return d_framenr; } unsigned int burst_fnr_filter_impl::set_fn(unsigned int fn) { if (fn <= GSM_HYPERFRAME) d_framenr = fn; return d_framenr; } filter_mode burst_fnr_filter_impl::get_mode(void) { return d_mode; } filter_mode burst_fnr_filter_impl::set_mode(filter_mode mode) { d_mode = mode; return d_mode; } /* Filtering policy */ filter_policy burst_fnr_filter_impl::get_policy(void) { return d_filter_policy; } filter_policy burst_fnr_filter_impl::set_policy(filter_policy policy) { d_filter_policy = policy; return d_filter_policy; } } /* namespace gsm */ } /* namespace gr */ gr-gsm-0.41.2/lib/flow_control/burst_fnr_filter_impl.h000066400000000000000000000034161316153413000230130ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_BURST_FNR_FILTER_IMPL_H #define INCLUDED_GSM_BURST_FNR_FILTER_IMPL_H #include #define GSM_SUPERFRAME (26 * 51) #define GSM_HYPERFRAME (2048 * GSM_SUPERFRAME) namespace gr { namespace gsm { class burst_fnr_filter_impl : public burst_fnr_filter { private: filter_policy d_filter_policy; unsigned int d_framenr; filter_mode d_mode; public: burst_fnr_filter_impl(filter_mode mode, unsigned int fnr); ~burst_fnr_filter_impl(); void process_burst(pmt::pmt_t msg); /* External API */ unsigned int get_fn(void); unsigned int set_fn(unsigned int fn); filter_mode get_mode(void); filter_mode set_mode(filter_mode mode); /* Filtering policy */ filter_policy get_policy(void); filter_policy set_policy(filter_policy policy); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_BURST_FNR_FILTER_IMPL_H */ gr-gsm-0.41.2/lib/flow_control/burst_sdcch_subslot_filter_impl.cc000066400000000000000000000116301316153413000252200ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "burst_sdcch_subslot_filter_impl.h" #include #include #include namespace gr { namespace gsm { burst_sdcch_subslot_filter::sptr burst_sdcch_subslot_filter::make(subslot_filter_mode mode, unsigned int subslot) { return gnuradio::get_initial_sptr (new burst_sdcch_subslot_filter_impl(mode, subslot)); } /* * The private constructor */ burst_sdcch_subslot_filter_impl::burst_sdcch_subslot_filter_impl(subslot_filter_mode mode, unsigned int subslot) : gr::block("burst_sdcch_subslot_filter", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), d_mode(mode), d_subslot(subslot), d_filter_policy(FILTER_POLICY_DEFAULT) { message_port_register_in(pmt::mp("in")); message_port_register_out(pmt::mp("out")); set_msg_handler(pmt::mp("in"), boost::bind(&burst_sdcch_subslot_filter_impl::process_burst, this, _1)); } /* * Our virtual destructor. */ burst_sdcch_subslot_filter_impl::~burst_sdcch_subslot_filter_impl() {} void burst_sdcch_subslot_filter_impl::process_burst(pmt::pmt_t msg) { // hardcoded subslots of the channels, both SDCCH and the associated SACCH // -1 means that the particular position in the frame is not SDCCH static const int8_t subslots_sdcch4[102] = { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1,-1,-1, 2, 2, 2, 2, 3, 3, 3, 3,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1,-1,-1, 2, 2, 2, 2, 3, 3, 3, 3,-1,-1, 2, 2, 2, 2, 3, 3, 3, 3,-1 }; static const int8_t subslots_sdcch8[102] = { 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,-1,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,-1,-1,-1 }; if (d_filter_policy == FILTER_POLICY_DROP_ALL) return; if (d_filter_policy == FILTER_POLICY_PASS_ALL) { message_port_pub(pmt::mp("out"), msg); return; } pmt::pmt_t header_plus_burst = pmt::cdr(msg); gsmtap_hdr * header = (gsmtap_hdr *)pmt::blob_data(header_plus_burst); uint32_t frame_nr = be32toh(header->frame_number); uint32_t fn_mod102 = frame_nr % 102; int8_t subslot; if (d_mode == SS_FILTER_SDCCH8) { subslot = subslots_sdcch8[fn_mod102]; } else if (d_mode == SS_FILTER_SDCCH4) { subslot = subslots_sdcch4[fn_mod102]; } if ((subslot == -1) || (d_mode == SS_FILTER_SDCCH4 && subslot > 3)) { return; } if (subslot == d_subslot) { message_port_pub(pmt::mp("out"), msg); } } /* External API */ unsigned int burst_sdcch_subslot_filter_impl::get_ss(void) { return d_subslot; } unsigned int burst_sdcch_subslot_filter_impl::set_ss(unsigned int ss) { if ((d_mode == SS_FILTER_SDCCH8 && ss < 8) || (d_mode == SS_FILTER_SDCCH4 && ss < 4)) d_subslot = ss; return d_subslot; } subslot_filter_mode burst_sdcch_subslot_filter_impl::get_mode(void) { return d_mode; } subslot_filter_mode burst_sdcch_subslot_filter_impl::set_mode(subslot_filter_mode mode) { d_mode = mode; return d_mode; } /* Filtering policy */ filter_policy burst_sdcch_subslot_filter_impl::get_policy(void) { return d_filter_policy; } filter_policy burst_sdcch_subslot_filter_impl::set_policy(filter_policy policy) { d_filter_policy = policy; return d_filter_policy; } } /* namespace gsm */ } /* namespace gr */ gr-gsm-0.41.2/lib/flow_control/burst_sdcch_subslot_filter_impl.h000066400000000000000000000034621316153413000250660ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_BURST_SDCCH_SUBSLOT_FILTER_IMPL_H #define INCLUDED_GSM_BURST_SDCCH_SUBSLOT_FILTER_IMPL_H #include namespace gr { namespace gsm { class burst_sdcch_subslot_filter_impl : public burst_sdcch_subslot_filter { private: filter_policy d_filter_policy; subslot_filter_mode d_mode; unsigned int d_subslot; public: burst_sdcch_subslot_filter_impl(subslot_filter_mode mode, unsigned int subslot); ~burst_sdcch_subslot_filter_impl(); void process_burst(pmt::pmt_t msg); /* External API */ unsigned int get_ss(void); unsigned int set_ss(unsigned int ss); subslot_filter_mode get_mode(void); subslot_filter_mode set_mode(subslot_filter_mode mode); /* Filtering policy */ filter_policy get_policy(void); filter_policy set_policy(filter_policy policy); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_BURST_SDCCH_SUBSLOT_FILTER_IMPL_H */ gr-gsm-0.41.2/lib/flow_control/burst_sdcch_subslot_splitter_impl.cc000066400000000000000000000121031316153413000255750ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "burst_sdcch_subslot_splitter_impl.h" #include #include #include namespace gr { namespace gsm { burst_sdcch_subslot_splitter::sptr burst_sdcch_subslot_splitter::make(splitter_mode mode) { return gnuradio::get_initial_sptr (new burst_sdcch_subslot_splitter_impl(mode)); } /* * The private constructor */ burst_sdcch_subslot_splitter_impl::burst_sdcch_subslot_splitter_impl(splitter_mode mode) : gr::block("burst_sdcch_subslot_splitter", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), d_mode(mode) { message_port_register_in(pmt::mp("in")); message_port_register_out(pmt::mp("out0")); message_port_register_out(pmt::mp("out1")); message_port_register_out(pmt::mp("out2")); message_port_register_out(pmt::mp("out3")); if (d_mode == SPLITTER_SDCCH8) { message_port_register_out(pmt::mp("out4")); message_port_register_out(pmt::mp("out5")); message_port_register_out(pmt::mp("out6")); message_port_register_out(pmt::mp("out7")); } set_msg_handler(pmt::mp("in"), boost::bind(&burst_sdcch_subslot_splitter_impl::process_burst, this, _1)); } /* * Our virtual destructor. */ burst_sdcch_subslot_splitter_impl::~burst_sdcch_subslot_splitter_impl() {} void burst_sdcch_subslot_splitter_impl::process_burst(pmt::pmt_t msg) { // hardcoded subslots of the channels, both SDCCH and the associated SACCH // -1 means that the particular position in the frame is not SDCCH static const int8_t subslots_sdcch4[102] = { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1,-1,-1, 2, 2, 2, 2, 3, 3, 3, 3,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1,-1,-1, 2, 2, 2, 2, 3, 3, 3, 3,-1,-1, 2, 2, 2, 2, 3, 3, 3, 3,-1 }; static const int8_t subslots_sdcch8[102] = { 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,-1,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,-1,-1,-1 }; pmt::pmt_t header_plus_burst = pmt::cdr(msg); gsmtap_hdr * header = (gsmtap_hdr *)pmt::blob_data(header_plus_burst); uint32_t frame_nr = be32toh(header->frame_number); uint32_t fn_mod102 = frame_nr % 102; int8_t subslot; if (d_mode == SPLITTER_SDCCH8) { subslot = subslots_sdcch8[fn_mod102]; } else if (d_mode == SPLITTER_SDCCH4) { subslot = subslots_sdcch4[fn_mod102]; } if ((subslot == -1) || (d_mode == SPLITTER_SDCCH4 && subslot > 3)) { return; } std::string port("out"); switch (subslot) { case 0: port.append("0"); break; case 1: port.append("1"); break; case 2: port.append("2"); break; case 3: port.append("3"); break; case 4: port.append("4"); break; case 5: port.append("5"); break; case 6: port.append("6"); break; case 7: port.append("7"); break; default: port.append("0"); break; } message_port_pub(pmt::mp(port), msg); } /* External API */ splitter_mode burst_sdcch_subslot_splitter_impl::get_mode(void) { return d_mode; } splitter_mode burst_sdcch_subslot_splitter_impl::set_mode(splitter_mode mode) { d_mode = mode; return d_mode; } } /* namespace gsm */ } /* namespace gr */ gr-gsm-0.41.2/lib/flow_control/burst_sdcch_subslot_splitter_impl.h000066400000000000000000000030031316153413000254360ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_BURST_SDCCH_SUBSLOT_SPLITTER_IMPL_H #define INCLUDED_GSM_BURST_SDCCH_SUBSLOT_SPLITTER_IMPL_H #include namespace gr { namespace gsm { class burst_sdcch_subslot_splitter_impl : public burst_sdcch_subslot_splitter { private: splitter_mode d_mode; public: burst_sdcch_subslot_splitter_impl(splitter_mode mode); ~burst_sdcch_subslot_splitter_impl(); void process_burst(pmt::pmt_t msg); /* External API */ splitter_mode get_mode(void); splitter_mode set_mode(splitter_mode mode); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_BURST_SDCCH_SUBSLOT_SPLITTER_IMPL_H */ gr-gsm-0.41.2/lib/flow_control/burst_timeslot_filter_impl.cc000066400000000000000000000061341316153413000242240ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "burst_timeslot_filter_impl.h" #include #include #include namespace gr { namespace gsm { burst_timeslot_filter::sptr burst_timeslot_filter::make(unsigned int timeslot) { return gnuradio::get_initial_sptr (new burst_timeslot_filter_impl(timeslot)); } /* * The private constructor */ burst_timeslot_filter_impl::burst_timeslot_filter_impl(unsigned int timeslot) : gr::block("burst_timeslot_filter", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), d_timeslot(timeslot), d_filter_policy(FILTER_POLICY_DEFAULT) { message_port_register_in(pmt::mp("in")); message_port_register_out(pmt::mp("out")); set_msg_handler(pmt::mp("in"), boost::bind(&burst_timeslot_filter_impl::process_burst, this, _1)); } /* * Our virtual destructor. */ burst_timeslot_filter_impl::~burst_timeslot_filter_impl() {} void burst_timeslot_filter_impl::process_burst(pmt::pmt_t msg) { if (d_filter_policy == FILTER_POLICY_DROP_ALL) return; if (d_filter_policy == FILTER_POLICY_PASS_ALL) { message_port_pub(pmt::mp("out"), msg); return; } pmt::pmt_t header_plus_burst = pmt::cdr(msg); gsmtap_hdr * header = (gsmtap_hdr *)pmt::blob_data(header_plus_burst); unsigned int timeslot = header->timeslot; if (header->timeslot == d_timeslot) { message_port_pub(pmt::mp("out"), msg); } } /* * External API */ unsigned int burst_timeslot_filter_impl::get_tn(void) { return d_timeslot; } unsigned int burst_timeslot_filter_impl::set_tn(unsigned int tn) { if (tn < 8) d_timeslot = tn; return d_timeslot; } /* Filtering policy */ filter_policy burst_timeslot_filter_impl::get_policy(void) { return d_filter_policy; } filter_policy burst_timeslot_filter_impl::set_policy(filter_policy policy) { d_filter_policy = policy; return d_filter_policy; } } /* namespace gsm */ } /* namespace gr */ gr-gsm-0.41.2/lib/flow_control/burst_timeslot_filter_impl.h000066400000000000000000000031501316153413000240610ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_BURST_TIMESLOT_FILTER_IMPL_H #define INCLUDED_GSM_BURST_TIMESLOT_FILTER_IMPL_H #include namespace gr { namespace gsm { class burst_timeslot_filter_impl : public burst_timeslot_filter { private: filter_policy d_filter_policy; unsigned int d_timeslot; public: burst_timeslot_filter_impl(unsigned int timeslot); ~burst_timeslot_filter_impl(); void process_burst(pmt::pmt_t msg); /* External API */ unsigned int get_tn(void); unsigned int set_tn(unsigned int tn); /* Filtering policy */ filter_policy get_policy(void); filter_policy set_policy(filter_policy policy); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_BURST_TIMESLOT_FILTER_IMPL_H */ gr-gsm-0.41.2/lib/flow_control/burst_timeslot_splitter_impl.cc000066400000000000000000000064211316153413000246040ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "burst_timeslot_splitter_impl.h" #include #include #include namespace gr { namespace gsm { burst_timeslot_splitter::sptr burst_timeslot_splitter::make() { return gnuradio::get_initial_sptr (new burst_timeslot_splitter_impl()); } /* * The private constructor */ burst_timeslot_splitter_impl::burst_timeslot_splitter_impl() : gr::block("burst_timeslot_splitter", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)) { message_port_register_in(pmt::mp("in")); message_port_register_out(pmt::mp("out0")); message_port_register_out(pmt::mp("out1")); message_port_register_out(pmt::mp("out2")); message_port_register_out(pmt::mp("out3")); message_port_register_out(pmt::mp("out4")); message_port_register_out(pmt::mp("out5")); message_port_register_out(pmt::mp("out6")); message_port_register_out(pmt::mp("out7")); set_msg_handler(pmt::mp("in"), boost::bind(&burst_timeslot_splitter_impl::process_burst, this, _1)); } /* * Our virtual destructor. */ burst_timeslot_splitter_impl::~burst_timeslot_splitter_impl() {} void burst_timeslot_splitter_impl::process_burst(pmt::pmt_t msg) { pmt::pmt_t header_plus_burst = pmt::cdr(msg); gsmtap_hdr * header = (gsmtap_hdr *)pmt::blob_data(header_plus_burst); unsigned int timeslot = header->timeslot; std::string port("out"); switch (timeslot) { case 0: port.append("0"); break; case 1: port.append("1"); break; case 2: port.append("2"); break; case 3: port.append("3"); break; case 4: port.append("4"); break; case 5: port.append("5"); break; case 6: port.append("6"); break; case 7: port.append("7"); break; default: port.append("0"); break; } message_port_pub(pmt::mp(port), msg); } } /* namespace gsm */ } /* namespace gr */ gr-gsm-0.41.2/lib/flow_control/burst_timeslot_splitter_impl.h000066400000000000000000000024601316153413000244450ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_BURST_TIMESLOT_SPLITTER_IMPL_H #define INCLUDED_GSM_BURST_TIMESLOT_SPLITTER_IMPL_H #include namespace gr { namespace gsm { class burst_timeslot_splitter_impl : public burst_timeslot_splitter { public: burst_timeslot_splitter_impl(); ~burst_timeslot_splitter_impl(); void process_burst(pmt::pmt_t msg); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_BURST_TIMESLOT_SPLITTER_IMPL_H */ gr-gsm-0.41.2/lib/flow_control/dummy_burst_filter_impl.cc000066400000000000000000000071561316153413000235240ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "dummy_burst_filter_impl.h" #include #include #include namespace gr { namespace gsm { // dummy burst defined in gsm 05.02, section 5.2.6 const int8_t dummy_burst_filter_impl::d_dummy_burst[] = {0,0,0, 1,1,1,1,1,0,1,1,0,1,1,1,0,1,1,0, 0,0,0,0,1,0,1,0,0,1,0,0,1,1,1,0, 0,0,0,0,1,0,0,1,0,0,0,1,0,0,0,0, 0,0,0,1,1,1,1,1,0,0,0,1,1,1,0,0, 0,1,0,1,1,1,0,0,0,1,0,1,1,1,0,0, 0,1,0,1,0,1,1,1,0,1,0,0,1,0,1,0, 0,0,1,1,0,0,1,1,0,0,1,1,1,0,0,1, 1,1,1,0,1,0,0,1,1,1,1,1,0,0,0,1, 0,0,1,0,1,1,1,1,1,0,1,0,1,0, 0,0,0 }; dummy_burst_filter::sptr dummy_burst_filter::make() { return gnuradio::get_initial_sptr (new dummy_burst_filter_impl()); } /* * The private constructor */ dummy_burst_filter_impl::dummy_burst_filter_impl() : gr::block("dummy_burst_filter", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), d_filter_policy(FILTER_POLICY_DEFAULT) { message_port_register_in(pmt::mp("in")); message_port_register_out(pmt::mp("out")); set_msg_handler(pmt::mp("in"), boost::bind(&dummy_burst_filter_impl::process_burst, this, _1)); } /* * Our virtual destructor. */ dummy_burst_filter_impl::~dummy_burst_filter_impl() {} void dummy_burst_filter_impl::process_burst(pmt::pmt_t msg) { if (d_filter_policy == FILTER_POLICY_DROP_ALL) return; if (d_filter_policy == FILTER_POLICY_PASS_ALL) { message_port_pub(pmt::mp("out"), msg); return; } pmt::pmt_t header_plus_burst = pmt::cdr(msg); int8_t * burst = (int8_t *)(pmt::blob_data(header_plus_burst)) + sizeof(gsmtap_hdr); size_t burst_len = pmt::blob_length(header_plus_burst) - sizeof(gsmtap_hdr); if (!is_dummy_burst(burst, burst_len)) { message_port_pub(pmt::mp("out"), msg); } } bool dummy_burst_filter_impl::is_dummy_burst(int8_t *burst, size_t burst_len) { if (burst_len != DUMMY_BURST_LEN) { return false; } for (int i=0; i * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_DUMMY_BURST_FILTER_IMPL_H #define INCLUDED_GSM_DUMMY_BURST_FILTER_IMPL_H #define DUMMY_BURST_LEN 148 #include namespace gr { namespace gsm { class dummy_burst_filter_impl : public dummy_burst_filter { private: bool is_dummy_burst(int8_t *burst, size_t burst_len); static const int8_t d_dummy_burst[]; filter_policy d_filter_policy; public: dummy_burst_filter_impl(); ~dummy_burst_filter_impl(); void process_burst(pmt::pmt_t msg); /* External API */ /* Filtering policy */ filter_policy get_policy(void); filter_policy set_policy(filter_policy policy); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_DUMMY_BURST_FILTER_IMPL_H */ gr-gsm-0.41.2/lib/flow_control/uplink_downlink_splitter_impl.cc000066400000000000000000000044431316153413000247360ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2016 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "uplink_downlink_splitter_impl.h" #include #include #define BURST_SIZE 148 namespace gr { namespace grgsm { uplink_downlink_splitter::sptr uplink_downlink_splitter::make() { return gnuradio::get_initial_sptr (new uplink_downlink_splitter_impl()); } /* * The private constructor */ uplink_downlink_splitter_impl::uplink_downlink_splitter_impl() : gr::block("uplink_downlink_splitter", gr::io_signature::make(0,0,0), gr::io_signature::make(0,0,0)) { message_port_register_in(pmt::mp("in")); message_port_register_out(pmt::mp("uplink")); message_port_register_out(pmt::mp("downlink")); set_msg_handler(pmt::mp("in"), boost::bind(&uplink_downlink_splitter_impl::process_msg, this, _1)); } void uplink_downlink_splitter_impl::process_msg(pmt::pmt_t msg) { gsmtap_hdr * header = (gsmtap_hdr *)(pmt::blob_data(pmt::cdr(msg))); bool uplink_burst = (be16toh(header->arfcn) & 0x4000) ? true : false; if(uplink_burst) { message_port_pub(pmt::mp("uplink"), msg); } else { message_port_pub(pmt::mp("downlink"), msg); } } /* * Our virtual destructor. */ uplink_downlink_splitter_impl::~uplink_downlink_splitter_impl() { } } /* namespace grgsm */ } /* namespace gr */ gr-gsm-0.41.2/lib/flow_control/uplink_downlink_splitter_impl.h000066400000000000000000000025021316153413000245720ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2016 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GRGSM_UPLINK_DOWNLINK_SPLITTER_IMPL_H #define INCLUDED_GRGSM_UPLINK_DOWNLINK_SPLITTER_IMPL_H #include namespace gr { namespace grgsm { class uplink_downlink_splitter_impl : public uplink_downlink_splitter { public: uplink_downlink_splitter_impl(); ~uplink_downlink_splitter_impl(); void process_msg(pmt::pmt_t msg); }; } // namespace grgsm } // namespace gr #endif /* INCLUDED_GRGSM_UPLINK_DOWNLINK_SPLITTER_IMPL_H */ gr-gsm-0.41.2/lib/misc_utils/000077500000000000000000000000001316153413000157105ustar00rootroot00000000000000gr-gsm-0.41.2/lib/misc_utils/CMakeLists.txt000066400000000000000000000023201316153413000204450ustar00rootroot00000000000000# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. add_sources( burst_file_sink_impl.cc burst_file_source_impl.cc bursts_printer_impl.cc collect_system_info_impl.cc controlled_fractional_resampler_cc_impl.cc controlled_rotator_cc_impl.cc extract_cmc_impl.cc extract_immediate_assignment_impl.cc extract_system_info_impl.cc message_file_sink_impl.cc message_file_source_impl.cc message_printer_impl.cc msg_to_tag_impl.cc tmsi_dumper_impl.cc ) gr-gsm-0.41.2/lib/misc_utils/burst_file_sink_impl.cc000066400000000000000000000041071316153413000224240ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "burst_file_sink_impl.h" #include "stdio.h" namespace gr { namespace gsm { burst_file_sink::sptr burst_file_sink::make(const std::string &filename) { return gnuradio::get_initial_sptr (new burst_file_sink_impl(filename)); } /* * The private constructor */ burst_file_sink_impl::burst_file_sink_impl(const std::string &filename) : gr::block("burst_file_sink", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), d_output_file(filename.c_str(), std::ofstream::binary) { message_port_register_in(pmt::mp("in")); set_msg_handler(pmt::mp("in"), boost::bind(&burst_file_sink_impl::process_burst, this, _1)); } /* * Our virtual destructor. */ burst_file_sink_impl::~burst_file_sink_impl() { if (d_output_file.is_open()) { d_output_file.close(); } } void burst_file_sink_impl::process_burst(pmt::pmt_t msg) { std::string s = pmt::serialize_str(msg); const char *serialized = s.data(); d_output_file.write(serialized, s.length()); } } /* namespace gsm */ } /* namespace gr */ gr-gsm-0.41.2/lib/misc_utils/burst_file_sink_impl.h000066400000000000000000000025171316153413000222710ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_BURST_FILE_SINK_IMPL_H #define INCLUDED_GSM_BURST_FILE_SINK_IMPL_H #include #include namespace gr { namespace gsm { class burst_file_sink_impl : public burst_file_sink { private: std::ofstream d_output_file; public: burst_file_sink_impl(const std::string &filename); ~burst_file_sink_impl(); void process_burst(pmt::pmt_t msg); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_BURST_FILE_SINK_IMPL_H */ gr-gsm-0.41.2/lib/misc_utils/burst_file_source_impl.cc000066400000000000000000000055701316153413000227650ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "burst_file_source_impl.h" #include "stdio.h" #define PMT_SIZE 174 namespace gr { namespace gsm { burst_file_source::sptr burst_file_source::make(const std::string &filename) { return gnuradio::get_initial_sptr (new burst_file_source_impl(filename)); } /* * The private constructor */ burst_file_source_impl::burst_file_source_impl(const std::string &filename) : gr::block("burst_file_source", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), d_input_file(filename.c_str(), std::ifstream::binary), d_finished(false) { message_port_register_out(pmt::mp("out")); } /* * Our virtual destructor. */ burst_file_source_impl::~burst_file_source_impl() { if (d_finished == false){ d_finished = true; } } bool burst_file_source_impl::start() { d_finished = false; d_thread = boost::shared_ptr (new gr::thread::thread(boost::bind(&burst_file_source_impl::run, this))); return block::start(); } bool burst_file_source_impl::stop() { d_finished = true; d_thread->interrupt(); d_thread->join(); return block::stop(); } bool burst_file_source_impl::finished() { return d_finished; } void burst_file_source_impl::run() { char *unserialized = (char*)malloc(sizeof(char) * PMT_SIZE); while (d_input_file.read(unserialized, PMT_SIZE) && !d_finished) { if (d_input_file.bad()) { break; } std::string s(unserialized, PMT_SIZE); pmt::pmt_t burst = pmt::deserialize_str(s); message_port_pub(pmt::mp("out"), burst); } d_input_file.close(); post(pmt::mp("system"), pmt::cons(pmt::mp("done"), pmt::from_long(1))); } } /* namespace gsm */ } /* namespace gr */ gr-gsm-0.41.2/lib/misc_utils/burst_file_source_impl.h000066400000000000000000000027401316153413000226230ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_BURST_FILE_SOURCE_IMPL_H #define INCLUDED_GSM_BURST_FILE_SOURCE_IMPL_H #include #include namespace gr { namespace gsm { class burst_file_source_impl : public burst_file_source { private: boost::shared_ptr d_thread; std::ifstream d_input_file; bool d_finished; void run(); public: burst_file_source_impl(const std::string &filename); ~burst_file_source_impl(); bool start(); bool stop(); bool finished(); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_BURST_FILE_SOURCE_IMPL_H */ gr-gsm-0.41.2/lib/misc_utils/bursts_printer_impl.cc000066400000000000000000000115511316153413000223300ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2014 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include "bursts_printer_impl.h" #include #include extern "C" { #include } namespace gr { namespace gsm { boost::mutex printer_mutex; // dummy burst defined in gsm 05.02, section 5.2.6 const int8_t bursts_printer_impl::d_dummy_burst[] = {0,0,0, 1,1,1,1,1,0,1,1,0,1,1,1,0,1,1,0, 0,0,0,0,1,0,1,0,0,1,0,0,1,1,1,0, 0,0,0,0,1,0,0,1,0,0,0,1,0,0,0,0, 0,0,0,1,1,1,1,1,0,0,0,1,1,1,0,0, 0,1,0,1,1,1,0,0,0,1,0,1,1,1,0,0, 0,1,0,1,0,1,1,1,0,1,0,0,1,0,1,0, 0,0,1,1,0,0,1,1,0,0,1,1,1,0,0,1, 1,1,1,0,1,0,0,1,1,1,1,1,0,0,0,1, 0,0,1,0,1,1,1,1,1,0,1,0,1,0, 0,0,0 }; void bursts_printer_impl::bursts_print(pmt::pmt_t msg) { pmt::pmt_t header_plus_burst = pmt::cdr(msg); gsmtap_hdr * header = (gsmtap_hdr *)pmt::blob_data(header_plus_burst); int8_t * burst = (int8_t *)(pmt::blob_data(header_plus_burst))+sizeof(gsmtap_hdr); size_t burst_len=pmt::blob_length(header_plus_burst)-sizeof(gsmtap_hdr); uint32_t frame_nr = be32toh(header->frame_number); if (d_ignore_dummy_bursts && is_dummy_burst(burst, burst_len)) { return; } std::cout << d_prepend_string; if (d_prepend_fnr) { std::cout << frame_nr; } if (d_prepend_fnr && d_prepend_frame_count) { std::cout << " "; } if (d_prepend_frame_count) { // calculate fn count using libosmogsm std::cout << osmo_a5_fn_count(frame_nr); } if (d_prepend_fnr || d_prepend_frame_count) { std::cout << ": "; } if (d_print_payload_only) { for (int ii=0; ii<57; ii++) { std::cout << std::setprecision(1) << static_cast(burst[ii + 3]); } for (int ii=0; ii<57; ii++) { std::cout << std::setprecision(1) << static_cast(burst[ii + 88]); } } else { for(int ii=0; ii(burst[ii]); } } std::cout << std::endl; } bool bursts_printer_impl::is_dummy_burst(int8_t *burst, size_t burst_len) { if (burst_len != DUMMY_BURST_LEN) { return false; } for (int i=0; i * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GSM_BURSTS_PRINTER_IMPL_H #define INCLUDED_GSM_BURSTS_PRINTER_IMPL_H #define DUMMY_BURST_LEN 148 #include #include namespace gr { namespace gsm { class bursts_printer_impl : public bursts_printer { private: void bursts_print(pmt::pmt_t burst); pmt::pmt_t d_prepend_string; bool d_prepend_fnr; bool d_prepend_frame_count; bool d_print_payload_only; bool d_ignore_dummy_bursts; bool is_dummy_burst(int8_t *burst, size_t burst_len); static const int8_t d_dummy_burst[]; public: bursts_printer_impl(pmt::pmt_t prepend_string, bool prepend_fnr=false, bool prepend_frame_count=false, bool print_payload_only=false, bool ignore_dummy_bursts=false); ~bursts_printer_impl(); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_BURSTS_PRINTER_IMPL_H */ gr-gsm-0.41.2/lib/misc_utils/collect_system_info_impl.cc000066400000000000000000000151601316153413000233070ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2017 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "collect_system_info_impl.h" namespace gr { namespace gsm { void collect_system_info_impl::process_messages(pmt::pmt_t msg){ pmt::pmt_t message_plus_header_blob = pmt::cdr(msg); uint8_t * message_plus_header = (uint8_t *)pmt::blob_data(message_plus_header_blob); gsmtap_hdr * header = (gsmtap_hdr *)message_plus_header; uint8_t * msg_elements = (uint8_t *)(message_plus_header+sizeof(gsmtap_hdr)); uint8_t chan_type = header->sub_type; if (chan_type == GSMTAP_CHANNEL_BCCH && msg_elements[1] == 0x06) { int frame_nr = be32toh(header->frame_number); if (msg_elements[2] == 0x19) { d_framenumbers.push_back(frame_nr); d_sit_types.push_back("System Information Type 1"); d_sit_data.push_back(get_hex_string(msg_elements)); } else if (msg_elements[2] == 0x1a) { d_framenumbers.push_back(frame_nr); d_sit_types.push_back("System Information Type 2"); d_sit_data.push_back(get_hex_string(msg_elements)); } else if (msg_elements[2] == 0x1b) { d_framenumbers.push_back(frame_nr); d_sit_types.push_back("System Information Type 3"); d_sit_data.push_back(get_hex_string(msg_elements)); } else if (msg_elements[2] == 0x1c) { d_framenumbers.push_back(frame_nr); d_sit_types.push_back("System Information Type 4"); d_sit_data.push_back(get_hex_string(msg_elements)); } else if (msg_elements[2] == 0x02) { d_framenumbers.push_back(frame_nr); d_sit_types.push_back("System Information Type 2bis"); d_sit_data.push_back(get_hex_string(msg_elements)); } else if (msg_elements[2] == 0x03) { d_framenumbers.push_back(frame_nr); d_sit_types.push_back("System Information Type 2ter"); d_sit_data.push_back(get_hex_string(msg_elements)); } else if (msg_elements[2] == 0x07) { d_framenumbers.push_back(frame_nr); d_sit_types.push_back("System Information Type 2quater"); d_sit_data.push_back(get_hex_string(msg_elements)); } else if (msg_elements[2] == 0x00) { d_framenumbers.push_back(frame_nr); d_sit_types.push_back("System Information Type 13"); d_sit_data.push_back(get_hex_string(msg_elements)); } } else if ((chan_type == (GSMTAP_CHANNEL_ACCH|GSMTAP_CHANNEL_SDCCH) || chan_type == (GSMTAP_CHANNEL_ACCH|GSMTAP_CHANNEL_SDCCH4) || chan_type == (GSMTAP_CHANNEL_ACCH|GSMTAP_CHANNEL_SDCCH8) || chan_type == (GSMTAP_CHANNEL_ACCH|GSMTAP_CHANNEL_TCH_F) || chan_type == (GSMTAP_CHANNEL_ACCH|GSMTAP_CHANNEL_TCH_H)) && msg_elements[5] == 0x06) { int frame_nr = be32toh(header->frame_number); if (msg_elements[6] == 0x1D) { d_framenumbers.push_back(frame_nr); d_sit_types.push_back("System Information Type 5"); d_sit_data.push_back(get_hex_string(msg_elements)); } else if (msg_elements[6] == 0x1E) { d_framenumbers.push_back(frame_nr); d_sit_types.push_back("System Information Type 6"); d_sit_data.push_back(get_hex_string(msg_elements)); } else if (msg_elements[6] == 0x05) { d_framenumbers.push_back(frame_nr); d_sit_types.push_back("System Information Type 5bis"); d_sit_data.push_back(get_hex_string(msg_elements)); } else if (msg_elements[6] == 0x06) { d_framenumbers.push_back(frame_nr); d_sit_types.push_back("System Information Type 5ter"); d_sit_data.push_back(get_hex_string(msg_elements)); } } } std::vector collect_system_info_impl::get_framenumbers() { return d_framenumbers; } std::vector collect_system_info_impl::get_system_information_type() { return d_sit_types; } std::vector collect_system_info_impl::get_data() { return d_sit_data; } std::string collect_system_info_impl::get_hex_string(uint8_t * msg_elements) { std::stringstream sstream; for (int i=0; i<23; i++) { sstream << std::setfill ('0') << std::setw(2) << std::hex << static_cast(msg_elements[i]); } return sstream.str(); } collect_system_info::sptr collect_system_info::make() { return gnuradio::get_initial_sptr (new collect_system_info_impl()); } /* * The private constructor */ collect_system_info_impl::collect_system_info_impl() : gr::block("collect_system_info", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)) { message_port_register_in(pmt::mp("msgs")); set_msg_handler(pmt::mp("msgs"), boost::bind(&collect_system_info_impl::process_messages, this, _1)); } /* * Our virtual destructor. */ collect_system_info_impl::~collect_system_info_impl() { } } /* namespace gsm */ } /* namespace gr */ gr-gsm-0.41.2/lib/misc_utils/collect_system_info_impl.h000066400000000000000000000032221316153413000231450ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2017 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GSM_COLLECT_SYSTEM_INFO_IMPL_H #define INCLUDED_GSM_COLLECT_SYSTEM_INFO_IMPL_H #include #include namespace gr { namespace gsm { class collect_system_info_impl : public collect_system_info { private: void process_messages(pmt::pmt_t msg); std::vector d_framenumbers; std::vector d_sit_types; std::vector d_sit_data; std::string get_hex_string(uint8_t * msg_elements); public: virtual std::vector get_framenumbers(); virtual std::vector get_system_information_type(); virtual std::vector get_data(); collect_system_info_impl(); ~collect_system_info_impl(); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_COLLECT_SYSTEM_INFO_IMPL_H */ gr-gsm-0.41.2/lib/misc_utils/controlled_fractional_resampler_cc_impl.cc000066400000000000000000000150161316153413000263310ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2016 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "controlled_fractional_resampler_cc_impl.h" #include namespace gr { namespace gsm { controlled_fractional_resampler_cc::sptr controlled_fractional_resampler_cc::make(float phase_shift, float resamp_ratio) { return gnuradio::get_initial_sptr (new controlled_fractional_resampler_cc_impl(phase_shift, resamp_ratio)); } controlled_fractional_resampler_cc_impl::controlled_fractional_resampler_cc_impl (float phase_shift, float resamp_ratio) : block("controlled_fractional_resampler_cc", io_signature::make(1, 1, sizeof(gr_complex)), io_signature::make(1, 1, sizeof(gr_complex))), d_mu(phase_shift), d_mu_inc(resamp_ratio), d_resamp(new mmse_fir_interpolator_cc()) { this->set_tag_propagation_policy(TPP_DONT); if(resamp_ratio <= 0) throw std::out_of_range("resampling ratio must be > 0"); if(phase_shift < 0 || phase_shift > 1) throw std::out_of_range("phase shift ratio must be > 0 and < 1"); set_relative_rate(1.0 / resamp_ratio); } controlled_fractional_resampler_cc_impl::~controlled_fractional_resampler_cc_impl() { delete d_resamp; } void controlled_fractional_resampler_cc_impl::forecast(int noutput_items, gr_vector_int &ninput_items_required) { unsigned ninputs = ninput_items_required.size(); for(unsigned i=0; i < ninputs; i++) { ninput_items_required[i] = (int)ceil((noutput_items * d_mu_inc) + d_resamp->ntaps()); } } int controlled_fractional_resampler_cc_impl::general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { const gr_complex *in = (const gr_complex*)input_items[0]; gr_complex *out = (gr_complex*)output_items[0]; uint64_t processed_in = 0; //input samples processed in the last call to resample function uint64_t processed_in_sum = 0; //input samples processed during a whole call to general_work function uint64_t produced_out_sum = 0; //output samples produced during a whole call to general_work function std::vector set_resamp_ratio_tags; pmt::pmt_t key = pmt::string_to_symbol("set_resamp_ratio"); get_tags_in_window(set_resamp_ratio_tags, 0, 0, ninput_items[0]); bool all_output_samples_produced = false; for(std::vector::iterator i_tag = set_resamp_ratio_tags.begin(); i_tag < set_resamp_ratio_tags.end(); i_tag++) { uint64_t tag_offset_rel = i_tag->offset - nitems_read(0); if(pmt::symbol_to_string(i_tag->key) == "set_resamp_ratio") { uint64_t samples_to_produce = static_cast(round(static_cast(tag_offset_rel-processed_in_sum)/d_mu_inc)); //tu może być problem - bo to jest gÅ‚upota przy d_mu_inc różnym od 1.0 if( (samples_to_produce + produced_out_sum) > noutput_items) { samples_to_produce = noutput_items - produced_out_sum; all_output_samples_produced = true; } processed_in = resample(in, processed_in_sum, out, produced_out_sum, samples_to_produce); processed_in_sum = processed_in_sum + processed_in; produced_out_sum = produced_out_sum + samples_to_produce; if(all_output_samples_produced) { break; } else { add_item_tag(0, produced_out_sum + nitems_written(0), i_tag->key, i_tag->value); set_resamp_ratio(pmt::to_double(i_tag->value)); } } else { uint64_t out_samples_to_tag = round(static_cast(tag_offset_rel-processed_in_sum)/d_mu_inc); if( (out_samples_to_tag + produced_out_sum) <= noutput_items) { add_item_tag(0, produced_out_sum + out_samples_to_tag + nitems_written(0), i_tag->key, i_tag->value); } } } if(!all_output_samples_produced) { processed_in = resample(in, processed_in_sum, out, produced_out_sum, (noutput_items-produced_out_sum)); processed_in_sum = processed_in_sum + processed_in; } consume_each(processed_in_sum); return noutput_items; } inline uint64_t controlled_fractional_resampler_cc_impl::resample(const gr_complex *in, uint64_t first_in_sample, gr_complex *out, uint64_t first_out_sample, uint64_t samples_to_produce) { int ii = first_in_sample; int oo = first_out_sample; while(oo < (first_out_sample+samples_to_produce)) //produce samples_to_produce number of samples { out[oo++] = d_resamp->interpolate(&in[ii], d_mu); double s = d_mu + d_mu_inc; double f = floor(s); int incr = (int)f; d_mu = s - f; ii += incr; } return ii-first_in_sample; //number of input samples processed } float controlled_fractional_resampler_cc_impl::mu() const { return d_mu; } float controlled_fractional_resampler_cc_impl::resamp_ratio() const { return d_mu_inc; } void controlled_fractional_resampler_cc_impl::set_mu(float mu) { d_mu = mu; } void controlled_fractional_resampler_cc_impl::set_resamp_ratio(float resamp_ratio) { d_mu_inc = resamp_ratio; set_relative_rate(1.0 / resamp_ratio); } } /* namespace grgsm */ } /* namespace gr */ gr-gsm-0.41.2/lib/misc_utils/controlled_fractional_resampler_cc_impl.h000066400000000000000000000043601316153413000261730ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2016 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GRGSM_CONTROLLED_FRACTIONAL_RESAMPLER_CC_IMPL_H #define INCLUDED_GRGSM_CONTROLLED_FRACTIONAL_RESAMPLER_CC_IMPL_H #include #include using namespace gr::filter; namespace gr { namespace gsm { class controlled_fractional_resampler_cc_impl : public controlled_fractional_resampler_cc { private: float d_mu; float d_mu_inc; mmse_fir_interpolator_cc *d_resamp; inline uint64_t resample(const gr_complex *in, uint64_t first_in_sample, gr_complex *out, uint64_t first_out_sample, uint64_t samples_to_produce); public: controlled_fractional_resampler_cc_impl(float phase_shift, float resamp_ratio); ~controlled_fractional_resampler_cc_impl(); void forecast(int noutput_items, gr_vector_int &ninput_items_required); int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); float mu() const; float resamp_ratio() const; void set_mu(float mu); void set_resamp_ratio(float resamp_ratio); }; } // namespace grgsm } // namespace gr #endif /* INCLUDED_GRGSM_CONTROLLED_FRACTIONAL_RESAMPLER_CC_IMPL_H */ gr-gsm-0.41.2/lib/misc_utils/controlled_rotator_cc_impl.cc000066400000000000000000000111541316153413000236260ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2014 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "controlled_rotator_cc_impl.h" #include namespace gr { namespace gsm { controlled_rotator_cc::sptr controlled_rotator_cc::make(double phase_inc) { return gnuradio::get_initial_sptr (new controlled_rotator_cc_impl(phase_inc)); } /* * The private constructor */ controlled_rotator_cc_impl::controlled_rotator_cc_impl(double phase_inc) : gr::sync_block("controlled_rotator_cc", gr::io_signature::make2(1, 2, sizeof(gr_complex), sizeof(float)), gr::io_signature::make(1, 1, sizeof(gr_complex))) { set_phase_inc(phase_inc); } /* * Our virtual destructor. */ controlled_rotator_cc_impl::~controlled_rotator_cc_impl() { } void controlled_rotator_cc_impl::set_phase_inc(double phase_inc) { d_phase_inc = phase_inc; d_r.set_phase_incr( exp(gr_complex(0, (double)phase_inc)) ); } // void // controlled_rotator_cc_impl::set_samp_rate(double samp_rate) // { // d_samp_rate = samp_rate; // } int controlled_rotator_cc_impl::work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { //process phase_inc input /*if(input_items.size() == 2) { int ii=0; const float *pp = (const float *)input_items[1]; while(ii < noutput_items){ //look for different values on phase increment control input if(d_phase_inc != (*pp)){ set_phase_inc(*(pp)); //set new value of phase increment float freq_offset_setting = (*(pp) / (2*M_PI)) * d_samp_rate; //send stream tag with a new value of the frequency offset uint64_t offset = nitems_written(0); pmt::pmt_t key = pmt::string_to_symbol("setting_freq_offset"); pmt::pmt_t value = pmt::from_double(freq_offset_setting); add_item_tag(0,offset, key, value); break; } pp++; ii++; } } */ //get complex input and output const gr_complex *in = (const gr_complex *)input_items[0]; gr_complex *out = (gr_complex *)output_items[0]; //get tags uint64_t processed_in = 0; uint64_t produced_out = 0; std::vector set_phase_inc_tags; pmt::pmt_t key = pmt::string_to_symbol("set_phase_inc"); get_tags_in_window(set_phase_inc_tags, 0, 0, noutput_items, key); for(std::vector::iterator i_tag = set_phase_inc_tags.begin(); i_tag < set_phase_inc_tags.end(); i_tag++){ uint64_t tag_offset_rel = i_tag->offset-nitems_read(0); set_phase_inc(pmt::to_double(i_tag->value)); uint64_t samples_to_process = tag_offset_rel-processed_in; d_r.rotateN((out+produced_out), const_cast(in+processed_in), samples_to_process); processed_in = processed_in + samples_to_process; produced_out = produced_out + samples_to_process; // std::cout << "Rotator, phase inc: " << pmt::to_double(i_tag->value) << std::endl; // // float freq_offset_setting = (pmt::to_double(i_tag->value) / (2*M_PI)) * d_samp_rate; //send stream tag with a new value of the frequency offset // pmt::pmt_t key = pmt::string_to_symbol("setting_freq_offset"); // pmt::pmt_t value = pmt::from_double(freq_offset_setting); // add_item_tag(0,i_tag->offset, key, value); } d_r.rotateN((out+produced_out), const_cast(in+processed_in), (noutput_items-produced_out)); //const_cast is workaround old implementation of rotateN that is still present in ubuntu 14.04 packages return noutput_items; } } /* namespace gsm */ } /* namespace gr */ gr-gsm-0.41.2/lib/misc_utils/controlled_rotator_cc_impl.h000066400000000000000000000032421316153413000234670ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2014 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GSM_CONTROLLED_ROTATOR_CC_IMPL_H #define INCLUDED_GSM_CONTROLLED_ROTATOR_CC_IMPL_H #include #include namespace gr { namespace gsm { class controlled_rotator_cc_impl : public controlled_rotator_cc { private: gr_complex d_phase_inc; // double d_samp_rate; blocks::rotator d_r; public: controlled_rotator_cc_impl(double phase_inc); ~controlled_rotator_cc_impl(); virtual void set_phase_inc(double phase_inc); // virtual void set_samp_rate(double samp_rate); // Where all the action really happens int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_CONTROLLED_ROTATOR_CC_IMPL_H */ gr-gsm-0.41.2/lib/misc_utils/extract_cmc_impl.cc000066400000000000000000000054551316153413000215450ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2016 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "extract_cmc_impl.h" namespace gr { namespace gsm { void extract_cmc_impl::process_messages(pmt::pmt_t msg) { pmt::pmt_t message_plus_header_blob = pmt::cdr(msg); uint8_t * message_plus_header = (uint8_t *)pmt::blob_data(message_plus_header_blob); gsmtap_hdr * header = (gsmtap_hdr *)message_plus_header; uint8_t * msg_elements = (uint8_t *)(message_plus_header+sizeof(gsmtap_hdr)); if((msg_elements[3] & 0xF) == 0x6 && msg_elements[4] == 0x35) { int frame_nr = be32toh(header->frame_number); int a5_version = ((msg_elements[5] & 0xE) >> 1) + 1; //10.5.2.9 Cipher Mode Setting int start_ciphering = ((msg_elements[5] & 0x1)); d_start_ciphering.push_back(start_ciphering); d_framenumbers.push_back(frame_nr); d_a5_versions.push_back(a5_version); } } std::vector extract_cmc_impl::get_framenumbers() { return d_framenumbers; } std::vector extract_cmc_impl::get_a5_versions() { return d_a5_versions; } std::vector extract_cmc_impl::get_start_ciphering() { return d_start_ciphering; } extract_cmc::sptr extract_cmc::make() { return gnuradio::get_initial_sptr (new extract_cmc_impl()); } /* * The private constructor */ extract_cmc_impl::extract_cmc_impl() : gr::block("extract_cmc", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)) { message_port_register_in(pmt::mp("msgs")); set_msg_handler(pmt::mp("msgs"), boost::bind(&extract_cmc_impl::process_messages, this, _1)); } /* * Our virtual destructor. */ extract_cmc_impl::~extract_cmc_impl() { } } /* namespace gsm */ } /* namespace gr */ gr-gsm-0.41.2/lib/misc_utils/extract_cmc_impl.h000066400000000000000000000030111316153413000213710ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2016 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GSM_EXTRACT_CMC_IMPL_H #define INCLUDED_GSM_EXTRACT_CMC_IMPL_H #include #include namespace gr { namespace gsm { class extract_cmc_impl : public extract_cmc { private: void process_messages(pmt::pmt_t msg); std::vector d_framenumbers; std::vector d_a5_versions; std::vector d_start_ciphering; public: virtual std::vector get_framenumbers(); virtual std::vector get_a5_versions(); virtual std::vector get_start_ciphering(); extract_cmc_impl(); ~extract_cmc_impl(); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_EXTRACT_CMC_IMPL_H */ gr-gsm-0.41.2/lib/misc_utils/extract_immediate_assignment_impl.cc000066400000000000000000000274401316153413000251670ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include "extract_immediate_assignment_impl.h" namespace gr { namespace gsm { boost::mutex extract_immediate_assignment_mutex; void extract_immediate_assignment_impl::process_message(pmt::pmt_t msg){ pmt::pmt_t message_plus_header_blob = pmt::cdr(msg); uint8_t * message_plus_header = (uint8_t *)pmt::blob_data(message_plus_header_blob); gsmtap_hdr * header = (gsmtap_hdr *)message_plus_header; uint8_t * msg_elements = (uint8_t *)(message_plus_header+sizeof(gsmtap_hdr)); uint32_t frame_nr = be32toh(header->frame_number); if(msg_elements[2]==0x3f) { immediate_assignment current; current.frame_nr = frame_nr; /* channel description, see table 10.23 in GSM 04.08 msg_elements[4], octet 2 in specs 5 bits channel type ignored in TBF 00001 TCH/F 0001T TCH/H, subchannel/TDMA offset T 001TT SDCCH/4, subchannel/TDMA offset TT 01TTT SDCCH/8, subchannel/TDMA offset TTT 3 bits timeslot number TN */ current.timeslot = (msg_elements[4] & 7); uint8_t channeltype = (msg_elements[4] >> 3); uint8_t mode = msg_elements[3] & (1 << 4); if (mode == 0) { if (channeltype >= 8) { current.channel_type = "SDCCH/8"; current.subchannel = (channeltype & 7); } else if (channeltype >= 4 && channeltype <= 7) { current.channel_type = "SDCCH/4"; current.subchannel = (channeltype & 3); } else if (channeltype >= 2 && channeltype <= 3) { current.channel_type = "TCH/H"; current.subchannel = (channeltype & 1); } else { current.channel_type = "TCH/F"; } } else { // We return if ignore_gprs is set true if (d_ignore_gprs) { return; } current.channel_type = "GPRS - Temporary Block Flow TBF"; } /* msg_elements[5], msg_elements[6] are octets 3 and 4 in specs 3 bits training sequence (we dont process this for the moment) 1 bit hopping channel H if H = 0: 2 bit spare 2 bit high part of single channel arfcn 8 bit low part of single channel arfcn if H = 1: 4 bit high part of MAIO 2 bit low part of MAIO 6bit HSN */ current.hopping = (msg_elements[5] >> 4) & 1; if (current.hopping) { uint8_t maio = (msg_elements[5] & 0xf) << 2; maio |= (msg_elements[6] >> 6); current.maio = maio; current.hsn = (msg_elements[6] & 0x3f); } else { uint16_t arfcn = (msg_elements[5] & 3) << 8; arfcn |= msg_elements[6]; current.arfcn = arfcn; } /* msg_elements[7 - 9], octets 5 - 7 in specs, see 10.5.2.30 request reference, maybe later */ uint8_t random_access_info = msg_elements[7]; uint8_t rr_t1 = (msg_elements[8] >> 3); uint8_t rr_t2 = (msg_elements[9] & 0x1F); uint8_t rr_t3 = (msg_elements[8] & 0x7) << 3; rr_t3 |= (msg_elements[9] >> 5); uint32_t request_fnr = 51*((rr_t3-rr_t2) % 26) + rr_t3 + (51*26*rr_t1); // we will use random_access_info and request_fnr together as request_reference in the map, // if unique_references is set true uint32_t request_ref = (random_access_info << 0x16); request_ref |= request_fnr; /* msg_elements[10]: timing advance */ current.timing_advance = msg_elements[10]; /* msg_elements[11 - 20]: mobile allocation, flexible length, see 10.5.2.21 */ uint8_t mobile_allocation_len = msg_elements[11]; if (mobile_allocation_len > 0) { std::string ma; for (int i=0; i> (7-j)) & 0x1)); } } current.mobile_allocation = ma; } bool is_duplicate = false; if (d_unique_references) { if (d_assignment_map.find(request_ref) != d_assignment_map.end()) { is_duplicate = true; } else { d_assignment_map[request_ref] = current; } } else { d_assignment_map[current.frame_nr] = current; } if (d_print_immediate_assignments && !is_duplicate) { std::cout << "\n------------------------------------------------\n" << std::endl; std::cout << "FrameNr: " << (unsigned)current.frame_nr << std::endl; std::cout << "Channel type: " << current.channel_type << std::endl; std::cout << "Timeslot: " << (unsigned)current.timeslot << std::endl; // Dont print subchannel if mode == 1 or if the assigned channel is TCH/F if (mode == 0 && channeltype >= 2) { std::cout << "Subchannel: " << (unsigned)current.subchannel << std::endl; } std::cout << "Hopping: " << (unsigned)current.hopping << std::endl; if (current.hopping) { std::cout << "MAIO: " << (unsigned)current.maio << std::endl; std::cout << "HSN: " << (unsigned)current.hsn << std::endl; std::cout << "Mobile Allocation: " << current.mobile_allocation << std::endl; } else { std::cout << "ARFCN: " << (unsigned)current.arfcn << std::endl; } std::cout << "Timing Advance: " << (unsigned)current.timing_advance << std::endl; } } } std::vector extract_immediate_assignment_impl::get_frame_numbers() { std::vector fnrs; BOOST_FOREACH(immediate_assignment_map::value_type &i, d_assignment_map) { fnrs.push_back(i.second.frame_nr); } return fnrs; } std::vector extract_immediate_assignment_impl::get_channel_types() { std::vector types; BOOST_FOREACH(immediate_assignment_map::value_type &i, d_assignment_map) { types.push_back(i.second.channel_type); } return types; } std::vector extract_immediate_assignment_impl::get_timeslots() { std::vector timeslots; BOOST_FOREACH(immediate_assignment_map::value_type &i, d_assignment_map) { timeslots.push_back(i.second.timeslot); } return timeslots; } std::vector extract_immediate_assignment_impl::get_subchannels() { std::vector subchannels; BOOST_FOREACH(immediate_assignment_map::value_type &i, d_assignment_map) { subchannels.push_back(i.second.subchannel); } return subchannels; } std::vector extract_immediate_assignment_impl::get_hopping() { std::vector hopping; BOOST_FOREACH(immediate_assignment_map::value_type &i, d_assignment_map) { hopping.push_back(i.second.hopping); } return hopping; } std::vector extract_immediate_assignment_impl::get_maios() { std::vector maios; BOOST_FOREACH(immediate_assignment_map::value_type &i, d_assignment_map) { maios.push_back(i.second.maio); } return maios; } std::vector extract_immediate_assignment_impl::get_hsns() { std::vector hsns; BOOST_FOREACH(immediate_assignment_map::value_type &i, d_assignment_map) { hsns.push_back(i.second.hsn); } return hsns; } std::vector extract_immediate_assignment_impl::get_arfcns() { std::vector arfcns; BOOST_FOREACH(immediate_assignment_map::value_type &i, d_assignment_map) { arfcns.push_back(i.second.arfcn); } return arfcns; } std::vector extract_immediate_assignment_impl::get_timing_advances() { std::vector tas; BOOST_FOREACH(immediate_assignment_map::value_type &i, d_assignment_map) { tas.push_back(i.second.timing_advance); } return tas; } std::vector extract_immediate_assignment_impl::get_mobile_allocations() { std::vector mobile_allocations; BOOST_FOREACH(immediate_assignment_map::value_type &i, d_assignment_map) { mobile_allocations.push_back(i.second.mobile_allocation); } return mobile_allocations; } extract_immediate_assignment::sptr extract_immediate_assignment::make(bool print_immediate_assignments, bool ignore_gprs, bool unique_references) { return gnuradio::get_initial_sptr (new extract_immediate_assignment_impl(print_immediate_assignments, ignore_gprs, unique_references)); } /* * The private constructor */ extract_immediate_assignment_impl::extract_immediate_assignment_impl(bool print_immediate_assignments, bool ignore_gprs, bool unique_references) : gr::block("extract_immediate_assignment", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)) { d_print_immediate_assignments = print_immediate_assignments; d_ignore_gprs = ignore_gprs; d_unique_references = unique_references; message_port_register_in(pmt::mp("msgs")); set_msg_handler(pmt::mp("msgs"), boost::bind(&extract_immediate_assignment_impl::process_message, this, _1)); } /* * Our virtual destructor. */ extract_immediate_assignment_impl::~extract_immediate_assignment_impl() { } } /* namespace gsm */ } /* namespace gr */ gr-gsm-0.41.2/lib/misc_utils/extract_immediate_assignment_impl.h000066400000000000000000000056601316153413000250310ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GSM_EXTRACT_IMMEDIATE_ASSIGNMENT_IMPL_H #define INCLUDED_GSM_EXTRACT_IMMEDIATE_ASSIGNMENT_IMPL_H #include #include #include namespace gr { namespace gsm { class immediate_assignment { public: uint32_t frame_nr; std::string channel_type; uint8_t timeslot; uint8_t subchannel; uint8_t hopping; uint8_t maio; uint8_t hsn; uint16_t arfcn; uint8_t timing_advance; std::string mobile_allocation; immediate_assignment() : frame_nr(0), channel_type("unknown"), timeslot(0), subchannel(0), hopping(false), maio(0), hsn(0), arfcn(0), timing_advance(0), mobile_allocation("") {}; ~immediate_assignment() {}; }; typedef std::map immediate_assignment_map; class extract_immediate_assignment_impl : public extract_immediate_assignment { private: void process_message(pmt::pmt_t msg); immediate_assignment_map d_assignment_map; bool d_print_immediate_assignments; bool d_ignore_gprs; bool d_unique_references; public: virtual std::vector get_frame_numbers(); virtual std::vector get_channel_types(); virtual std::vector get_timeslots(); virtual std::vector get_subchannels(); virtual std::vector get_hopping(); virtual std::vector get_maios(); virtual std::vector get_hsns(); virtual std::vector get_arfcns(); virtual std::vector get_timing_advances(); virtual std::vector get_mobile_allocations(); extract_immediate_assignment_impl(bool print_immediate_assignments=false, bool ignore_gprs=false, bool unique_references=false); ~extract_immediate_assignment_impl(); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_EXTRACT_IMMEDIATE_ASSIGNMENT_IMPL_H */ gr-gsm-0.41.2/lib/misc_utils/extract_system_info_impl.cc000066400000000000000000000266351316153413000233450ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2014 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include extern "C" { #include } #include "extract_system_info_impl.h" namespace gr { namespace gsm { boost::mutex extract_mutex; void extract_system_info_impl::process_bursts(pmt::pmt_t msg) { pmt::pmt_t burst_plus_header_blob = pmt::cdr(msg); gsmtap_hdr * header = (gsmtap_hdr *)pmt::blob_data(burst_plus_header_blob); chan_info info; info.id = be16toh(header->arfcn); info.pwr_db = header->signal_dbm; boost::mutex::scoped_lock lock(extract_mutex); if(d_c0_channels.find(info.id) != d_c0_channels.end()){ d_c0_channels[info.id].copy_nonzero_elements(info); } else { d_c0_channels[info.id] = info; } } void extract_system_info_impl::process_sysinfo(pmt::pmt_t msg){ pmt::pmt_t message_plus_header_blob = pmt::cdr(msg); uint8_t * message_plus_header = (uint8_t *)pmt::blob_data(message_plus_header_blob); gsmtap_hdr * header = (gsmtap_hdr *)message_plus_header; uint8_t * msg_elements = (uint8_t *)(message_plus_header+sizeof(gsmtap_hdr)); struct gsm_sysinfo_freq freq[1024]; if(msg_elements[2]==0x1b){ chan_info info; info.id = be16toh(header->arfcn); //take arfcn info.pwr_db = header->signal_dbm; info.cell_id = (msg_elements[3]<<8)+msg_elements[4]; //take cell id info.lac = (msg_elements[8]<<8)+msg_elements[9]; //take lac info.mcc = ((msg_elements[5] & 0xF) * 100) + (((msg_elements[5] & 0xF0) >> 4) * 10) + ((msg_elements[6] & 0xF)); // take mcc info.mnc = (msg_elements[7] & 0xF) * 10 + (msg_elements[7]>>4); //take mnc if (((msg_elements[6] & 0xF0) >> 4) < 10) // we have a 3 digit mnc, see figure 10.5.3 of 3GPP TS 24.008 { info.mnc *= 10; info.mnc += (msg_elements[6] & 0xF0) >> 4; } info.ccch_conf = (msg_elements[10] & 0x7); // ccch_conf boost::mutex::scoped_lock lock(extract_mutex); if(d_c0_channels.find(info.id) != d_c0_channels.end()){ d_c0_channels[info.id].copy_nonzero_elements(info); } else { d_c0_channels[info.id] = info; } } else if(msg_elements[2]==0x1c){ chan_info info; info.id = be16toh(header->arfcn); //take arfcn info.pwr_db = header->signal_dbm; info.lac = (msg_elements[6]<<8)+msg_elements[7]; //take lac info.mcc = ((msg_elements[3] & 0xF) * 100) + (((msg_elements[3] & 0xF0) >> 4) * 10) + ((msg_elements[4] & 0xF)); // take mcc info.mnc = (msg_elements[5] & 0xF) * 10 + (msg_elements[5]>>4); //take mnc if (((msg_elements[4] & 0xF0) >> 4) < 10) // we have a 3 digit mnc, see figure 10.5.3 of 3GPP TS 24.008 { info.mnc *= 10; info.mnc += (msg_elements[4] & 0xF0) >> 4; } boost::mutex::scoped_lock lock(extract_mutex); if(d_c0_channels.find(info.id) != d_c0_channels.end()){ d_c0_channels[info.id].copy_nonzero_elements(info); } else { d_c0_channels[info.id] = info; } } else if(msg_elements[2]==0x1a){ //System Information Type 2 memset(freq, 0, sizeof(freq)); chan_info info; info.id = be16toh(header->arfcn); //take arfcn info.pwr_db = header->signal_dbm; boost::mutex::scoped_lock lock(extract_mutex); //read neighbour cells gsm48_decode_freq_list(freq, &msg_elements[3], 16, 0xce, 0x01); if(d_c0_channels.find(info.id) != d_c0_channels.end()){ d_c0_channels[info.id].copy_nonzero_elements(info); } else { d_c0_channels[info.id] = info; } for(int arfcn=0; arfcnarfcn); //take arfcn info.pwr_db = header->signal_dbm; boost::mutex::scoped_lock lock(extract_mutex); //read neighbour cells gsm48_decode_freq_list(freq, &msg_elements[3], 16, 0xce, 0x01); if(d_c0_channels.find(info.id) != d_c0_channels.end()){ d_c0_channels[info.id].copy_nonzero_elements(info); } else { d_c0_channels[info.id] = info; } for(int arfcn=0; arfcnarfcn); //take arfcn info.pwr_db = header->signal_dbm; boost::mutex::scoped_lock lock(extract_mutex); //read neighbour cells gsm48_decode_freq_list(freq, &msg_elements[3], 16, 0x8e, 0x01); if(d_c0_channels.find(info.id) != d_c0_channels.end()){ d_c0_channels[info.id].copy_nonzero_elements(info); } else { d_c0_channels[info.id] = info; } for(int arfcn=0; arfcnarfcn); //take arfcn info.pwr_db = header->signal_dbm; boost::mutex::scoped_lock lock(extract_mutex); //read cell arfcn's gsm48_decode_freq_list(freq, &msg_elements[3], 16, 0x8e, 0x01); if(d_c0_channels.find(info.id) != d_c0_channels.end()){ d_c0_channels[info.id].copy_nonzero_elements(info); } else { d_c0_channels[info.id] = info; } for(int arfcn=0; arfcn extract_system_info_impl::get_chans() { std::vector chans_ids; BOOST_FOREACH(chan_info_map::value_type &i, d_c0_channels){ chans_ids.push_back(i.second.id); } return chans_ids; } std::vector extract_system_info_impl::get_lac() { std::vector lacs; BOOST_FOREACH(chan_info_map::value_type &i, d_c0_channels){ lacs.push_back(i.second.lac); } return lacs; } std::vector extract_system_info_impl::get_mcc() { std::vector mccs; BOOST_FOREACH(chan_info_map::value_type &i, d_c0_channels){ mccs.push_back(i.second.mcc); } return mccs; } std::vector extract_system_info_impl::get_mnc() { std::vector mncs; BOOST_FOREACH(chan_info_map::value_type &i, d_c0_channels){ mncs.push_back(i.second.mnc); } return mncs; } std::vector extract_system_info_impl::get_cell_id() { std::vector cell_ids; BOOST_FOREACH(chan_info_map::value_type &i, d_c0_channels){ cell_ids.push_back(i.second.cell_id); } return cell_ids; } std::vector extract_system_info_impl::get_pwrs() { std::vector pwrs; BOOST_FOREACH(chan_info_map::value_type &i, d_c0_channels){ pwrs.push_back(i.second.pwr_db); } return pwrs; } std::vector extract_system_info_impl::get_ccch_conf() { std::vector ccch_confs; BOOST_FOREACH(chan_info_map::value_type &i, d_c0_channels){ ccch_confs.push_back(i.second.ccch_conf); } return ccch_confs; } std::vector extract_system_info_impl::get_neighbours(int chan_id) { std::vector neighbour_cells; BOOST_FOREACH(int n, d_c0_channels[chan_id].neighbour_cells){ neighbour_cells.push_back(n); } return neighbour_cells; } std::vector extract_system_info_impl::get_cell_arfcns(int chan_id) { std::vector cell_arfcns; BOOST_FOREACH(int n, d_c0_channels[chan_id].cell_arfcns){ cell_arfcns.push_back(n); } return cell_arfcns; } void extract_system_info_impl::reset() { d_c0_channels.clear(); if(!empty_p(pmt::mp("bursts"))){ // delete_head_blocking(pmt::mp("bursts")); } if(!empty_p(pmt::mp("msgs"))){ // delete_head_blocking(pmt::mp("msgs")); } } extract_system_info::sptr extract_system_info::make() { return gnuradio::get_initial_sptr (new extract_system_info_impl()); } /* * The private constructor */ extract_system_info_impl::extract_system_info_impl() : gr::block("extract_system_info", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), after_reset(false) { message_port_register_in(pmt::mp("bursts")); set_msg_handler(pmt::mp("bursts"), boost::bind(&extract_system_info_impl::process_bursts, this, _1)); message_port_register_in(pmt::mp("msgs")); set_msg_handler(pmt::mp("msgs"), boost::bind(&extract_system_info_impl::process_sysinfo, this, _1)); } /* * Our virtual destructor. */ extract_system_info_impl::~extract_system_info_impl() { } } /* namespace gsm */ } /* namespace gr */ gr-gsm-0.41.2/lib/misc_utils/extract_system_info_impl.h000066400000000000000000000070151316153413000231760ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2014 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GSM_EXTRACT_SYSTEM_INFO_IMPL_H #define INCLUDED_GSM_EXTRACT_SYSTEM_INFO_IMPL_H #include #include #include #include namespace gr { namespace gsm { class chan_info { public: unsigned int id; int8_t pwr_db; unsigned int arfcn; unsigned int lac; unsigned int cell_id; unsigned int mcc; unsigned int mnc; unsigned int ccch_conf; std::set neighbour_cells; std::set cell_arfcns; chan_info() : id(-1), pwr_db(0), arfcn(0), lac(0), cell_id(0), mcc(0), mnc(0), ccch_conf(-1){} chan_info(const chan_info & info) : id(info.id), pwr_db(info.pwr_db), arfcn(info.arfcn), lac(info.lac), cell_id(info.cell_id), mcc(info.mcc), mnc(info.mnc), ccch_conf(info.ccch_conf){} ~chan_info(){} void copy_nonzero_elements(const chan_info & info){ id = info.id; pwr_db = info.pwr_db; arfcn = info.arfcn; lac = (info.lac!=0) ? info.lac : lac; cell_id = (info.cell_id!=0) ? info.cell_id : cell_id; mcc = (info.mcc!=0) ? info.mcc : mcc; mnc = (info.mnc!=0) ? info.mnc : mnc; ccch_conf = (info.ccch_conf!=-1) ? info.ccch_conf : ccch_conf; } }; struct compare_id { inline bool operator()(const chan_info &a, const chan_info &b) const { return a.id < b.id; } }; struct compare_pwr { inline bool operator()(const chan_info &a, const chan_info &b) const { return a.pwr_db < b.pwr_db; } }; typedef std::map chan_info_map; class extract_system_info_impl : public extract_system_info { private: void process_bursts(pmt::pmt_t burst); void process_sysinfo(pmt::pmt_t msg); chan_info_map d_c0_channels; bool after_reset; void decode_neighbour_cells(uint8_t * data, unsigned int offset, unsigned int chan_id); // void dissect_channel_list_n_range(guint32 offset, guint len, gint range) public: virtual std::vector get_chans(); virtual std::vector get_pwrs(); virtual std::vector get_lac(); virtual std::vector get_cell_id(); virtual std::vector get_mcc(); virtual std::vector get_mnc(); virtual std::vector get_ccch_conf(); virtual std::vector get_cell_arfcns(int chan_id); virtual std::vector get_neighbours(int chan_id); virtual void reset(); extract_system_info_impl(); ~extract_system_info_impl(); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_EXTRACT_SYSTEM_INFO_IMPL_H */ gr-gsm-0.41.2/lib/misc_utils/message_file_sink_impl.cc000066400000000000000000000041411316153413000227070ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "message_file_sink_impl.h" #include namespace gr { namespace gsm { message_file_sink::sptr message_file_sink::make(const std::string &filename) { return gnuradio::get_initial_sptr (new message_file_sink_impl(filename)); } /* * The private constructor */ message_file_sink_impl::message_file_sink_impl(const std::string &filename) : gr::block("message_file_sink", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), d_output_file(filename.c_str(), std::ofstream::binary) { message_port_register_in(pmt::mp("in")); set_msg_handler(pmt::mp("in"), boost::bind(&message_file_sink_impl::process_message, this, _1)); } /* * Our virtual destructor. */ message_file_sink_impl::~message_file_sink_impl() { if (d_output_file.is_open()) { d_output_file.close(); } } void message_file_sink_impl::process_message(pmt::pmt_t msg) { std::string s = pmt::serialize_str(msg); const char *serialized = s.data(); d_output_file.write(serialized, s.length()); } } /* namespace gsm */ } /* namespace gr */ gr-gsm-0.41.2/lib/misc_utils/message_file_sink_impl.h000066400000000000000000000025411316153413000225530ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_MESSAGE_FILE_SINK_IMPL_H #define INCLUDED_GSM_MESSAGE_FILE_SINK_IMPL_H #include #include namespace gr { namespace gsm { class message_file_sink_impl : public message_file_sink { private: std::ofstream d_output_file; public: message_file_sink_impl(const std::string &filename); ~message_file_sink_impl(); void process_message(pmt::pmt_t msg); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_MESSAGE_FILE_SINK_IMPL_H */ gr-gsm-0.41.2/lib/misc_utils/message_file_source_impl.cc000066400000000000000000000056231316153413000232510ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "message_file_source_impl.h" #include #define PMT_SIZE 49 namespace gr { namespace gsm { message_file_source::sptr message_file_source::make(const std::string &filename) { return gnuradio::get_initial_sptr (new message_file_source_impl(filename)); } /* * The private constructor */ message_file_source_impl::message_file_source_impl(const std::string &filename) : gr::block("message_file_source", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), d_input_file(filename.c_str(), std::ifstream::binary), d_finished(false) { message_port_register_out(pmt::mp("out")); } /* * Our virtual destructor. */ message_file_source_impl::~message_file_source_impl() { if (d_finished == false){ d_finished = true; } } bool message_file_source_impl::start() { d_finished = false; d_thread = boost::shared_ptr (new gr::thread::thread(boost::bind(&message_file_source_impl::run, this))); return block::start(); } bool message_file_source_impl::stop() { d_finished = true; d_thread->interrupt(); d_thread->join(); return block::stop(); } bool message_file_source_impl::finished() { return d_finished; } void message_file_source_impl::run() { char *unserialized = (char*)malloc(sizeof(char) * PMT_SIZE); while (d_input_file.read(unserialized, PMT_SIZE) && !d_finished) { if (d_input_file.bad()) { break; } std::string s(unserialized, PMT_SIZE); pmt::pmt_t burst = pmt::deserialize_str(s); message_port_pub(pmt::mp("out"), burst); } d_input_file.close(); post(pmt::mp("system"), pmt::cons(pmt::mp("done"), pmt::from_long(1))); } } /* namespace gsm */ } /* namespace gr */ gr-gsm-0.41.2/lib/misc_utils/message_file_source_impl.h000066400000000000000000000027601316153413000231120ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_MESSAGE_FILE_SOURCE_IMPL_H #define INCLUDED_GSM_MESSAGE_FILE_SOURCE_IMPL_H #include #include namespace gr { namespace gsm { class message_file_source_impl : public message_file_source { private: boost::shared_ptr d_thread; std::ifstream d_input_file; bool d_finished; void run(); public: message_file_source_impl(const std::string &filename); ~message_file_source_impl(); bool start(); bool stop(); bool finished(); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_MESSAGE_FILE_SOURCE_IMPL_H */ gr-gsm-0.41.2/lib/misc_utils/message_printer_impl.cc000066400000000000000000000066711316153413000224410ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2014 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "message_printer_impl.h" #include "grgsm/gsmtap.h" #include extern "C" { #include } namespace gr { namespace gsm { void message_printer_impl::message_print(pmt::pmt_t msg) { pmt::pmt_t message_plus_header_blob = pmt::cdr(msg); uint8_t * message_plus_header = (uint8_t *)pmt::blob_data(message_plus_header_blob); size_t message_plus_header_len=pmt::blob_length(message_plus_header_blob); gsmtap_hdr * header = (gsmtap_hdr *)message_plus_header; uint32_t frame_nr = be32toh(header->frame_number); std::cout << d_prepend_string; if (d_prepend_fnr) { std::cout << frame_nr; } if (d_prepend_fnr && d_prepend_frame_count) { std::cout << " "; } if (d_prepend_frame_count) { // calculate fn count using libosmogsm std::cout << osmo_a5_fn_count(frame_nr); } if (d_prepend_fnr || d_prepend_frame_count) { std::cout << ": "; } int start_index = sizeof(gsmtap_hdr); if (d_print_gsmtap_header) { start_index = 0; } for(int ii=start_index; ii * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GSM_MESSAGE_PRINTER_IMPL_H #define INCLUDED_GSM_MESSAGE_PRINTER_IMPL_H #include namespace gr { namespace gsm { class message_printer_impl : public message_printer { private: void message_print(pmt::pmt_t msg); pmt::pmt_t d_prepend_string; bool d_prepend_fnr; bool d_prepend_frame_count; bool d_print_gsmtap_header; public: message_printer_impl(pmt::pmt_t prepend_string, bool prepend_fnr=false, bool prepend_frame_count=false, bool print_gsmtap_header=false); ~message_printer_impl(); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_MESSAGE_PRINTER_IMPL_H */ gr-gsm-0.41.2/lib/misc_utils/msg_to_tag_impl.cc000066400000000000000000000057251316153413000213740ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2016 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "msg_to_tag_impl.h" namespace gr { namespace gsm { msg_to_tag::sptr msg_to_tag::make() { return gnuradio::get_initial_sptr (new msg_to_tag_impl()); } void msg_to_tag_impl::queue_msg(pmt::pmt_t msg){ if(pmt::is_dict(msg)){ try { pmt::pmt_t keys = pmt::dict_keys(msg); } catch (const pmt::wrong_type &e) { msg = pmt::dict_add(pmt::make_dict(), pmt::car(msg), pmt::cdr(msg)); } } d_msg_queue.push_back(msg); } /* * The private constructor */ msg_to_tag_impl::msg_to_tag_impl() : gr::sync_block("msg_to_tag", gr::io_signature::make(1, 1, sizeof(gr_complex)), gr::io_signature::make(1, 1, sizeof(gr_complex))) { message_port_register_in(pmt::mp("msg")); set_msg_handler(pmt::mp("msg"), boost::bind(&msg_to_tag_impl::queue_msg, this, _1)); } /* * Our virtual destructor. */ msg_to_tag_impl::~msg_to_tag_impl() { } int msg_to_tag_impl::work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { while(!d_msg_queue.empty()){ pmt::pmt_t msg(d_msg_queue.front()); d_msg_queue.pop_front(); if(pmt::is_dict(msg)){ pmt::pmt_t klist(pmt::dict_keys(msg)); for (size_t i = 0; i < pmt::length(klist); i++) { pmt::pmt_t k(pmt::nth(i, klist)); pmt::pmt_t v(pmt::dict_ref(msg, k, pmt::PMT_NIL)); add_item_tag(0, nitems_written(0), k, v, alias_pmt()); } } else if(pmt::is_number(msg)) { add_item_tag(0, nitems_written(0), pmt::intern(""), msg, alias_pmt()); } else if(pmt::is_symbol(msg)) { add_item_tag(0, nitems_written(0), msg, pmt::intern(""), alias_pmt()); } } memcpy(output_items[0], input_items[0], sizeof(gr_complex)*noutput_items); // Tell runtime system how many output items we produced. return noutput_items; } } /* namespace grgsm */ } /* namespace gr */ gr-gsm-0.41.2/lib/misc_utils/msg_to_tag_impl.h000066400000000000000000000026651316153413000212360ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2016 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GRGSM_MSG_TO_TAG_IMPL_H #define INCLUDED_GRGSM_MSG_TO_TAG_IMPL_H #include namespace gr { namespace gsm { class msg_to_tag_impl : public msg_to_tag { private: std::deque d_msg_queue; public: msg_to_tag_impl(); ~msg_to_tag_impl(); void queue_msg(pmt::pmt_t msg); // Where all the action really happens int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); }; } // namespace grgsm } // namespace gr #endif /* INCLUDED_GRGSM_MSG_TO_TAG_IMPL_H */ gr-gsm-0.41.2/lib/misc_utils/tmsi_dumper_impl.cc000066400000000000000000000164441316153413000216010ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "tmsi_dumper_impl.h" #include "grgsm/gsmtap.h" #include #include namespace gr { namespace gsm { void tmsi_dumper_impl::dump_tmsi(pmt::pmt_t msg) { time_t t = time(0); tm *now = localtime(&t); pmt::pmt_t message_plus_header_blob = pmt::cdr(msg); uint8_t * message_plus_header = (uint8_t *)pmt::blob_data(message_plus_header_blob); gsmtap_hdr * header = (gsmtap_hdr *)message_plus_header; uint8_t * m = (uint8_t *)(message_plus_header+sizeof(gsmtap_hdr)); //message content uint8_t msg_len = m[0]; uint8_t direction_and_protocol = m[1]; uint8_t msg_type = m[2]; if( direction_and_protocol == 0x06 && //direction from originating site, transaction id==0, Radio Resouce Management protocol (msg_type==0x21 || msg_type==0x22 || msg_type==0x24) //types corresponding to paging requests ) { //write timestamp switch(msg_type) { case 0x21: //Paging Request Type 1 { uint8_t mobile_identity_type = m[5] & 0x07; unsigned int next_element_index = 0; //position of the next element bool found_id_element = false; if(mobile_identity_type == 0x04) //identity type: TMSI { write_tmsi(m+6); dump_file << "-"; write_timestamp(now); dump_file << "-0"; dump_file << std::endl; next_element_index = 10; found_id_element = true; } else if(mobile_identity_type == 0x01) //identity type: IMSI { dump_file << "0-"; write_timestamp(now); dump_file << "-"; write_imsi(m+5); dump_file << std::endl; next_element_index = 13; found_id_element = true; } if(found_id_element == true) { //check if there is additional id element uint8_t element_id = m[next_element_index]; if((next_element_index < (msg_len+1)) && (element_id == 0x17)) { //check if there is another element uint8_t element_len = m[next_element_index+1]; mobile_identity_type = m[next_element_index+2] & 0x07; if(mobile_identity_type == 0x04) //identity type: TMSI { write_tmsi(m+next_element_index+3); //write starting from position of the TMSI in the message dump_file << "-"; write_timestamp(now); dump_file << "-0"; dump_file << std::endl; } else if(mobile_identity_type == 0x01) //identity type: IMSI { dump_file << "0-"; write_timestamp(now); dump_file << "-"; write_imsi(m+next_element_index+2); //write starting from position of the IMSI in the message dump_file << std::endl; } } int ii; } } break; case 0x22: //Paging Request Type 2 { uint8_t mobile_identity_type = m[14] & 0x07; write_tmsi(m+4);//1st tmsi location dump_file << "-"; write_timestamp(now); dump_file << "-0"; dump_file << std::endl; write_tmsi(m+8);//2nd tmsi location dump_file << "-"; write_timestamp(now); dump_file << "-0"; dump_file << std::endl; if(mobile_identity_type == 0x04) //identity type: TMSI { write_tmsi(m+15); dump_file << "-"; write_timestamp(now); dump_file << "-0"; dump_file << std::endl; } else if(mobile_identity_type == 0x01) //identity type: IMSI { dump_file << "0-"; write_timestamp(now); dump_file << "-"; write_imsi(m+14); dump_file << std::endl; } } break; case 0x24: //Paging Request Type 3 { int TMSI_INDEX[4] = {4,8,12,16}; // indexes of the 4 tmsi's for(int x =0; x < 4; x++) { write_tmsi(m+TMSI_INDEX[x]); dump_file << "-"; write_timestamp(now); dump_file << "-0"; dump_file << std::endl; } } break; } } } inline void tmsi_dumper_impl::write_timestamp(tm * now) { dump_file << boost::format("%d%02d%02d%02d%02d%02d") % (now->tm_year + 1900-2000) //year -2000 here after the 1900 leaves you with 15 instead of 2015 (delivery reports format is 150112223501) % (now->tm_mon + 1) //month % now->tm_mday //day % now->tm_hour % now->tm_min % now->tm_sec; //time of day return; } inline int swap(uint8_t c) { uint8_t temp1, temp2; temp1 = c & 0x0F; temp2 = c & 0xF0; temp1=temp1 << 4; temp2=temp2 >> 4; return(temp2|temp1); } void tmsi_dumper_impl::write_imsi(uint8_t * imsi) { dump_file << boost::format("%1x%02x%02x%02x%02x%02x%02x%02x") % (swap(imsi[0]) & 0x0f) % swap(imsi[1]) % swap(imsi[2]) % swap(imsi[3]) % swap(imsi[4]) % swap(imsi[5]) % swap(imsi[6]) % swap(imsi[7]); return; } void tmsi_dumper_impl::write_tmsi(uint8_t * tmsi) { dump_file << boost::format("%02x%02x%02x%02x") % (int)tmsi[0] % (int)tmsi[1] % (int)tmsi[2] % (int)tmsi[3]; return; } tmsi_dumper::sptr tmsi_dumper::make() { return gnuradio::get_initial_sptr (new tmsi_dumper_impl()); } /* * The private constructor */ tmsi_dumper_impl::tmsi_dumper_impl() : gr::block("tmsi_dumper", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)) { dump_file.open("tmsicount.txt", std::ios_base::app); message_port_register_in(pmt::mp("msgs")); set_msg_handler(pmt::mp("msgs"), boost::bind(&tmsi_dumper_impl::dump_tmsi, this, _1)); } /* * Our virtual destructor. */ tmsi_dumper_impl::~tmsi_dumper_impl() { dump_file.close(); } } /* namespace gsm */ } /* namespace gr */ gr-gsm-0.41.2/lib/misc_utils/tmsi_dumper_impl.h000066400000000000000000000026201316153413000214320ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_TMSI_DUMPER_IMPL_H #define INCLUDED_GSM_TMSI_DUMPER_IMPL_H #include #include #include namespace gr { namespace gsm { class tmsi_dumper_impl : public tmsi_dumper { private: std::ofstream dump_file; void dump_tmsi(pmt::pmt_t msg); void write_timestamp(tm * now); void write_imsi(uint8_t * imsi); void write_tmsi(uint8_t * tmsi); public: tmsi_dumper_impl(); ~tmsi_dumper_impl(); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_TMSI_DUMPER_IMPL_H */ gr-gsm-0.41.2/lib/qa_utils/000077500000000000000000000000001316153413000153565ustar00rootroot00000000000000gr-gsm-0.41.2/lib/qa_utils/CMakeLists.txt000066400000000000000000000016031316153413000201160ustar00rootroot00000000000000# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. add_sources( burst_sink_impl.cc burst_source_impl.cc message_sink_impl.cc message_source_impl.cc ) gr-gsm-0.41.2/lib/qa_utils/burst_sink_impl.cc000066400000000000000000000057551316153413000211050ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "burst_sink_impl.h" #include #include #include #include namespace gr { namespace gsm { burst_sink::sptr burst_sink::make() { return gnuradio::get_initial_sptr (new burst_sink_impl()); } /* * The private constructor */ burst_sink_impl::burst_sink_impl() : gr::block("burst_sink", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)) { message_port_register_in(pmt::mp("in")); set_msg_handler(pmt::mp("in"), boost::bind(&burst_sink_impl::process_burst, this, _1)); } /* * Our virtual destructor. */ burst_sink_impl::~burst_sink_impl() { // for (int i=0; iframe_number); std::stringstream burst_str; for(int i=0; i(burst[i]) == 0) { burst_str << "0"; } else { burst_str << "1"; } } d_framenumbers.push_back(frame_nr); d_timeslots.push_back(header->timeslot); d_burst_data.push_back(burst_str.str()); } std::vector burst_sink_impl::get_framenumbers() { return d_framenumbers; } std::vector burst_sink_impl::get_timeslots() { return d_timeslots; } std::vector burst_sink_impl::get_burst_data() { return d_burst_data; } } /* namespace gsm */ } /* namespace gr */ gr-gsm-0.41.2/lib/qa_utils/burst_sink_impl.h000066400000000000000000000027711316153413000207420ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_BURST_SINK_IMPL_H #define INCLUDED_GSM_BURST_SINK_IMPL_H #include #include namespace gr { namespace gsm { class burst_sink_impl : public burst_sink { private: std::vector d_framenumbers; std::vector d_timeslots; std::vector d_burst_data; public: burst_sink_impl(); ~burst_sink_impl(); void process_burst(pmt::pmt_t msg); virtual std::vector get_framenumbers(); virtual std::vector get_timeslots(); virtual std::vector get_burst_data(); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_BURST_SINK_IMPL_H */ gr-gsm-0.41.2/lib/qa_utils/burst_source_impl.cc000066400000000000000000000116041316153413000214270ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "burst_source_impl.h" #include "stdio.h" #include #include #include #define PMT_SIZE 174 namespace gr { namespace gsm { burst_source::sptr burst_source::make(const std::vector &framenumbers, const std::vector ×lots, const std::vector &burst_data) { return gnuradio::get_initial_sptr (new burst_source_impl(framenumbers, timeslots, burst_data)); } /* * The private constructor */ burst_source_impl::burst_source_impl(const std::vector &framenumbers, const std::vector ×lots, const std::vector &burst_data) : gr::block("burst_source", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), d_finished(false) { message_port_register_out(pmt::mp("out")); set_framenumbers(framenumbers); set_timeslots(timeslots); set_burst_data(burst_data); } /* * Our virtual destructor. */ burst_source_impl::~burst_source_impl() { if (d_finished == false){ d_finished = true; } } void burst_source_impl::set_framenumbers(const std::vector &framenumbers) { d_framenumbers = framenumbers; } void burst_source_impl::set_timeslots(const std::vector ×lots) { d_timeslots = timeslots; } void burst_source_impl::set_burst_data(const std::vector &burst_data) { d_burst_data = burst_data; } bool burst_source_impl::start() { d_finished = false; d_thread = boost::shared_ptr (new gr::thread::thread(boost::bind(&burst_source_impl::run, this))); return block::start(); } bool burst_source_impl::stop() { d_finished = true; d_thread->interrupt(); d_thread->join(); return block::stop(); } bool burst_source_impl::finished() { return d_finished; } void burst_source_impl::run() { char *unserialized = (char*)malloc(sizeof(char) * PMT_SIZE); for (int i=0; i= 0 && d_timeslots[i] <= 7 && d_framenumbers[i] >= 0 && d_framenumbers[i] <= (26 * 51 * 2048 - 1)) { boost::scoped_ptr tap_header(new gsmtap_hdr()); tap_header->version = GSMTAP_VERSION; tap_header->hdr_len = sizeof(gsmtap_hdr)/4; tap_header->type = GSMTAP_TYPE_UM_BURST; tap_header->timeslot = d_timeslots[i]; tap_header->frame_number = htobe32(d_framenumbers[i]); tap_header->sub_type = GSMTAP_BURST_NORMAL; tap_header->arfcn = 0; tap_header->signal_dbm = 0; tap_header->snr_db = 0; uint8_t burst[BURST_SIZE]; for (int j=0; j * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_BURST_SOURCE_IMPL_H #define INCLUDED_GSM_BURST_SOURCE_IMPL_H #define BURST_SIZE 148 #include #include namespace gr { namespace gsm { class burst_source_impl : public burst_source { private: boost::shared_ptr d_thread; std::vector d_framenumbers; std::vector d_timeslots; std::vector d_burst_data; bool d_finished; void run(); public: burst_source_impl(const std::vector &framenumbers, const std::vector ×lots, const std::vector &burst_data); ~burst_source_impl(); virtual void set_framenumbers(const std::vector &framenumbers); virtual void set_timeslots(const std::vector ×lots); virtual void set_burst_data(const std::vector &burst_data); bool start(); bool stop(); bool finished(); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_BURST_SOURCE_IMPL_H */ gr-gsm-0.41.2/lib/qa_utils/message_sink_impl.cc000066400000000000000000000050201316153413000213530ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "message_sink_impl.h" #include #include namespace gr { namespace gsm { message_sink::sptr message_sink::make() { return gnuradio::get_initial_sptr (new message_sink_impl()); } /* * The private constructor */ message_sink_impl::message_sink_impl() : gr::block("message_sink", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)) { message_port_register_in(pmt::mp("in")); set_msg_handler(pmt::mp("in"), boost::bind(&message_sink_impl::process_message, this, _1)); } /* * Our virtual destructor. */ message_sink_impl::~message_sink_impl() { for (int i=0; i0) { s_msg_stream << (" "); } s_msg_stream << std::hex << std::setw(2) << std::setfill('0') << (unsigned)message_plus_header[i]; } d_messages.push_back(s_msg_stream.str()); } std::vector message_sink_impl::get_messages() { return d_messages; } } /* namespace gsm */ } /* namespace gr */ gr-gsm-0.41.2/lib/qa_utils/message_sink_impl.h000066400000000000000000000025071316153413000212240ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_MESSAGE_SINK_IMPL_H #define INCLUDED_GSM_MESSAGE_SINK_IMPL_H #include namespace gr { namespace gsm { class message_sink_impl : public message_sink { private: std::vector d_messages; public: message_sink_impl(); ~message_sink_impl(); void process_message(pmt::pmt_t msg); virtual std::vector get_messages(); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_MESSAGE_SINK_IMPL_H */ gr-gsm-0.41.2/lib/qa_utils/message_source_impl.cc000066400000000000000000000067031316153413000217200ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "message_source_impl.h" #include #include #include #include #include #include #include #include #define MSG_BYTE_LEN 39 namespace gr { namespace gsm { message_source::sptr message_source::make(const std::vector &msg_data) { return gnuradio::get_initial_sptr (new message_source_impl(msg_data)); } /* * The private constructor */ message_source_impl::message_source_impl(const std::vector &msg_data) : gr::block("message_source", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), d_finished(false) { message_port_register_out(pmt::mp("msgs")); set_msg_data(msg_data); } /* * Our virtual destructor. */ message_source_impl::~message_source_impl() { if (d_finished == false){ d_finished = true; } } void message_source_impl::set_msg_data(const std::vector &msg_data) { for (int i=0; i bytes; unsigned int c; while (iss >> std::hex >> c) { if (c < 256) { bytes.push_back(c); } } if (bytes.size() == MSG_BYTE_LEN) { d_msgs.push_back(bytes); } } } bool message_source_impl::start() { d_finished = false; d_thread = boost::shared_ptr (new gr::thread::thread(boost::bind(&message_source_impl::run, this))); return block::start(); } bool message_source_impl::stop() { d_finished = true; d_thread->interrupt(); d_thread->join(); return block::stop(); } bool message_source_impl::finished() { return d_finished; } void message_source_impl::run() { for (int i=0; i current = d_msgs[i]; pmt::pmt_t blob_header_plus_burst = pmt::make_blob(¤t[0], current.size()); pmt::pmt_t msg = pmt::cons(pmt::PMT_NIL, blob_header_plus_burst); message_port_pub(pmt::mp("msgs"), msg); } post(pmt::mp("system"), pmt::cons(pmt::mp("done"), pmt::from_long(1))); } } /* namespace gsm */ } /* namespace gr */ gr-gsm-0.41.2/lib/qa_utils/message_source_impl.h000066400000000000000000000030231316153413000215520ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Roman Khassraf * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_MESSAGE_SOURCE_IMPL_H #define INCLUDED_GSM_MESSAGE_SOURCE_IMPL_H #include namespace gr { namespace gsm { class message_source_impl : public message_source { private: boost::shared_ptr d_thread; std::vector > d_msgs; bool d_finished; void run(); public: message_source_impl(const std::vector &msg_data); ~message_source_impl(); virtual void set_msg_data(const std::vector &msg_data); bool start(); bool stop(); bool finished(); }; } // namespace grgsm } // namespace gr #endif /* INCLUDED_GSM_MESSAGE_SOURCE_IMPL_H */ gr-gsm-0.41.2/lib/receiver/000077500000000000000000000000001316153413000153415ustar00rootroot00000000000000gr-gsm-0.41.2/lib/receiver/CMakeLists.txt000066400000000000000000000016421316153413000201040ustar00rootroot00000000000000# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. add_sources( clock_offset_control_impl.cc cx_channel_hopper_impl.cc receiver_config.cc receiver_impl.cc viterbi_detector.cc ) gr-gsm-0.41.2/lib/receiver/clock_offset_control_impl.cc000066400000000000000000000136141316153413000230770ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2015-2017 Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "clock_offset_control_impl.h" namespace gr { namespace gsm { clock_offset_control::sptr clock_offset_control::make(float fc, float samp_rate, unsigned int osr) { return gnuradio::get_initial_sptr (new clock_offset_control_impl(fc, samp_rate, osr)); } /* * The private constructor */ clock_offset_control_impl::clock_offset_control_impl(float fc, float samp_rate, unsigned int osr) : gr::block("clock_offset_control", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)) { message_port_register_in(pmt::mp("measurements")); set_msg_handler(pmt::mp("measurements"), boost::bind(&clock_offset_control_impl::process_measurement, this, _1)); message_port_register_out(pmt::mp("ctrl")); set_fc(fc); set_samp_rate(samp_rate); set_osr(osr); d_alfa = 0.3; d_ppm_estimate = -1e6; d_last_ppm_estimate = -1e6; d_first_measurement = true; d_counter = 0; d_last_state = ""; d_current_time = 0; d_last_fcch_time = 0; d_first_time = true; } /* * Our virtual destructor. */ clock_offset_control_impl::~clock_offset_control_impl() { } void clock_offset_control_impl::set_osr(unsigned int osr) { d_osr = osr; } void clock_offset_control_impl::set_fc(float fc) { d_fc = fc; } void clock_offset_control_impl::set_samp_rate(float samp_rate) { d_samp_rate = samp_rate; } void clock_offset_control_impl::process_measurement(pmt::pmt_t msg) { if(pmt::is_tuple(msg)) { std::string key = pmt::symbol_to_string(pmt::tuple_ref(msg,0)); if(key == "current_time") { d_current_time = pmt::to_double(pmt::tuple_ref(msg,1)); if(d_first_time==true) { d_last_fcch_time = d_current_time; d_first_time = false; } else if((d_current_time - d_last_fcch_time) > 0.5 && d_last_state == "fcch_search") { timed_reset(); } } else if(key == "freq_offset") { float freq_offset = pmt::to_double(pmt::tuple_ref(msg,1)); float ppm = -freq_offset/d_fc*1.0e6; std::string state = pmt::symbol_to_string(pmt::tuple_ref(msg,2)); d_last_state = state; if(std::abs(ppm) < 100.0) //safeguard against flawed measurements { if(state == "fcch_search") { send_ctrl_messages(freq_offset); d_last_fcch_time = d_current_time; } else if (state == "synchronized") { d_last_fcch_time = d_current_time; if(d_first_measurement) { d_ppm_estimate = ppm; d_first_measurement = false; } else { d_ppm_estimate = (1-d_alfa)*d_ppm_estimate+d_alfa*ppm; } if(d_counter == 5) { d_counter = 0; if(std::abs(d_last_ppm_estimate-d_ppm_estimate) > 0.1) { // pmt::pmt_t msg_ppm = pmt::from_double(ppm); // message_port_pub(pmt::intern("ppm"), msg_ppm); send_ctrl_messages(freq_offset); d_last_ppm_estimate = d_ppm_estimate; } } else { d_counter=d_counter+1; } } else if(state == "sync_loss") { reset(); // pmt::pmt_t msg_ppm = pmt::from_double(0.0); // message_port_pub(pmt::intern("ppm"), msg_ppm); send_ctrl_messages(0); } } } } } void clock_offset_control_impl::send_ctrl_messages(float freq_offset) { double samp_rate_ratio = d_samp_rate / (d_osr * GSM_SYMBOL_RATE); pmt::pmt_t messages = pmt::make_dict(); messages = dict_add(messages, pmt::string_to_symbol("set_phase_inc"), pmt::from_double(-2*M_PI*freq_offset/(d_osr * GSM_SYMBOL_RATE))); messages = dict_add(messages, pmt::string_to_symbol("set_resamp_ratio"), pmt::from_double((1-(freq_offset/d_fc))*samp_rate_ratio)); messages = dict_add(messages, pmt::string_to_symbol("setting_freq_offset"), pmt::from_double(-freq_offset)); messages = dict_add(messages, pmt::string_to_symbol("clock_offset_in_ppm"), pmt::from_double(-freq_offset/d_fc*1.0e6)); message_port_pub(pmt::intern("ctrl"), messages); } void clock_offset_control_impl::timed_reset() { reset(); send_ctrl_messages(0); } void clock_offset_control_impl::reset() { d_ppm_estimate = -1e6; d_counter = 0; d_first_measurement = true; } } /* namespace gsm */ } /* namespace gr */ gr-gsm-0.41.2/lib/receiver/clock_offset_control_impl.h000066400000000000000000000037151316153413000227420ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2015-2017 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GSM_CLOCK_OFFSET_CONTROL_IMPL_H #define INCLUDED_GSM_CLOCK_OFFSET_CONTROL_IMPL_H #include #include namespace gr { namespace gsm { class clock_offset_control_impl : public clock_offset_control { private: float d_fc; float d_samp_rate; unsigned int d_osr; float d_alfa; float d_ppm_estimate; float d_last_ppm_estimate; bool d_first_measurement; int d_counter; std::string d_last_state; float d_current_time; float d_last_fcch_time; bool d_first_time; void process_measurement(pmt::pmt_t msg); void send_ctrl_messages(float freq_offset); void timed_reset(); void reset(); public: clock_offset_control_impl(float fc, float samp_rate, unsigned int osr); ~clock_offset_control_impl(); virtual void set_fc(float fc); virtual void set_samp_rate(float samp_rate); virtual void set_osr(unsigned int osr); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_CLOCK_OFFSET_CONTROL_IMPL_H */ gr-gsm-0.41.2/lib/receiver/cx_channel_hopper_impl.cc000066400000000000000000000120261316153413000223510ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Pieter Robyns * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "cx_channel_hopper_impl.h" namespace gr { namespace gsm { cx_channel_hopper::sptr cx_channel_hopper::make(const std::vector &ma, int maio, int hsn) { return gnuradio::get_initial_sptr (new cx_channel_hopper_impl(ma, maio, hsn)); } /* * The private constructor */ cx_channel_hopper_impl::cx_channel_hopper_impl(const std::vector &ma, int maio, int hsn) : gr::block("cx_channel_hopper", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), d_ma(ma), d_maio(maio), d_hsn(hsn) { d_narfcn = ma.size(); // Check user input for GSM 05.02, p16 compliance if(d_narfcn < 1 || d_narfcn > 64) { std::cerr << "warning: clamping number of RFCNs in the MA (" << d_narfcn << "), which should be 1 <= N <= 64." << std::endl; d_narfcn = boost::algorithm::clamp(d_narfcn, 1, 64); d_ma.resize(d_narfcn); } if(d_maio < 0 || d_maio >= d_narfcn) { std::cerr << "warning: clamping MAIO (" << d_maio << "), which should be 0 <= MAIO < N." << std::endl; d_maio = boost::algorithm::clamp(d_maio, 0, d_narfcn - 1); } if(d_hsn < 0 || d_hsn > 63) { std::cerr << "warning: clamping HSN (" << d_hsn << "), which should be 0 <= HSN < 64." << std::endl; d_hsn = boost::algorithm::clamp(d_hsn, 0, 63); } message_port_register_in(pmt::mp("CX")); set_msg_handler(pmt::mp("CX"), boost::bind(&cx_channel_hopper_impl::assemble_bursts, this, _1)); message_port_register_out(pmt::mp("bursts")); } /* * Our virtual destructor. */ cx_channel_hopper_impl::~cx_channel_hopper_impl() { } /** * Random number table used for calculating the * hopping sequence. Defined in GSM 05.02. */ unsigned char RNTABLE[114] = { 48, 98, 63, 1, 36, 95, 78, 102, 94, 73, \ 0, 64, 25, 81, 76, 59, 124, 23, 104, 100, \ 101, 47, 118, 85, 18, 56, 96, 86, 54, 2, \ 80, 34, 127, 13, 6, 89, 57, 103, 12, 74, \ 55, 111, 75, 38, 109, 71, 112, 29, 11, 88, \ 87, 19, 3, 68, 110, 26, 33, 31, 8, 45, \ 82, 58, 40, 107, 32, 5, 106, 92, 62, 67, \ 77, 108, 122, 37, 60, 66, 121, 42, 51, 126, \ 117, 114, 4, 90, 43, 52, 53, 113, 120, 72, \ 16, 49, 7, 79, 119, 61, 22, 84, 9, 97, \ 91, 15, 21, 24, 46, 39, 93, 105, 65, 70, \ 125, 99, 17, 123 \ }; /* * Slow Frequency Hopping (SFH) MAI calculation based * on airprobe-hopping by Bogdan Diaconescu. */ int cx_channel_hopper_impl::calculate_ma_sfh(int maio, int hsn, int n, int fn) { int mai = 0; int s = 0; int nbin = floor(log2(n) + 1); int t1 = fn / 1326; int t2 = fn % 26; int t3 = fn % 51; if (hsn == 0) mai = (fn + maio) % n; else { int t1r = t1 % 64; int m = t2 + RNTABLE[(hsn ^ t1r) + t3]; int mprim = m % (1 << nbin); int tprim = t3 % (1 << nbin); if (mprim < n) s = mprim; else s = (mprim + tprim) % n; mai = (s + maio) % n; } return (mai); } /** * Given MA, MAIO, HSN, and FN, decide which frames * to forward to the demapper. */ void cx_channel_hopper_impl::assemble_bursts(pmt::pmt_t msg) { pmt::pmt_t header_plus_burst = pmt::cdr(msg); gsmtap_hdr *header = (gsmtap_hdr *)pmt::blob_data(header_plus_burst); uint32_t frame_nr = be32toh(header->frame_number); uint16_t frame_ca = be16toh(header->arfcn) & 0x3FFF; //change highest bits to '0' //in order to leave only ARFCN number int mai = calculate_ma_sfh(d_maio, d_hsn, d_narfcn, frame_nr); if(d_ma[mai] == (int)frame_ca) { message_port_pub(pmt::mp("bursts"), msg); } } } /* namespace gsm */ } /* namespace gr */ gr-gsm-0.41.2/lib/receiver/cx_channel_hopper_impl.h000066400000000000000000000032141316153413000222120ustar00rootroot00000000000000/* -*- c++ -*- */ /* @file * @author (C) 2015 by Pieter Robyns * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. * */ #ifndef INCLUDED_GSM_CX_CHANNEL_HOPPER_IMPL_H #define INCLUDED_GSM_CX_CHANNEL_HOPPER_IMPL_H #include #include namespace gr { namespace gsm { class cx_channel_hopper_impl : public cx_channel_hopper { private: std::vector d_ma; // Mobile Allocation list. Contains all channels that are used while channel hopping int d_maio; // Mobile Allocation Index Offset int d_hsn; // Hopping Sequence Number int d_narfcn; // Length of d_ma int calculate_ma_sfh(int maio, int hsn, int n, int fn); void assemble_bursts(pmt::pmt_t msg); public: cx_channel_hopper_impl(const std::vector &ma, int maio, int hsn); ~cx_channel_hopper_impl(); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_CX_CHANNEL_HOPPER_IMPL_H */ gr-gsm-0.41.2/lib/receiver/gsm_constants.h000066400000000000000000000156331316153413000204040ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2014 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GSM_CONSTANTS_H #define INCLUDED_GSM_CONSTANTS_H #define GSM_SYMBOL_RATE (1625000.0/6.0) //symbols per second #define GSM_SYMBOL_PERIOD (1.0/GSM_SYMBOL_RATE) //seconds per symbol //Burst timing #define TAIL_BITS 3 #define GUARD_BITS 8 #define GUARD_FRACTIONAL 0.25 //fractional part of guard period #define GUARD_PERIOD GUARD_BITS + GUARD_FRACTIONAL #define DATA_BITS 57 //size of 1 data block in normal burst #define STEALING_BIT 1 #define N_TRAIN_BITS 26 #define N_SYNC_BITS 64 #define USEFUL_BITS 142 //(2*(DATA_BITS+STEALING_BIT) + N_TRAIN_BITS ) #define FCCH_BITS USEFUL_BITS #define BURST_SIZE (USEFUL_BITS+2*TAIL_BITS) #define PROCESSED_CHUNK BURST_SIZE+2*GUARD_PERIOD #define SCH_DATA_LEN 39 #define TS_BITS (TAIL_BITS+USEFUL_BITS+TAIL_BITS+GUARD_BITS) //a full TS (156 bits) #define TS_PER_FRAME 8 #define FRAME_BITS (TS_PER_FRAME * TS_BITS + 2) // 156.25 * 8 #define FCCH_POS TAIL_BITS #define SYNC_POS 39 #define TRAIN_POS ( TAIL_BITS + (DATA_BITS+STEALING_BIT) + 5) //first 5 bits of a training sequence //aren't used for channel impulse response estimation #define TRAIN_BEGINNING 5 #define SAFETY_MARGIN 6 // #define FCCH_HITS_NEEDED (USEFUL_BITS - 4) #define FCCH_MAX_MISSES 1 #define FCCH_MAX_FREQ_OFFSET 100 #define CHAN_IMP_RESP_LENGTH 5 #define MAX_SCH_ERRORS 10 //maximum number of subsequent sch errors after which gsm receiver goes to find_next_fcch state typedef enum {empty, fcch_burst, sch_burst, normal_burst, rach_burst, dummy, dummy_or_normal, normal_or_noise} burst_type; typedef enum {unknown, multiframe_26, multiframe_51} multiframe_type; static const unsigned char SYNC_BITS[] = { 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1 }; const unsigned FCCH_FRAMES[] = {0, 10, 20, 30, 40}; const unsigned SCH_FRAMES[] = {1, 11, 21, 31, 41}; const unsigned BCCH_FRAMES[] = {2, 3, 4, 5}; //!!the receiver shouldn't care about logical //!!channels so this will be removed from this header const unsigned TEST_CCH_FRAMES[] = {2, 3, 4, 5, 6, 7, 8, 9, 12, 13, 14, 15, 16, 17, 18, 19, 22, 23, 24, 25, 26, 27, 28, 29, 32, 33, 34, 35, 36, 37, 38, 39, 42, 43, 44, 45, 46, 47, 48, 49}; const unsigned TRAFFIC_CHANNEL_F[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24}; const unsigned TEST51[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50}; #define TSC0 0 #define TSC1 1 #define TSC2 2 #define TSC3 3 #define TSC4 4 #define TSC5 5 #define TSC6 6 #define TSC7 7 #define TS_DUMMY 8 #define TRAIN_SEQ_NUM 9 #define TIMESLOT0 0 #define TIMESLOT1 1 #define TIMESLOT2 2 #define TIMESLOT3 3 #define TIMESLOT4 4 #define TIMESLOT5 5 #define TIMESLOT6 6 #define TIMESLOT7 7 static const unsigned char train_seq[TRAIN_SEQ_NUM][N_TRAIN_BITS] = { {0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1}, {0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1}, {0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0}, {0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0}, {0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1}, {0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0}, {1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1}, {1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0}, {0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1} // DUMMY }; //Dummy burst 0xFB 76 0A 4E 09 10 1F 1C 5C 5C 57 4A 33 39 E9 F1 2F A8 static const unsigned char dummy_burst[] = { 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0 }; /* * The frequency correction burst is used for frequency synchronization * of the mobile. This is broadcast in TS0 together with the SCH and * BCCH. * * Modulating the bits below causes a spike at 62.5kHz above (below for * COMPACT) the center frequency. One can use this spike with a narrow * band filter to accurately determine the center of the channel. */ static const unsigned char fc_fb[] = { 0, 0, 0, //I don't use this tables, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //I copied this here from burst_types.h because 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //the description is very informative - p.krysik 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static const unsigned char fc_compact_fb[] = { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 }; #endif /* INCLUDED_GSM_CONSTANTS_H */ gr-gsm-0.41.2/lib/receiver/receiver_config.cc000066400000000000000000000053421316153413000210050ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2009-2017 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include burst_counter & burst_counter::operator++(int) { d_timeslot_nr++; if (d_timeslot_nr == TS_PER_FRAME) { d_timeslot_nr = 0; if ((d_t2 == 25) && (d_t3 == 50)) { d_t1 = (d_t1 + 1) % (1 << 11); } d_t2 = (d_t2 + 1) % 26; d_t3 = (d_t3 + 1) % 51; } //update offset - this is integer for d_OSR which is multiple of four d_offset_fractional += GUARD_FRACTIONAL * d_OSR; d_offset_integer = floor(d_offset_fractional); d_offset_fractional = d_offset_fractional - d_offset_integer; return (*this); } burst_counter burst_counter::subtract_timeslots(unsigned int number_of_timeslots) { int timeslot_nr = (int)d_timeslot_nr - (int)number_of_timeslots; int t1,t2,t3; if (timeslot_nr < 0) { timeslot_nr = timeslot_nr + 8; t2 = (d_t2+26 - 1) % 26; t3 = (d_t3+51 - 1) % 51; if ((d_t2 == 0) && (d_t3 == 0)) { t1 = (d_t1 - 1) % (1 << 11); } else { t1 = d_t1; } } else { t1 = d_t1; t2 = d_t2; t3 = d_t3; } return burst_counter(d_OSR, t1, t2, t3, timeslot_nr); } void burst_counter::set(uint32_t t1, uint32_t t2, uint32_t t3, uint32_t timeslot_nr) { d_t1 = t1; d_t2 = t2; d_t3 = t3; d_timeslot_nr = timeslot_nr; double first_sample_position = (get_frame_nr() * 8 + timeslot_nr) * TS_BITS; d_offset_fractional = first_sample_position - floor(first_sample_position); d_offset_integer = 0; } burst_type channel_configuration::get_burst_type(burst_counter burst_nr) { uint32_t timeslot_nr = burst_nr.get_timeslot_nr(); multiframe_type m_type = d_timeslots_descriptions[timeslot_nr].get_type(); uint32_t nr; switch (m_type) { case multiframe_26: nr = burst_nr.get_t2(); break; case multiframe_51: nr = burst_nr.get_t3(); break; default: nr = 0; break; } return d_timeslots_descriptions[timeslot_nr].get_burst_type(nr); } gr-gsm-0.41.2/lib/receiver/receiver_config.h000066400000000000000000000077311316153413000206530ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2009-2017 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GSM_RECEIVER_CONFIG_H #define INCLUDED_GSM_RECEIVER_CONFIG_H #include #include #include #include #include class multiframe_configuration { private: multiframe_type d_type; std::vector d_burst_types; public: multiframe_configuration() { d_type = unknown; fill(d_burst_types.begin(), d_burst_types.end(), empty); } ~multiframe_configuration() {} void set_type(multiframe_type type) { if (type == multiframe_26) { d_burst_types.resize(26); } else { d_burst_types.resize(51); } d_type = type; } void set_burst_type(int nr, burst_type type) { d_burst_types[nr] = type; } multiframe_type get_type() { return d_type; } burst_type get_burst_type(int nr) { return d_burst_types[nr]; } }; class burst_counter { private: const int d_OSR; uint32_t d_t1, d_t2, d_t3, d_timeslot_nr; double d_offset_fractional; double d_offset_integer; public: burst_counter(int osr): d_OSR(osr), d_t1(0), d_t2(0), d_t3(0), d_timeslot_nr(0), d_offset_fractional(0.0), d_offset_integer(0.0) { } burst_counter(int osr, uint32_t t1, uint32_t t2, uint32_t t3, uint32_t timeslot_nr): d_OSR(osr), d_t1(t1), d_t2(t2), d_t3(t3), d_timeslot_nr(timeslot_nr), d_offset_fractional(0.0), d_offset_integer(0.0) { d_offset_integer = 0; d_offset_fractional = 0; } burst_counter & operator++(int); burst_counter subtract_timeslots(unsigned int number_of_timeslots); void set(uint32_t t1, uint32_t t2, uint32_t t3, uint32_t timeslot_nr); uint32_t get_t1() { return d_t1; } uint32_t get_t2() { return d_t2; } uint32_t get_t3() { return d_t3; } uint32_t get_timeslot_nr() { return d_timeslot_nr; } uint32_t get_frame_nr() { return (51 * 26 * d_t1) + (51 * (((d_t3 + 26) - d_t2) % 26)) + d_t3; } uint32_t get_frame_nr_mod() { return (d_t1 << 11) + (d_t3 << 5) + d_t2; } unsigned get_offset() { return (unsigned)d_offset_integer; } }; class channel_configuration { private: multiframe_configuration d_timeslots_descriptions[TS_PER_FRAME]; public: channel_configuration() { for (int i = 0; i < TS_PER_FRAME; i++) { d_timeslots_descriptions[i].set_type(unknown); } } void set_multiframe_type(int timeslot_nr, multiframe_type type) { d_timeslots_descriptions[timeslot_nr].set_type(type); } void set_burst_types(int timeslot_nr, const unsigned mapping[], unsigned mapping_size, burst_type b_type) { unsigned i; for (i = 0; i < mapping_size; i++) { d_timeslots_descriptions[timeslot_nr].set_burst_type(mapping[i], b_type); } } void set_single_burst_type(int timeslot_nr, int burst_nr, burst_type b_type) { d_timeslots_descriptions[timeslot_nr].set_burst_type(burst_nr, b_type); } burst_type get_burst_type(burst_counter burst_nr); }; #endif /* INCLUDED_GSM_RECEIVER_CONFIG_H */ gr-gsm-0.41.2/lib/receiver/receiver_impl.cc000066400000000000000000001023341316153413000205000ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2009-2017 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include #include #include #include "receiver_impl.h" #include "viterbi_detector.h" #include "sch.h" #if 0 /* Files included for debuging */ #include "plotting/plotting.hpp" #include #include #endif #define SYNC_SEARCH_RANGE 30 namespace gr { namespace gsm { /* The public constructor */ receiver::sptr receiver::make( int osr, const std::vector &cell_allocation, const std::vector &tseq_nums, bool process_uplink) { return gnuradio::get_initial_sptr (new receiver_impl(osr, cell_allocation, tseq_nums, process_uplink)); } /* The private constructor */ receiver_impl::receiver_impl( int osr, const std::vector &cell_allocation, const std::vector &tseq_nums, bool process_uplink ) : gr::sync_block("receiver", gr::io_signature::make(1, -1, sizeof(gr_complex)), gr::io_signature::make(0, 0, 0)), d_OSR(osr), d_process_uplink(process_uplink), d_chan_imp_length(CHAN_IMP_RESP_LENGTH), d_counter(0), d_fcch_start_pos(0), d_freq_offset_setting(0), d_state(fcch_search), d_burst_nr(osr), d_failed_sch(0), d_signal_dbm(-120), d_tseq_nums(tseq_nums), d_cell_allocation(cell_allocation), d_last_time(0.0) { /** * Don't send samples to the receiver * until there are at least samples for one */ set_output_multiple(floor((TS_BITS + 2 * GUARD_PERIOD) * d_OSR)); /** * Prepare SCH sequence bits * * (TS_BITS + 2 * GUARD_PERIOD) * Burst and two guard periods * (one guard period is an arbitrary overlap) */ gmsk_mapper(SYNC_BITS, N_SYNC_BITS, d_sch_training_seq, gr_complex(0.0, -1.0)); /* Prepare bits of training sequences */ for (int i = 0; i < TRAIN_SEQ_NUM; i++) { /** * If first bit of the sequence is 0 * => first symbol is 1, else -1 */ gr_complex startpoint = train_seq[i][0] == 0 ? gr_complex(1.0, 0.0) : gr_complex(-1.0, 0.0); gmsk_mapper(train_seq[i], N_TRAIN_BITS, d_norm_training_seq[i], startpoint); } /* Register output ports */ message_port_register_out(pmt::mp("C0")); message_port_register_out(pmt::mp("CX")); message_port_register_out(pmt::mp("measurements")); /** * Configure the receiver, * i.e. tell it where to find which burst type */ configure_receiver(); } /* Our virtual destructor */ receiver_impl::~receiver_impl() {} int receiver_impl::work( int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { gr_complex *input = (gr_complex *) input_items[0]; uint64_t start = nitems_read(0); uint64_t stop = start + noutput_items; d_freq_offset_tag_in_fcch = false; #if 0 /* FIXME: jak zrobić to rzutowanie poprawnie */ std::vector iii = (std::vector) input_items; #endif /* Time synchronization loop */ float current_time = static_cast(start / (GSM_SYMBOL_RATE * d_OSR)); if ((current_time - d_last_time) > 0.1) { pmt::pmt_t msg = pmt::make_tuple(pmt::mp("current_time"), pmt::from_double(current_time)); message_port_pub(pmt::mp("measurements"), msg); d_last_time = current_time; } /* Frequency correction loop */ std::vector freq_offset_tags; pmt::pmt_t key = pmt::string_to_symbol("setting_freq_offset"); get_tags_in_range(freq_offset_tags, 0, start, stop, key); if (!freq_offset_tags.empty()) { tag_t freq_offset_tag = freq_offset_tags[0]; uint64_t tag_offset = freq_offset_tag.offset - start; d_freq_offset_setting = pmt::to_double(freq_offset_tag.value); burst_type b_type = d_channel_conf.get_burst_type(d_burst_nr); if (d_state == synchronized && b_type == fcch_burst){ uint64_t last_sample_nr = ceil((GUARD_PERIOD + 2.0 * TAIL_BITS + 156.25) * d_OSR) + 1; d_freq_offset_tag_in_fcch = tag_offset < last_sample_nr; } } /* Main state machine */ switch (d_state) { case fcch_search: fcch_search_handler(input, noutput_items); break; case sch_search: sch_search_handler(input, noutput_items); break; case synchronized: synchronized_handler(input, input_items, noutput_items); break; } return 0; } void receiver_impl::fcch_search_handler(gr_complex *input, int noutput_items) { double freq_offset_tmp; /* Check if received samples is a FCCN burst */ if (!find_fcch_burst(input, noutput_items, freq_offset_tmp)) return; /* We found it, compose a message */ pmt::pmt_t msg = pmt::make_tuple( pmt::mp("freq_offset"), pmt::from_double(freq_offset_tmp - d_freq_offset_setting), pmt::mp("fcch_search") ); /* Notify FCCH loop */ message_port_pub(pmt::mp("measurements"), msg); /* Update current state */ d_state = sch_search; } void receiver_impl::sch_search_handler(gr_complex *input, int noutput_items) { std::vector channel_imp_resp(CHAN_IMP_RESP_LENGTH * d_OSR); unsigned char burst_buf[BURST_SIZE]; int rc, t1, t2, t3; int burst_start; /* Wait until we get a SCH burst */ if (!reach_sch_burst(noutput_items)) return; /* Get channel impulse response from it */ burst_start = get_sch_chan_imp_resp(input, &channel_imp_resp[0]); /* Detect bits using MLSE detection */ detect_burst(input, &channel_imp_resp[0], burst_start, burst_buf); /* Attempt to decode BSIC and frame number */ rc = decode_sch(&burst_buf[3], &t1, &t2, &t3, &d_ncc, &d_bcc); if (rc) { /** * There is error in the SCH burst, * go back to the FCCH search state */ d_state = fcch_search; return; } /* Set counter of bursts value */ d_burst_nr.set(t1, t2, t3, 0); d_burst_nr++; /* Consume samples up to the next guard period */ consume_each(burst_start + BURST_SIZE * d_OSR + 4 * d_OSR); /* Update current state */ d_state = synchronized; } void receiver_impl::synchronized_handler(gr_complex *input, gr_vector_const_void_star &input_items, int noutput_items) { /** * In this state receiver is synchronized and it processes * bursts according to burst type for given burst number */ std::vector channel_imp_resp(CHAN_IMP_RESP_LENGTH * d_OSR); unsigned int inputs_to_process = d_cell_allocation.size(); unsigned char output_binary[BURST_SIZE]; burst_type b_type; int to_consume = 0; int offset = 0; if (d_process_uplink) inputs_to_process *= 2; /* Process all connected inputs */ for (int input_nr = 0; input_nr < inputs_to_process; input_nr++) { input = (gr_complex *) input_items[input_nr]; double signal_pwr = 0; for (int ii = GUARD_PERIOD; ii < TS_BITS; ii++) signal_pwr += abs(input[ii]) * abs(input[ii]); signal_pwr = signal_pwr / (TS_BITS); d_signal_dbm = round(10 * log10(signal_pwr / 50)); if (input_nr == 0) d_c0_signal_dbm = d_signal_dbm; /* Get burst type for given burst number */ b_type = input_nr == 0 ? d_channel_conf.get_burst_type(d_burst_nr) : normal_or_noise; /* Process burst according to its type */ switch (b_type) { case fcch_burst: { if (d_freq_offset_tag_in_fcch) break; /* Send all-zero sequence message */ send_burst(d_burst_nr, fc_fb, GSMTAP_BURST_FCCH, input_nr); /* Extract frequency offset */ const unsigned first_sample = ceil((GUARD_PERIOD + 2 * TAIL_BITS) * d_OSR) + 1; const unsigned last_sample = first_sample + USEFUL_BITS * d_OSR - TAIL_BITS * d_OSR; double freq_offset_tmp = compute_freq_offset(input, first_sample, last_sample); /* Frequency correction loop */ pmt::pmt_t msg = pmt::make_tuple( pmt::mp("freq_offset"), pmt::from_double(freq_offset_tmp - d_freq_offset_setting), pmt::mp("synchronized")); message_port_pub(pmt::mp("measurements"), msg); break; } case sch_burst: { int d_ncc, d_bcc; int t1, t2, t3; int rc; /* Get channel impulse response */ d_c0_burst_start = get_sch_chan_imp_resp(input, &channel_imp_resp[0]); /* Perform MLSE detection */ detect_burst(input, &channel_imp_resp[0], d_c0_burst_start, output_binary); /* Compose a message with GSMTAP header and bits */ send_burst(d_burst_nr, output_binary, GSMTAP_BURST_SCH, input_nr); /* Attempt to decode SCH burst */ rc = decode_sch(&output_binary[3], &t1, &t2, &t3, &d_ncc, &d_bcc); if (rc) { if (++d_failed_sch >= MAX_SCH_ERRORS) { /* We have to resynchronize, change state */ d_state = fcch_search; /* Frequency correction loop */ pmt::pmt_t msg = pmt::make_tuple(pmt::mp("freq_offset"), pmt::from_double(0.0),pmt::mp("sync_loss")); message_port_pub(pmt::mp("measurements"), msg); } break; } /** * Decoding was successful, now * compute offset from burst_start, * burst should start after a guard period. */ offset = d_c0_burst_start - floor((GUARD_PERIOD) * d_OSR); to_consume += offset; d_failed_sch = 0; break; } case normal_burst: { float normal_corr_max; /** * Get channel impulse response for given * training sequence number - d_bcc */ d_c0_burst_start = get_norm_chan_imp_resp(input, &channel_imp_resp[0], &normal_corr_max, d_bcc); /* Perform MLSE detection */ detect_burst(input, &channel_imp_resp[0], d_c0_burst_start, output_binary); /* Compose a message with GSMTAP header and bits */ send_burst(d_burst_nr, output_binary, GSMTAP_BURST_NORMAL, input_nr); break; } case dummy_or_normal: { unsigned int normal_burst_start, dummy_burst_start; float dummy_corr_max, normal_corr_max; dummy_burst_start = get_norm_chan_imp_resp(input, &channel_imp_resp[0], &dummy_corr_max, TS_DUMMY); normal_burst_start = get_norm_chan_imp_resp(input, &channel_imp_resp[0], &normal_corr_max, d_bcc); if (normal_corr_max > dummy_corr_max) { d_c0_burst_start = normal_burst_start; /* Perform MLSE detection */ detect_burst(input, &channel_imp_resp[0], normal_burst_start, output_binary); /* Compose a message with GSMTAP header and bits */ send_burst(d_burst_nr, output_binary, GSMTAP_BURST_NORMAL, input_nr); } else { d_c0_burst_start = dummy_burst_start; /* Compose a message with GSMTAP header and bits */ send_burst(d_burst_nr, dummy_burst, GSMTAP_BURST_DUMMY, input_nr); } break; } case normal_or_noise: { std::vector v(input, input + noutput_items); float normal_corr_max = -1e6; float normal_corr_max_tmp; unsigned int burst_start; int max_tn, tseq_num; if (d_tseq_nums.size() == 0) { /** * There is no information about training sequence, * however the receiver can detect it with use of a * very simple algorithm based on finding */ get_norm_chan_imp_resp(input, &channel_imp_resp[0], &normal_corr_max, 0); float ts_max = normal_corr_max; int ts_max_num = 0; for (int ss = 1; ss <= 7; ss++) { get_norm_chan_imp_resp(input, &channel_imp_resp[0], &normal_corr_max, ss); if (ts_max < normal_corr_max) { ts_max = normal_corr_max; ts_max_num = ss; } } d_tseq_nums.push_back(ts_max_num); } /* Choose proper training sequence number */ tseq_num = input_nr <= d_tseq_nums.size() ? d_tseq_nums[input_nr - 1] : d_tseq_nums.back(); /* Get channel impulse response */ burst_start = get_norm_chan_imp_resp(input, &channel_imp_resp[0], &normal_corr_max, tseq_num); /* Perform MLSE detection */ detect_burst(input, &channel_imp_resp[0], burst_start, output_binary); /* Compose a message with GSMTAP header and bits */ send_burst(d_burst_nr, output_binary, GSMTAP_BURST_NORMAL, input_nr); break; } case dummy: send_burst(d_burst_nr, dummy_burst, GSMTAP_BURST_DUMMY, input_nr); break; case rach_burst: case empty: /* Do nothing */ break; } if (input_nr == input_items.size() - 1) { /* Go to the next burst */ d_burst_nr++; /* Consume samples of the burst up to next guard period */ to_consume += TS_BITS * d_OSR + d_burst_nr.get_offset(); consume_each(to_consume); } } } bool receiver_impl::find_fcch_burst(const gr_complex *input, const int nitems, double &computed_freq_offset) { /* Circular buffer used to scan through signal to find */ boost::circular_buffer phase_diff_buffer(FCCH_HITS_NEEDED * d_OSR); boost::circular_buffer::iterator buffer_iter; float lowest_max_min_diff; float phase_diff; /* Best match for FCCH burst */ float min_phase_diff; float max_phase_diff; double best_sum = 0; gr_complex conjprod; int start_pos; int hit_count; int miss_count; int sample_number = 0; int to_consume = 0; bool result = false; bool end = false; /* Possible states of FCCH search algorithm */ enum states { init, /* initialize variables */ search, /* search for positive samples */ found_something, /* search for FCCH and the best position of it */ fcch_found, /* when FCCH was found */ search_fail /* when there is no FCCH in the input vector */ } fcch_search_state; /* Set initial state */ fcch_search_state = init; while (!end) { switch (fcch_search_state) { case init: { hit_count = 0; miss_count = 0; start_pos = -1; lowest_max_min_diff = 99999; phase_diff_buffer.clear(); /* Change current state */ fcch_search_state = search; break; } case search: { sample_number++; if (sample_number > nitems - FCCH_HITS_NEEDED * d_OSR) { /** * If it isn't possible to find FCCH, because * there is too few samples left to look into, * don't do anything with those samples which are left * and consume only those which were checked */ to_consume = sample_number; fcch_search_state = search_fail; break; } phase_diff = compute_phase_diff(input[sample_number], input[sample_number - 1]); /** * If a positive phase difference was found * switch to state in which searches for FCCH */ if (phase_diff > 0) { to_consume = sample_number; fcch_search_state = found_something; } else { fcch_search_state = search; } break; } case found_something: { if (phase_diff > 0) hit_count++; else miss_count++; if ((miss_count >= FCCH_MAX_MISSES * d_OSR) && (hit_count <= FCCH_HITS_NEEDED * d_OSR)) { /* If miss_count exceeds limit before hit_count */ fcch_search_state = init; continue; } if (((miss_count >= FCCH_MAX_MISSES * d_OSR) && (hit_count > FCCH_HITS_NEEDED * d_OSR)) || (hit_count > 2 * FCCH_HITS_NEEDED * d_OSR)) { /** * If hit_count and miss_count exceeds * limit then FCCH was found */ fcch_search_state = fcch_found; continue; } if ((miss_count < FCCH_MAX_MISSES * d_OSR) && (hit_count > FCCH_HITS_NEEDED * d_OSR)) { /** * Find difference between minimal and maximal * element in the buffer. For FCCH this value * should be low. This part is searching for * a region where this value is lowest. */ min_phase_diff = *(min_element(phase_diff_buffer.begin(), phase_diff_buffer.end())); max_phase_diff = *(max_element(phase_diff_buffer.begin(), phase_diff_buffer.end())); if (lowest_max_min_diff > max_phase_diff - min_phase_diff) { lowest_max_min_diff = max_phase_diff - min_phase_diff; start_pos = sample_number - FCCH_HITS_NEEDED * d_OSR - FCCH_MAX_MISSES * d_OSR; best_sum = 0; for (buffer_iter = phase_diff_buffer.begin(); buffer_iter != (phase_diff_buffer.end()); buffer_iter++) { /* Store best value of phase offset sum */ best_sum += *buffer_iter - (M_PI / 2) / d_OSR; } } } /* If there is no single sample left to check */ if (++sample_number >= nitems) { fcch_search_state = search_fail; continue; } phase_diff = compute_phase_diff(input[sample_number], input[sample_number-1]); phase_diff_buffer.push_back(phase_diff); fcch_search_state = found_something; break; } case fcch_found: { /* Consume one FCCH burst */ to_consume = start_pos + FCCH_HITS_NEEDED * d_OSR + 1; d_fcch_start_pos = d_counter + start_pos; /** * Compute frequency offset * * 1625000.0 / 6 - GMSK symbol rate in GSM */ double phase_offset = best_sum / FCCH_HITS_NEEDED; double freq_offset = phase_offset * 1625000.0 / 6 / (2 * M_PI); computed_freq_offset = freq_offset; end = true; result = true; break; } case search_fail: end = true; result = false; break; } } d_counter += to_consume; consume_each(to_consume); return result; } double receiver_impl::compute_freq_offset(const gr_complex * input, unsigned first_sample, unsigned last_sample) { double phase_sum = 0; unsigned ii; for (ii = first_sample; ii < last_sample; ii++) { double phase_diff = compute_phase_diff(input[ii], input[ii-1]) - (M_PI / 2) / d_OSR; phase_sum += phase_diff; } double phase_offset = phase_sum / (last_sample - first_sample); double freq_offset = phase_offset * 1625000.0 / (12.0 * M_PI); return freq_offset; } inline float receiver_impl::compute_phase_diff(gr_complex val1, gr_complex val2) { gr_complex conjprod = val1 * conj(val2); return fast_atan2f(imag(conjprod), real(conjprod)); } bool receiver_impl::reach_sch_burst(const int nitems) { /* It just consumes samples to get near to a SCH burst */ int to_consume = 0; bool result = false; unsigned sample_nr = d_fcch_start_pos + (FRAME_BITS - SAFETY_MARGIN) * d_OSR; /* Consume samples until d_counter will be equal to sample_nr */ if (d_counter < sample_nr) { to_consume = d_counter + nitems >= sample_nr ? sample_nr - d_counter : nitems; } else { to_consume = 0; result = true; } d_counter += to_consume; consume_each(to_consume); return result; } int receiver_impl::get_sch_chan_imp_resp(const gr_complex *input, gr_complex * chan_imp_resp) { std::vector correlation_buffer; std::vector window_energy_buffer; std::vector power_buffer; int chan_imp_resp_center = 0; int strongest_window_nr; int burst_start; float energy = 0; int len = (SYNC_POS + SYNC_SEARCH_RANGE) * d_OSR; for (int ii = SYNC_POS * d_OSR; ii < len; ii++) { gr_complex correlation = correlate_sequence(&d_sch_training_seq[5], N_SYNC_BITS - 10, &input[ii]); correlation_buffer.push_back(correlation); power_buffer.push_back(std::pow(abs(correlation), 2)); } /* Compute window energies */ std::vector::iterator iter = power_buffer.begin(); while (iter != power_buffer.end()) { std::vector::iterator iter_ii = iter; bool loop_end = false; energy = 0; for (int ii = 0; ii < (d_chan_imp_length) * d_OSR; ii++, iter_ii++) { if (iter_ii == power_buffer.end()) { loop_end = true; break; } energy += (*iter_ii); } if (loop_end) break; window_energy_buffer.push_back(energy); iter++; } strongest_window_nr = max_element(window_energy_buffer.begin(), window_energy_buffer.end()) - window_energy_buffer.begin(); #if 0 d_channel_imp_resp.clear(); #endif float max_correlation = 0; for (int ii = 0; ii < (d_chan_imp_length) * d_OSR; ii++) { gr_complex correlation = correlation_buffer[strongest_window_nr + ii]; if (abs(correlation) > max_correlation) { chan_imp_resp_center = ii; max_correlation = abs(correlation); } #if 0 d_channel_imp_resp.push_back(correlation); #endif chan_imp_resp[ii] = correlation; } burst_start = strongest_window_nr + chan_imp_resp_center - 48 * d_OSR - 2 * d_OSR + 2 + SYNC_POS * d_OSR; return burst_start; } void receiver_impl::detect_burst(const gr_complex * input, gr_complex * chan_imp_resp, int burst_start, unsigned char * output_binary) { std::vector rhh_temp(CHAN_IMP_RESP_LENGTH * d_OSR); unsigned int stop_states[2] = {4, 12}; gr_complex filtered_burst[BURST_SIZE]; gr_complex rhh[CHAN_IMP_RESP_LENGTH]; float output[BURST_SIZE]; int start_state = 3; autocorrelation(chan_imp_resp, &rhh_temp[0], d_chan_imp_length*d_OSR); for (int ii = 0; ii < d_chan_imp_length; ii++) rhh[ii] = conj(rhh_temp[ii*d_OSR]); mafi(&input[burst_start], BURST_SIZE, chan_imp_resp, d_chan_imp_length * d_OSR, filtered_burst); viterbi_detector(filtered_burst, BURST_SIZE, rhh, start_state, stop_states, 2, output); for (int i = 0; i < BURST_SIZE; i++) output_binary[i] = output[i] > 0; } void receiver_impl::gmsk_mapper(const unsigned char * input, int nitems, gr_complex * gmsk_output, gr_complex start_point) { gr_complex j = gr_complex(0.0, 1.0); gmsk_output[0] = start_point; int previous_symbol = 2 * input[0] - 1; int current_symbol; int encoded_symbol; for (int i = 1; i < nitems; i++) { /* Change bits representation to NRZ */ current_symbol = 2 * input[i] - 1; /* Differentially encode */ encoded_symbol = current_symbol * previous_symbol; /* And do GMSK mapping */ gmsk_output[i] = j * gr_complex(encoded_symbol, 0.0) * gmsk_output[i-1]; previous_symbol = current_symbol; } } gr_complex receiver_impl::correlate_sequence(const gr_complex * sequence, int length, const gr_complex * input) { gr_complex result(0.0, 0.0); for (int ii = 0; ii < length; ii++) result += sequence[ii] * conj(input[ii * d_OSR]); return result / gr_complex(length, 0); } /* Computes autocorrelation for positive arguments */ inline void receiver_impl::autocorrelation(const gr_complex * input, gr_complex * out, int nitems) { for (int k = nitems - 1; k >= 0; k--) { out[k] = gr_complex(0, 0); for (int i = k; i < nitems; i++) out[k] += input[i] * conj(input[i - k]); } } inline void receiver_impl::mafi(const gr_complex * input, int nitems, gr_complex * filter, int filter_length, gr_complex * output) { for (int n = 0; n < nitems; n++) { int a = n * d_OSR; output[n] = 0; for (int ii = 0; ii < filter_length; ii++) { if ((a + ii) >= nitems * d_OSR) break; output[n] += input[a + ii] * filter[ii]; } } } /* Especially computations of strongest_window_nr */ int receiver_impl::get_norm_chan_imp_resp(const gr_complex *input, gr_complex *chan_imp_resp, float *corr_max, int bcc) { std::vector correlation_buffer; std::vector window_energy_buffer; std::vector power_buffer; int search_center = (int) (TRAIN_POS + GUARD_PERIOD) * d_OSR; int search_start_pos = search_center + 1 - 5 * d_OSR; int search_stop_pos = search_center + d_chan_imp_length * d_OSR + 5 * d_OSR; for (int ii = search_start_pos; ii < search_stop_pos; ii++) { gr_complex correlation = correlate_sequence( &d_norm_training_seq[bcc][TRAIN_BEGINNING], N_TRAIN_BITS - 10, &input[ii]); correlation_buffer.push_back(correlation); power_buffer.push_back(std::pow(abs(correlation), 2)); } #if 0 plot(power_buffer); #endif /* Compute window energies */ std::vector::iterator iter = power_buffer.begin(); while (iter != power_buffer.end()) { std::vector::iterator iter_ii = iter; bool loop_end = false; float energy = 0; int len = d_chan_imp_length * d_OSR; for (int ii = 0; ii < len; ii++, iter_ii++) { if (iter_ii == power_buffer.end()) { loop_end = true; break; } energy += (*iter_ii); } if (loop_end) break; window_energy_buffer.push_back(energy); iter++; } /* Calculate the strongest window number */ int strongest_window_nr = max_element(window_energy_buffer.begin(), window_energy_buffer.end() - d_chan_imp_length * d_OSR) - window_energy_buffer.begin(); if (strongest_window_nr < 0) strongest_window_nr = 0; float max_correlation = 0; for (int ii = 0; ii < d_chan_imp_length * d_OSR; ii++) { gr_complex correlation = correlation_buffer[strongest_window_nr + ii]; if (abs(correlation) > max_correlation) max_correlation = abs(correlation); #if 0 d_channel_imp_resp.push_back(correlation); #endif chan_imp_resp[ii] = correlation; } *corr_max = max_correlation; /** * Compute first sample position, which corresponds * to the first sample of the impulse response */ return search_start_pos + strongest_window_nr - TRAIN_POS * d_OSR; } void receiver_impl::send_burst(burst_counter burst_nr, const unsigned char * burst_binary, uint8_t burst_type, unsigned int input_nr) { /* Buffer for GSMTAP header and burst */ uint8_t buf[sizeof(gsmtap_hdr) + BURST_SIZE]; uint32_t frame_number; uint16_t arfcn; uint8_t tn; /* Set pointers to GSMTAP header and burst inside buffer */ struct gsmtap_hdr *tap_header = (struct gsmtap_hdr *) buf; uint8_t *burst = buf + sizeof(gsmtap_hdr); tap_header->version = GSMTAP_VERSION; tap_header->hdr_len = sizeof(gsmtap_hdr) / 4; tap_header->type = GSMTAP_TYPE_UM_BURST; tap_header->sub_type = burst_type; bool dl_burst = !(input_nr >= d_cell_allocation.size()); if (dl_burst) { tn = static_cast(d_burst_nr.get_timeslot_nr()); frame_number = htobe32(d_burst_nr.get_frame_nr()); arfcn = htobe16(d_cell_allocation[input_nr]); } else { input_nr -= d_cell_allocation.size(); tn = static_cast (d_burst_nr.subtract_timeslots(3).get_timeslot_nr()); frame_number = htobe32( d_burst_nr.subtract_timeslots(3).get_frame_nr()); arfcn = htobe16( d_cell_allocation[input_nr] | GSMTAP_ARFCN_F_UPLINK); } tap_header->frame_number = frame_number; tap_header->timeslot = tn; tap_header->arfcn = arfcn; tap_header->signal_dbm = static_cast(d_signal_dbm); tap_header->snr_db = 0; /* FIXME: Can we calculate this? */ /* Copy burst to the buffer */ memcpy(burst, burst_binary, BURST_SIZE); /* Allocate a new message */ pmt::pmt_t blob = pmt::make_blob(buf, sizeof(gsmtap_hdr) + BURST_SIZE); pmt::pmt_t msg = pmt::cons(pmt::PMT_NIL, blob); /* Send message */ if (input_nr == 0) message_port_pub(pmt::mp("C0"), msg); else message_port_pub(pmt::mp("CX"), msg); } void receiver_impl::configure_receiver(void) { d_channel_conf.set_multiframe_type(TIMESLOT0, multiframe_51); d_channel_conf.set_burst_types(TIMESLOT0, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal); d_channel_conf.set_burst_types(TIMESLOT0, TEST_CCH_FRAMES, sizeof(TEST_CCH_FRAMES) / sizeof(unsigned), dummy_or_normal); d_channel_conf.set_burst_types(TIMESLOT0, FCCH_FRAMES, sizeof(FCCH_FRAMES) / sizeof(unsigned), fcch_burst); d_channel_conf.set_burst_types(TIMESLOT0, SCH_FRAMES, sizeof(SCH_FRAMES) / sizeof(unsigned), sch_burst); d_channel_conf.set_multiframe_type(TIMESLOT1, multiframe_51); d_channel_conf.set_burst_types(TIMESLOT1, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal); d_channel_conf.set_multiframe_type(TIMESLOT2, multiframe_51); d_channel_conf.set_burst_types(TIMESLOT2, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal); d_channel_conf.set_multiframe_type(TIMESLOT3, multiframe_51); d_channel_conf.set_burst_types(TIMESLOT3, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal); d_channel_conf.set_multiframe_type(TIMESLOT4, multiframe_51); d_channel_conf.set_burst_types(TIMESLOT4, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal); d_channel_conf.set_multiframe_type(TIMESLOT5, multiframe_51); d_channel_conf.set_burst_types(TIMESLOT5, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal); d_channel_conf.set_multiframe_type(TIMESLOT6, multiframe_51); d_channel_conf.set_burst_types(TIMESLOT6, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal); d_channel_conf.set_multiframe_type(TIMESLOT7, multiframe_51); d_channel_conf.set_burst_types(TIMESLOT7, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal); } void receiver_impl::set_cell_allocation( const std::vector &cell_allocation) { d_cell_allocation = cell_allocation; } void receiver_impl::set_tseq_nums(const std::vector &tseq_nums) { d_tseq_nums = tseq_nums; } void receiver_impl::reset(void) { d_state = fcch_search; } } /* namespace gsm */ } /* namespace gr */ gr-gsm-0.41.2/lib/receiver/receiver_impl.h000066400000000000000000000230171316153413000203420ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2009-2017 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GSM_RECEIVER_IMPL_H #define INCLUDED_GSM_RECEIVER_IMPL_H #include #include #include #include #include namespace gr { namespace gsm { class receiver_impl : public receiver { private: unsigned int d_c0_burst_start; float d_c0_signal_dbm; /**@name Configuration of the receiver */ //@{ const int d_OSR; ///< oversampling ratio bool d_process_uplink; const int d_chan_imp_length; ///< channel impulse length float d_signal_dbm; std::vector d_tseq_nums; ///< stores training sequence numbers for channels different than C0 std::vector d_cell_allocation; ///< stores cell allocation - absolute rf channel numbers (ARFCNs) assigned to the given cell. The variable should at least contain C0 channel number. //@} gr_complex d_sch_training_seq[N_SYNC_BITS]; /// d_freq_offset_vals; /**@name Identifiers of the BTS extracted from the SCH burst */ //@{ int d_ncc; ///< network color code int d_bcc; ///< base station color code //@} /**@name Internal state of the gsm receiver */ //@{ enum states { fcch_search, sch_search, // synchronization search part synchronized // receiver is synchronized in this state } d_state; //@} /**@name Variables which make internal state in the "synchronized" state */ //@{ burst_counter d_burst_nr; ///< frame number and timeslot number channel_configuration d_channel_conf; ///< mapping of burst_counter to burst_type //@} unsigned d_failed_sch; ///< number of subsequent erroneous SCH bursts /** Function whis is used to search a FCCH burst and to compute frequency offset before * "synchronized" state of the receiver * * @param input vector with input signal * @param nitems number of samples in the input vector * @return */ bool find_fcch_burst(const gr_complex *input, const int nitems, double & computed_freq_offset); /** Computes frequency offset from FCCH burst samples * * @param[in] input vector with input samples * @param[in] first_sample number of the first sample of the FCCH busrt * @param[in] last_sample number of the last sample of the FCCH busrt * @param[out] computed_freq_offset contains frequency offset estimate if FCCH burst was located * @return true if frequency offset was faound */ double compute_freq_offset(const gr_complex * input, unsigned first_sample, unsigned last_sample); /** Computes angle between two complex numbers * * @param val1 first complex number * @param val2 second complex number * @return */ inline float compute_phase_diff(gr_complex val1, gr_complex val2); /** Function whis is used to get near to SCH burst * * @param nitems number of samples in the gsm_receiver's buffer * @return true if SCH burst is near, false otherwise */ bool reach_sch_burst(const int nitems); /** Extracts channel impulse response from a SCH burst and computes first sample number of this burst * * @param input vector with input samples * @param chan_imp_resp complex vector where channel impulse response will be stored * @return number of first sample of the burst */ int get_sch_chan_imp_resp(const gr_complex *input, gr_complex * chan_imp_resp); /** MLSE detection of a burst bits * * Detects bits of burst using viterbi algorithm. * @param input vector with input samples * @param chan_imp_resp vector with the channel impulse response * @param burst_start number of the first sample of the burst * @param output_binary vector with output bits */ void detect_burst(const gr_complex * input, gr_complex * chan_imp_resp, int burst_start, unsigned char * output_binary); /** Encodes differentially input bits and maps them into MSK states * * @param input vector with input bits * @param nitems number of samples in the "input" vector * @param gmsk_output bits mapped into MSK states * @param start_point first state */ void gmsk_mapper(const unsigned char * input, int nitems, gr_complex * gmsk_output, gr_complex start_point); /** Correlates MSK mapped sequence with input signal * * @param sequence MKS mapped sequence * @param length length of the sequence * @param input_signal vector with input samples * @return correlation value */ gr_complex correlate_sequence(const gr_complex * sequence, int length, const gr_complex * input); /** Computes autocorrelation of input vector for positive arguments * * @param input vector with input samples * @param out output vector * @param nitems length of the input vector */ inline void autocorrelation(const gr_complex * input, gr_complex * out, int nitems); /** Filters input signal through channel impulse response * * @param input vector with input samples * @param nitems number of samples to pass through filter * @param filter filter taps - channel impulse response * @param filter_length nember of filter taps * @param output vector with filtered samples */ inline void mafi(const gr_complex * input, int nitems, gr_complex * filter, int filter_length, gr_complex * output); /** Extracts channel impulse response from a normal burst and computes first sample number of this burst * * @param input vector with input samples * @param chan_imp_resp complex vector where channel impulse response will be stored * @param search_range possible absolute offset of a channel impulse response start * @param bcc base station color code - number of a training sequence * @return first sample number of normal burst */ int get_norm_chan_imp_resp(const gr_complex *input, gr_complex * chan_imp_resp, float *corr_max, int bcc); /** * Sends burst through a C0 (for burst from C0 channel) or Cx (for other bursts) message port * * @param burst_nr - frame number of the burst * @param burst_binary - content of the burst * @b_type - type of the burst */ void send_burst(burst_counter burst_nr, const unsigned char * burst_binary, uint8_t burst_type, unsigned int input_nr); /** * Configures burst types in different channels */ void configure_receiver(); /* State machine handlers */ void fcch_search_handler(gr_complex *input, int noutput_items); void sch_search_handler(gr_complex *input, int noutput_items); void synchronized_handler(gr_complex *input, gr_vector_const_void_star &input_items, int noutput_items); public: receiver_impl(int osr, const std::vector &cell_allocation, const std::vector &tseq_nums, bool process_uplink); ~receiver_impl(); int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); virtual void set_cell_allocation(const std::vector &cell_allocation); virtual void set_tseq_nums(const std::vector & tseq_nums); virtual void reset(); }; } // namespace gsm } // namespace gr #endif /* INCLUDED_GSM_RECEIVER_IMPL_H */ gr-gsm-0.41.2/lib/receiver/sch.h000066400000000000000000000020531316153413000162670ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2014 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef __SCH_H__ #define __SCH_H__ 1 #include #ifdef __cplusplus extern "C" { #endif GRGSM_API int decode_sch(const unsigned char *buf, int * t1_o, int * t2_o, int * t3_o, int * ncc, int * bcc); #ifdef __cplusplus } #endif #endif gr-gsm-0.41.2/lib/receiver/viterbi_detector.cc000066400000000000000000000441541316153413000212150ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2009 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ /* * viterbi_detector: * This part does the detection of received sequnece. * Employed algorithm is viterbi Maximum Likehood Sequence Estimation. * At this moment it gives hard decisions on the output, but * it was designed with soft decisions in mind. * * SYNTAX: void viterbi_detector( * const gr_complex * input, * unsigned int samples_num, * gr_complex * rhh, * unsigned int start_state, * const unsigned int * stop_states, * unsigned int stops_num, * float * output) * * INPUT: input: Complex received signal afted matched filtering. * samples_num: Number of samples in the input table. * rhh: The autocorrelation of the estimated channel * impulse response. * start_state: Number of the start point. In GSM each burst * starts with sequence of three bits (0,0,0) which * indicates start point of the algorithm. * stop_states: Table with numbers of possible stop states. * stops_num: Number of possible stop states * * * OUTPUT: output: Differentially decoded hard output of the algorithm: * -1 for logical "0" and 1 for logical "1" * * SUB_FUNC: none * * TEST(S): Tested with real world normal burst. */ #include #include #include #define PATHS_NUM (1 << (CHAN_IMP_RESP_LENGTH-1)) void viterbi_detector(const gr_complex * input, unsigned int samples_num, gr_complex * rhh, unsigned int start_state, const unsigned int * stop_states, unsigned int stops_num, float * output) { float increment[8]; float path_metrics1[16]; float path_metrics2[16]; float paths_difference; float * new_path_metrics; float * old_path_metrics; float * tmp; float trans_table[BURST_SIZE][16]; float pm_candidate1, pm_candidate2; bool real_imag; float input_symbol_real, input_symbol_imag; unsigned int i, sample_nr; /* * Setup first path metrics, so only state pointed by start_state is possible. * Start_state metric is equal to zero, the rest is written with some very low value, * which makes them practically impossible to occur. */ for(i=0; i max_stop_state_metric){ max_stop_state_metric = stop_state_metric; best_stop_state = stop_states[i]; } } /* * This table was generated with hope that it gives a litle speedup during * traceback stage. * Received bit is related to the number of state in the trellis. * I've numbered states so their parity (number of ones) is related * to a received bit. */ static const unsigned int parity_table[PATHS_NUM] = { 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, }; /* * Table of previous states in the trellis diagram. * For GMSK modulation every state has two previous states. * Example: * previous_state_nr1 = prev_table[current_state_nr][0] * previous_state_nr2 = prev_table[current_state_nr][1] */ static const unsigned int prev_table[PATHS_NUM][2] = { {0,8}, {0,8}, {1,9}, {1,9}, {2,10}, {2,10}, {3,11}, {3,11}, {4,12}, {4,12}, {5,13}, {5,13}, {6,14}, {6,14}, {7,15}, {7,15}, }; /* * Traceback and differential decoding of received sequence. * Decisions stored in trans_table are used to restore best path in the trellis. */ sample_nr=samples_num; unsigned int state_nr=best_stop_state; unsigned int decision; bool out_bit=0; while(sample_nr>0){ sample_nr--; decision = (trans_table[sample_nr][state_nr]>0); if(decision != out_bit) output[sample_nr]=-trans_table[sample_nr][state_nr]; else output[sample_nr]=trans_table[sample_nr][state_nr]; out_bit = out_bit ^ real_imag ^ parity_table[state_nr]; state_nr = prev_table[state_nr][decision]; real_imag = !real_imag; } } gr-gsm-0.41.2/lib/receiver/viterbi_detector.h000066400000000000000000000052601316153413000210520ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2009 Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ /* * viterbi_detector: * This part does the detection of received sequnece. * Employed algorithm is viterbi Maximum Likehood Sequence Estimation. * At this moment it gives hard decisions on the output, but * it was designed with soft decisions in mind. * * SYNTAX: void viterbi_detector( * const gr_complex * input, * unsigned int samples_num, * gr_complex * rhh, * unsigned int start_state, * const unsigned int * stop_states, * unsigned int stops_num, * float * output) * * INPUT: input: Complex received signal afted matched filtering. * samples_num: Number of samples in the input table. * rhh: The autocorrelation of the estimated channel * impulse response. * start_state: Number of the start point. In GSM each burst * starts with sequence of three bits (0,0,0) which * indicates start point of the algorithm. * stop_states: Table with numbers of possible stop states. * stops_num: Number of possible stop states * * * OUTPUT: output: Differentially decoded hard output of the algorithm: * -1 for logical "0" and 1 for logical "1" * * SUB_FUNC: none * * TEST(S): Tested with real world normal burst. */ #ifndef INCLUDED_VITERBI_DETECTOR_H #define INCLUDED_VITERBI_DETECTOR_H void viterbi_detector(const gr_complex * input, unsigned int samples_num, gr_complex * rhh, unsigned int start_state, const unsigned int * stop_states, unsigned int stops_num, float * output); #endif /* INCLUDED_VITERBI_DETECTOR_H */ gr-gsm-0.41.2/python/000077500000000000000000000000001316153413000143105ustar00rootroot00000000000000gr-gsm-0.41.2/python/CMakeLists.txt000066400000000000000000000060441316153413000170540ustar00rootroot00000000000000# Copyright 2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. ######################################################################## # Include python install macros ######################################################################## include(GrPython) if(NOT PYTHONINTERP_FOUND) return() endif() ######################################################################## # Install python sources ######################################################################## add_subdirectory(misc_utils) add_subdirectory(receiver) add_subdirectory(demapping) GR_PYTHON_INSTALL( FILES __init__.py DESTINATION ${GR_PYTHON_DIR}/grgsm ) ######################################################################## # Handle the unit tests ######################################################################## include(GrTest) set(GR_TEST_TARGET_DEPS gr-gsm) set(GR_TEST_PYTHON_DIRS ${CMAKE_BINARY_DIR}/swig:${CMAKE_BINARY_DIR}/python/misc_utils) GR_ADD_TEST(qa_arfcn ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_arfcn.py) GR_ADD_TEST(qa_decryption ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_decryption.py) GR_ADD_TEST(qa_burst_printer ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_burst_printer.py) GR_ADD_TEST(qa_message_printer ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_message_printer.py) GR_ADD_TEST(qa_burst_timeslot_splitter ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_burst_timeslot_splitter.py) GR_ADD_TEST(qa_burst_sdcch_subslot_splitter ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_burst_sdcch_subslot_splitter.py) GR_ADD_TEST(qa_burst_timeslot_filter ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_burst_timeslot_filter.py) GR_ADD_TEST(qa_burst_sdcch_subslot_filter ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_burst_sdcch_subslot_filter.py) GR_ADD_TEST(qa_burst_fnr_filter ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_burst_fnr_filter.py) GR_ADD_TEST(qa_dummy_burst_filter ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_dummy_burst_filter.py) #GR_ADD_TEST(qa_msg_to_tag ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_msg_to_tag.py) #GR_ADD_TEST(qa_controlled_fractional_resampler_cc ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_controlled_fractional_resampler_cc.py) #GR_ADD_TEST(qa_uplink_downlink_splitter ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_uplink_downlink_splitter.py) gr-gsm-0.41.2/python/__init__.py000066400000000000000000000043151316153413000164240ustar00rootroot00000000000000# # Copyright 2008,2009 Free Software Foundation, Inc. # # This application is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # This application is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # The presence of this file turns this directory into a Python package ''' This is the GNU Radio GSM module. Place your Python package description here (python/__init__.py). ''' # ---------------------------------------------------------------- # Temporary workaround for ticket:181 (swig+python problem) import sys _RTLD_GLOBAL = 0 try: from dl import RTLD_GLOBAL as _RTLD_GLOBAL except ImportError: try: from DLFCN import RTLD_GLOBAL as _RTLD_GLOBAL except ImportError: pass if _RTLD_GLOBAL != 0: _dlopenflags = sys.getdlopenflags() sys.setdlopenflags(_dlopenflags|_RTLD_GLOBAL) # ---------------------------------------------------------------- # import swig generated symbols into the gsm namespace from grgsm_swig import * # import any pure python here from hier_block import hier_block from fcch_burst_tagger import fcch_burst_tagger from sch_detector import sch_detector from fcch_detector import fcch_detector from clock_offset_corrector_tagged import clock_offset_corrector_tagged from gsm_input import gsm_input from gsm_bcch_ccch_demapper import gsm_bcch_ccch_demapper from gsm_bcch_ccch_sdcch4_demapper import gsm_bcch_ccch_sdcch4_demapper from gsm_sdcch8_demapper import gsm_sdcch8_demapper import arfcn # # ---------------------------------------------------------------- # Tail of workaround if _RTLD_GLOBAL != 0: sys.setdlopenflags(_dlopenflags) # Restore original flags # ---------------------------------------------------------------- gr-gsm-0.41.2/python/build_utils.py000066400000000000000000000161051316153413000172040ustar00rootroot00000000000000# # Copyright 2004,2009,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # """Misc utilities used at build time """ import re, os, os.path from build_utils_codes import * # set srcdir to the directory that contains Makefile.am try: srcdir = os.environ['srcdir'] except KeyError, e: srcdir = "." srcdir = srcdir + '/' # set do_makefile to either true or false dependeing on the environment try: if os.environ['do_makefile'] == '0': do_makefile = False else: do_makefile = True except KeyError, e: do_makefile = False # set do_sources to either true or false dependeing on the environment try: if os.environ['do_sources'] == '0': do_sources = False else: do_sources = True except KeyError, e: do_sources = True name_dict = {} def log_output_name (name): (base, ext) = os.path.splitext (name) ext = ext[1:] # drop the leading '.' entry = name_dict.setdefault (ext, []) entry.append (name) def open_and_log_name (name, dir): global do_sources if do_sources: f = open (name, dir) else: f = None log_output_name (name) return f def expand_template (d, template_filename, extra = ""): '''Given a dictionary D and a TEMPLATE_FILENAME, expand template into output file ''' global do_sources output_extension = extract_extension (template_filename) template = open_src (template_filename, 'r') output_name = d['NAME'] + extra + '.' + output_extension log_output_name (output_name) if do_sources: output = open (output_name, 'w') do_substitution (d, template, output) output.close () template.close () def output_glue (dirname): output_makefile_fragment () output_ifile_include (dirname) def output_makefile_fragment (): global do_makefile if not do_makefile: return # overwrite the source, which must be writable; this should have been # checked for beforehand in the top-level Makefile.gen.gen . f = open (os.path.join (os.environ.get('gendir', os.environ.get('srcdir', '.')), 'Makefile.gen'), 'w') f.write ('#\n# This file is machine generated. All edits will be overwritten\n#\n') output_subfrag (f, 'h') output_subfrag (f, 'i') output_subfrag (f, 'cc') f.close () def output_ifile_include (dirname): global do_sources if do_sources: f = open ('%s_generated.i' % (dirname,), 'w') f.write ('//\n// This file is machine generated. All edits will be overwritten\n//\n') files = name_dict.setdefault ('i', []) files.sort () f.write ('%{\n') for file in files: f.write ('#include <%s>\n' % (file[0:-1] + 'h',)) f.write ('%}\n\n') for file in files: f.write ('%%include <%s>\n' % (file,)) def output_subfrag (f, ext): files = name_dict.setdefault (ext, []) files.sort () f.write ("GENERATED_%s =" % (ext.upper ())) for file in files: f.write (" \\\n\t%s" % (file,)) f.write ("\n\n") def extract_extension (template_name): # template name is something like: GrFIRfilterXXX.h.t # we return everything between the penultimate . and .t mo = re.search (r'\.([a-z]+)\.t$', template_name) if not mo: raise ValueError, "Incorrectly formed template_name '%s'" % (template_name,) return mo.group (1) def open_src (name, mode): global srcdir return open (os.path.join (srcdir, name), mode) def do_substitution (d, in_file, out_file): def repl (match_obj): key = match_obj.group (1) # print key return d[key] inp = in_file.read () out = re.sub (r"@([a-zA-Z0-9_]+)@", repl, inp) out_file.write (out) copyright = '''/* -*- c++ -*- */ /* * Copyright 2003,2004 Free Software Foundation, Inc. * * This file is part of GNU Radio * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU Radio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ ''' def is_complex (code3): if i_code (code3) == 'c' or o_code (code3) == 'c': return '1' else: return '0' def standard_dict (name, code3, package='gr'): d = {} d['NAME'] = name d['NAME_IMPL'] = name+'_impl' d['GUARD_NAME'] = 'INCLUDED_%s_%s_H' % (package.upper(), name.upper()) d['GUARD_NAME_IMPL'] = 'INCLUDED_%s_%s_IMPL_H' % (package.upper(), name.upper()) d['BASE_NAME'] = re.sub ('^' + package + '_', '', name) d['SPTR_NAME'] = '%s_sptr' % name d['WARNING'] = 'WARNING: this file is machine generated. Edits will be overwritten' d['COPYRIGHT'] = copyright d['TYPE'] = i_type (code3) d['I_TYPE'] = i_type (code3) d['O_TYPE'] = o_type (code3) d['TAP_TYPE'] = tap_type (code3) d['IS_COMPLEX'] = is_complex (code3) return d def standard_dict2 (name, code3, package): d = {} d['NAME'] = name d['BASE_NAME'] = name d['GUARD_NAME'] = 'INCLUDED_%s_%s_H' % (package.upper(), name.upper()) d['WARNING'] = 'WARNING: this file is machine generated. Edits will be overwritten' d['COPYRIGHT'] = copyright d['TYPE'] = i_type (code3) d['I_TYPE'] = i_type (code3) d['O_TYPE'] = o_type (code3) d['TAP_TYPE'] = tap_type (code3) d['IS_COMPLEX'] = is_complex (code3) return d def standard_impl_dict2 (name, code3, package): d = {} d['NAME'] = name d['IMPL_NAME'] = name d['BASE_NAME'] = name.rstrip("impl").rstrip("_") d['GUARD_NAME'] = 'INCLUDED_%s_%s_H' % (package.upper(), name.upper()) d['WARNING'] = 'WARNING: this file is machine generated. Edits will be overwritten' d['COPYRIGHT'] = copyright d['FIR_TYPE'] = "fir_filter_" + code3 d['CFIR_TYPE'] = "fir_filter_" + code3[0:2] + 'c' d['TYPE'] = i_type (code3) d['I_TYPE'] = i_type (code3) d['O_TYPE'] = o_type (code3) d['TAP_TYPE'] = tap_type (code3) d['IS_COMPLEX'] = is_complex (code3) return d gr-gsm-0.41.2/python/build_utils_codes.py000066400000000000000000000025571316153413000203670ustar00rootroot00000000000000# # Copyright 2004 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # def i_code (code3): return code3[0] def o_code (code3): if len (code3) >= 2: return code3[1] else: return code3[0] def tap_code (code3): if len (code3) >= 3: return code3[2] else: return code3[0] def i_type (code3): return char_to_type[i_code (code3)] def o_type (code3): return char_to_type[o_code (code3)] def tap_type (code3): return char_to_type[tap_code (code3)] char_to_type = {} char_to_type['s'] = 'short' char_to_type['i'] = 'int' char_to_type['f'] = 'float' char_to_type['c'] = 'gr_complex' char_to_type['b'] = 'unsigned char' gr-gsm-0.41.2/python/demapping/000077500000000000000000000000001316153413000162545ustar00rootroot00000000000000gr-gsm-0.41.2/python/demapping/CMakeLists.txt000066400000000000000000000016601316153413000210170ustar00rootroot00000000000000# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. GR_PYTHON_INSTALL( FILES gsm_bcch_ccch_demapper.py gsm_bcch_ccch_sdcch4_demapper.py gsm_sdcch8_demapper.py DESTINATION ${GR_PYTHON_DIR}/grgsm ) gr-gsm-0.41.2/python/demapping/gsm_bcch_ccch_demapper.py000066400000000000000000000065271316153413000232420ustar00rootroot00000000000000#!/usr/bin/env python2 # -*- coding: utf-8 -*- # @file # @author (C) 2016 by Piotr Krysik # @section LICENSE # # Gr-gsm is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Gr-gsm is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with gr-gsm; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # ################################################## # GNU Radio Python Flow Graph # Title: BCCH + CCCH demapper # Author: Piotr Krysik # Description: Demapper for BCCH + CCCH control channels. This corresponds to channel combination iv specified in GSM 05.02, section 6.4 # Generated: Mon May 23 09:32:44 2016 ################################################## from gnuradio import gr from gnuradio.filter import firdes import grgsm class gsm_bcch_ccch_demapper(grgsm.hier_block): def __init__(self, timeslot_nr=0): grgsm.hier_block.__init__( self, "BCCH + CCCH demapper", gr.io_signature(0, 0, 0), gr.io_signature(0, 0, 0), ) self.message_port_register_hier_in("bursts") self.message_port_register_hier_out("bursts") ################################################## # Parameters ################################################## self.timeslot_nr = timeslot_nr ################################################## # Blocks ################################################## self.gsm_universal_ctrl_chans_demapper_0 = grgsm.universal_ctrl_chans_demapper(timeslot_nr, ([0,0,2,2,2,2,6,6,6,6,0,0,12,12,12,12,16,16,16,16,0,0,22,22,22,22,26,26,26,26,0,0,32,32,32,32,36,36,36,36,0,0,42,42,42,42,46,46,46,46,0,]), ([0,0,1,1,1,1,2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,]), ([0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,0,0,3,3,3,3,4,4,4,4,0,0,5,5,5,5,6,6,6,6,0,0,7,7,7,7,8,8,8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,0,0,3,3,3,3,4,4,4,4,0,0,5,5,5,5,6,6,6,6,0,0,7,7,7,7,8,8,8,8,0]), ([0,0,0,0,0,0,6,6,6,6,10,10,10,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,37,37,37,41,41,41,41,0,0,47,47,47,47]), ([2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,0,0,2,2,2,2,]), ([0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,0,0,3,3,3,3,0,0,0,0,0,0,2,2,2,2,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,0,0,3,3,3,3])) ################################################## # Connections ################################################## self.msg_connect((self.gsm_universal_ctrl_chans_demapper_0, 'bursts'), (self, 'bursts')) self.msg_connect((self, 'bursts'), (self.gsm_universal_ctrl_chans_demapper_0, 'bursts')) def get_timeslot_nr(self): return self.timeslot_nr def set_timeslot_nr(self, timeslot_nr): self.timeslot_nr = timeslot_nr gr-gsm-0.41.2/python/demapping/gsm_bcch_ccch_sdcch4_demapper.py000066400000000000000000000066431316153413000244710ustar00rootroot00000000000000#!/usr/bin/env python2 # -*- coding: utf-8 -*- # @file # @author (C) 2016 by Piotr Krysik # @section LICENSE # # Gr-gsm is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Gr-gsm is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with gr-gsm; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # ################################################## # GNU Radio Python Flow Graph # Title: BCCH + CCCH + SDCCH/4 demapper # Author: Piotr Krysik # Description: Demapper for BCCH + CCCH + SDCCH/4 + SACCH/C4 control channels. This corresponds to channel combination v specified in GSM 05.02, section 6.4 # Generated: Mon May 23 09:32:46 2016 ################################################## from gnuradio import gr from gnuradio.filter import firdes import grgsm class gsm_bcch_ccch_sdcch4_demapper(grgsm.hier_block): def __init__(self, timeslot_nr=0): grgsm.hier_block.__init__( self, "BCCH + CCCH + SDCCH/4 demapper", gr.io_signature(0, 0, 0), gr.io_signature(0, 0, 0), ) self.message_port_register_hier_in("bursts") self.message_port_register_hier_out("bursts") ################################################## # Parameters ################################################## self.timeslot_nr = timeslot_nr ################################################## # Blocks ################################################## self.gsm_universal_ctrl_chans_demapper_0 = grgsm.universal_ctrl_chans_demapper(timeslot_nr, ([0,0,2,2,2,2,6,6,6,6,0,0,12,12,12,12,16,16,16,16,0,0,22,22,22,22,26,26,26,26,0,0,32,32,32,32,36,36,36,36,0,0,42,42,42,42,46,46,46,46,0]), ([0,0,1,1,1,1,2,2,2,2,0,0,2,2,2,2,2,2,2,2,0,0,7,7,7,7,7,7,7,7,0,0,7,7,7,7,7,7,7,7,0,0,135,135,135,135,135,135,135,135,0]), ([0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,0,0,0,0,0,0,1,1,1,1,0,0,2,2,2,2,3,3,3,3,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,0,0,0,0,0,0,1,1,1,1,0,0,2,2,2,2,3,3,3,3,0,0,2,2,2,2,3,3,3,3,0]), ([0,0,0,0,0,0,6,6,6,6,10,10,10,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,37,37,37,41,41,41,41,0,0,47,47,47,47]), ([7,7,7,7,0,0,135,135,135,135,135,135,135,135,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,7,7,7,7,7,7,7,0,0,7,7,7,7]), ([0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,0,0,3,3,3,3,0,0,0,0,0,0,2,2,2,2,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,0,0,3,3,3,3])) ################################################## # Connections ################################################## self.msg_connect((self.gsm_universal_ctrl_chans_demapper_0, 'bursts'), (self, 'bursts')) self.msg_connect((self, 'bursts'), (self.gsm_universal_ctrl_chans_demapper_0, 'bursts')) def get_timeslot_nr(self): return self.timeslot_nr def set_timeslot_nr(self, timeslot_nr): self.timeslot_nr = timeslot_nr gr-gsm-0.41.2/python/demapping/gsm_sdcch8_demapper.py000066400000000000000000000066511316153413000225350ustar00rootroot00000000000000#!/usr/bin/env python2 # -*- coding: utf-8 -*- # @file # @author (C) 2016 by Piotr Krysik # @section LICENSE # # Gr-gsm is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Gr-gsm is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with gr-gsm; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # ################################################## # GNU Radio Python Flow Graph # Title: SDCCH/8 demapper # Author: Piotr Krysik # Description: Demapper for SDCCH/8 + SACCH/C8 control channels. This corresponds to channel combination vii specified in GSM 05.02, section 6.4 # Generated: Mon May 23 09:32:48 2016 ################################################## from gnuradio import gr from gnuradio.filter import firdes import grgsm class gsm_sdcch8_demapper(grgsm.hier_block): def __init__(self, timeslot_nr=1): grgsm.hier_block.__init__( self, "SDCCH/8 demapper", gr.io_signature(0, 0, 0), gr.io_signature(0, 0, 0), ) self.message_port_register_hier_in("bursts") self.message_port_register_hier_out("bursts") ################################################## # Parameters ################################################## self.timeslot_nr = timeslot_nr ################################################## # Blocks ################################################## self.gsm_universal_ctrl_chans_demapper_0 = grgsm.universal_ctrl_chans_demapper(timeslot_nr, ([0,0,0,0,4,4,4,4,8,8,8,8,12,12,12,12,16,16,16,16,20,20,20,20,24,24,24,24,28,28,28,28,32,32,32,32,36,36,36,36,40,40,40,40,44,44,44,44,0,0,0]), ([8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,0,0,0]), ([0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,0,0,0]), ([0,0,0,0,4,4,4,4,8,8,8,8,0,0,0,15,15,15,15,19,19,19,19,23,23,23,23,27,27,27,27,31,31,31,31,35,35,35,35,39,39,39,39,43,43,43,43,47,47,47,47]), ([136,136,136,136,136,136,136,136,136,136,136,136,0,0,0,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,136,136,136,136]), ([1,1,1,1,2,2,2,2,3,3,3,3,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,0,0,0,0,5,5,5,5,6,6,6,6,7,7,7,7,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,4,4,4,4])) ################################################## # Connections ################################################## self.msg_connect((self.gsm_universal_ctrl_chans_demapper_0, 'bursts'), (self, 'bursts')) self.msg_connect((self, 'bursts'), (self.gsm_universal_ctrl_chans_demapper_0, 'bursts')) def get_timeslot_nr(self): return self.timeslot_nr def set_timeslot_nr(self, timeslot_nr): self.timeslot_nr = timeslot_nr gr-gsm-0.41.2/python/misc_utils/000077500000000000000000000000001316153413000164635ustar00rootroot00000000000000gr-gsm-0.41.2/python/misc_utils/CMakeLists.txt000066400000000000000000000016461316153413000212320ustar00rootroot00000000000000# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. GR_PYTHON_INSTALL( FILES arfcn.py clock_offset_corrector_tagged.py hier_block.py fn_time.py DESTINATION ${GR_PYTHON_DIR}/grgsm ) gr-gsm-0.41.2/python/misc_utils/arfcn.py000066400000000000000000000137651316153413000201420ustar00rootroot00000000000000#!/usr/bin/env python # -*- coding: utf-8 -*- # @file # @author (C) 2015 by Roman Khassraf # (C) 2017 by Piotr Krysik # @section LICENSE # # Gr-gsm is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Gr-gsm is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with gr-gsm; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # # import collections __chan_spacing = 2e5 __arfcn_pcs = 0x8000 # first uplink freq, distance between uplink/downlink frequency, list of range tuple # each tuple in a range tuple contains: first arfcn of the range, last arfcn of the range, offset of the range # entries are ordered by relevance __band_conf = collections.OrderedDict([ ('GSM900', {'f_start': 880.2e6, 'distance': 45e6, 'ranges': [(975, 1023), (0, 124)]}), ('DCS1800', {'f_start': 1710.2e6, 'distance': 95e6, 'ranges': [(512, 885)]}), ('GSM850', {'f_start': 824.2e6, 'distance': 45e6, 'ranges': [(128, 251)]}), ('PCS1900', {'f_start': 1850.2e6, 'distance': 80e6, 'ranges': [(512+__arfcn_pcs, 810+__arfcn_pcs)]}), #PCS band is "special" as its channel number range overlap with DCS1800 ('GSM450', {'f_start': 450.6e6, 'distance': 10e6, 'ranges': [(259, 293)]}), ('GSM480', {'f_start': 479e6, 'distance': 10e6, 'ranges': [(306, 340)]}), ('GSM-R', {'f_start': 876.2e6, 'distance': 45e6, 'ranges': [(955, 1023), (0, 124)]}), ]) def get_bands(): return __band_conf.keys() def arfcn2band(arfcn): for band_name,band_desc in __band_conf.items(): for arfcns_range in band_desc["ranges"]: arfcn_start = arfcns_range[0] arfcn_stop = arfcns_range[1] if arfcn_start <= arfcn <= arfcn_stop: return band_name return None def freq2band(freq, downlink=False): for band_name,band_desc in __band_conf.items(): chans_total = 0 #count total number of channels in the range for arfcns_range in band_desc["ranges"]: arfcn_start = arfcns_range[0] arfcn_stop = arfcns_range[1] chans_in_range = arfcn_stop - arfcn_start + 1 chans_total = chans_total + chans_in_range first_freq = band_desc["f_start"] if downlink: first_freq = first_freq + band_desc["distance"] last_freq = first_freq + (chans_total - 1) * __chan_spacing if first_freq <= freq <= last_freq: return band_name return None def uplink2band(freq): return freq2band(freq, False) def downlink2band(freq): return freq2band(freq, True) def is_valid_arfcn(arfcn): """ Returns True if arfcn is valid in the given band, else False """ band = arfcn2band(arfcn) if band is not None: conf = __band_conf.get(band) for arfcn_range in conf['ranges']: arfcn_start = arfcn_range[0] arfcn_end = arfcn_range[1] if arfcn_start <= arfcn <= arfcn_end: return True return False def is_valid_uplink(freq): """ Returns True if the given frequency is a valid uplink frequency in the given band """ result = False band = uplink2band(freq) if band is not None: result = True return result def is_valid_downlink(freq): """ Returns True if the given frequency is a valid downlink frequency in the given band """ result = False band = downlink2band(freq) if band is not None: result = True return result def arfcn2uplink(arfcn): band = arfcn2band(arfcn) if band is not None: conf = __band_conf.get(band) f_start = conf['f_start'] arfcns_total = 0 for arfcn_range in conf['ranges']: arfcn_start = arfcn_range[0] arfcn_end = arfcn_range[1] if arfcn_start <= arfcn <= arfcn_end: f = f_start + (__chan_spacing * (arfcn - arfcn_start + arfcns_total)) return round(f, 1) arfcns_total = arfcn_end - arfcn_start + 1 return -1 def arfcn2downlink(arfcn): band = arfcn2band(arfcn) if band is not None: conf = __band_conf.get(band) distance = conf['distance'] return round(arfcn2uplink(arfcn) + distance, 1) return -1 def uplink2arfcn(freq): band = uplink2band(freq) if band is not None: conf = __band_conf.get(band) arfcns_total = 0 for arfcn_range in conf['ranges']: arfcn_start = arfcn_range[0] arfcn_end = arfcn_range[1] arfcns_in_range = arfcn_end - arfcn_start + 1 freq_start = conf['f_start'] + arfcns_total * __chan_spacing freq_end = freq_start + (arfcns_in_range - 1) * __chan_spacing if freq_start <= freq <= freq_end: arfcn = int(round(arfcn_start + ((freq - freq_start) / __chan_spacing), 0)) return arfcn arfcns_total = arfcns_total + arfcns_in_range return -1 def downlink2arfcn(freq): band = downlink2band(freq) if band is not None: conf = __band_conf.get(band) distance = conf['distance'] freq_uplink = freq - distance return int(round(uplink2arfcn(freq_uplink), 0)) return -1 def get_arfcn_ranges(band): """ Returns a list of arfcn tuples, each with first and last arfcn of the range. """ result = [] if band in __band_conf: conf = __band_conf.get(band) for arfcn_range in conf['ranges']: arfcn_tuple = (arfcn_range[0], arfcn_range[1]) result.append(arfcn_tuple) return result gr-gsm-0.41.2/python/misc_utils/clock_offset_corrector_tagged.py000066400000000000000000000112161316153413000250740ustar00rootroot00000000000000#!/usr/bin/env python2 # -*- coding: utf-8 -*- # @file # @author (C) 2016 by Piotr Krysik # @section LICENSE # # Gr-gsm is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Gr-gsm is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with gr-gsm; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # ################################################## # GNU Radio Python Flow Graph # Title: Clock Offset Corrector Tagged # Author: Piotr Krysik # Description: Clock offset corrector with blocks that use tags to switch offsets # Generated: Wed Jul 20 20:07:11 2016 ################################################## from gnuradio import gr from gnuradio.filter import firdes import grgsm import math class clock_offset_corrector_tagged(grgsm.hier_block): def __init__(self, fc=936.6e6, osr=4, ppm=0, samp_rate_in=1625000.0/6.0*4.0): gr.hier_block2.__init__( self, "Clock Offset Corrector Tagged", gr.io_signature(1, 1, gr.sizeof_gr_complex*1), gr.io_signature(1, 1, gr.sizeof_gr_complex*1), ) self.message_port_register_hier_in("ctrl") ################################################## # Parameters ################################################## self.fc = fc self.osr = osr self.ppm = ppm self.samp_rate_in = samp_rate_in ################################################## # Variables ################################################## self.gsm_symb_rate = gsm_symb_rate = 1625000.0/6.0 self.samp_rate_out = samp_rate_out = osr*gsm_symb_rate ################################################## # Blocks ################################################## self.gsm_msg_to_tag_0 = grgsm.msg_to_tag() self.gsm_controlled_rotator_cc_0 = grgsm.controlled_rotator_cc(ppm/1.0e6*2*math.pi*fc/samp_rate_out) self.gsm_controlled_fractional_resampler_cc_0 = grgsm.controlled_fractional_resampler_cc(0, (1-ppm/1.0e6)*(samp_rate_in/samp_rate_out)) ################################################## # Connections ################################################## self.msg_connect((self, 'ctrl'), (self.gsm_msg_to_tag_0, 'msg')) self.connect((self.gsm_controlled_fractional_resampler_cc_0, 0), (self.gsm_controlled_rotator_cc_0, 0)) self.connect((self.gsm_controlled_rotator_cc_0, 0), (self, 0)) self.connect((self.gsm_msg_to_tag_0, 0), (self.gsm_controlled_fractional_resampler_cc_0, 0)) self.connect((self, 0), (self.gsm_msg_to_tag_0, 0)) def get_fc(self): return self.fc def set_fc(self, fc): self.fc = fc self.gsm_controlled_rotator_cc_0.set_phase_inc(self.ppm/1.0e6*2*math.pi*self.fc/self.samp_rate_out) def get_osr(self): return self.osr def set_osr(self, osr): self.osr = osr self.set_samp_rate_out(self.osr*self.gsm_symb_rate) def get_ppm(self): return self.ppm def set_ppm(self, ppm): self.ppm = ppm self.gsm_controlled_rotator_cc_0.set_phase_inc(self.ppm/1.0e6*2*math.pi*self.fc/self.samp_rate_out) self.gsm_controlled_fractional_resampler_cc_0.set_resamp_ratio((1-self.ppm/1.0e6)*(self.samp_rate_in/self.samp_rate_out)) def get_samp_rate_in(self): return self.samp_rate_in def set_samp_rate_in(self, samp_rate_in): self.samp_rate_in = samp_rate_in self.gsm_controlled_fractional_resampler_cc_0.set_resamp_ratio((1-self.ppm/1.0e6)*(self.samp_rate_in/self.samp_rate_out)) def get_gsm_symb_rate(self): return self.gsm_symb_rate def set_gsm_symb_rate(self, gsm_symb_rate): self.gsm_symb_rate = gsm_symb_rate self.set_samp_rate_out(self.osr*self.gsm_symb_rate) def get_samp_rate_out(self): return self.samp_rate_out def set_samp_rate_out(self, samp_rate_out): self.samp_rate_out = samp_rate_out self.gsm_controlled_rotator_cc_0.set_phase_inc(self.ppm/1.0e6*2*math.pi*self.fc/self.samp_rate_out) self.gsm_controlled_fractional_resampler_cc_0.set_resamp_ratio((1-self.ppm/1.0e6)*(self.samp_rate_in/self.samp_rate_out)) gr-gsm-0.41.2/python/misc_utils/fn_time.py000066400000000000000000000063741316153413000204700ustar00rootroot00000000000000#!/usr/bin/env python # -*- coding: utf-8 -*- # @file # @author Piotr Krysik # @section LICENSE # # Gr-gsm is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Gr-gsm is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with gr-gsm; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # # from math import floor, ceil from random import uniform __hyper_frame = 26*51*2048 __symb_rate = 13.0e6/48.0 __ts_period = 156.25/__symb_rate __frame_period = 8*__ts_period #The functions below are crucial part of synchronization between #transmitter and receiver. #fnmod_delta computes difference between two frame numbers modulo #__hyper_frame. The result is correct if difference between the frame #numbers is not bigger than __hyper_frame/2. def fnmod_delta(fn1, fn2): h2 = __hyper_frame/2 delta = (fn1%__hyper_frame)-(fn2%__hyper_frame) if delta >= h2: delta = delta - __hyper_frame elif delta < -h2: delta = delta + __hyper_frame return delta #fn_time_delta computes difference between reference frame number and a second frame number. It also computes timestamp of the second frame number. The full list of parameters is following: #* fn_ref - reference frame number modulo __hyper_frame #* time_ref - precise timestamp of the first sample in the frame fn_ref #* fn_x - second frame number modulo __hyper_frame, #* time_hint - coarse time for fn_x that is used as a hint to avoid ambiguities caused by modulo operation applied to frame numbers. The correct are values from range (where time2_precise is exact time of the first sample in frame fn_x) #* ts_num - number of timeslot in the frame def fn_time_delta(fn_ref, time_ref, fn_x, time_hint=None, ts_num=None): if time_hint is None: time_hint = time_ref if ts_num is None: ts_num = 0 time_diff = time_hint-time_ref frames_diff = int(round(time_diff/__frame_period)) fn_ref = (fn_ref + frames_diff) fn_delta = fnmod_delta(fn_x,fn_ref)+frames_diff time2_precise = fn_delta*__frame_period+time_ref+ts_num*__ts_period return fn_delta, time2_precise if __name__ == "__main__": fn1 = 10000 time1 = 10 for fn2 in xrange(__hyper_frame/2+fn1-10,__hyper_frame/2*10+fn1+10,10): time2 = time1 + (fn2-fn1)*__frame_period error = uniform(-6200,6200) time2_err = time2+error fn_delta, time2_precise = fn_time_delta(fn1, time1, fn2, time2_err) if fn_delta != fn2-fn1: print "dupa:", fn2, error#, 'fn_delta:'+str(fn_delta), time2, error, frames_diff_h4, (time2-time1)/(__hyper_frame*__frame_period), time_diff_h4_prev, time_diff time_diff = time2 - time2_precise if time_diff > 0.1: print "dupa" gr-gsm-0.41.2/python/misc_utils/hier_block.py000066400000000000000000000030751316153413000211430ustar00rootroot00000000000000#!/usr/bin/env python2 # -*- coding: utf-8 -*- # @file # @author (C) 2016 by Piotr Krysik # @section LICENSE # # Gr-gsm is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Gr-gsm is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with gr-gsm; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # from gnuradio import gr from distutils.version import LooseVersion as version #class created to solve incompatibility of reginstration of message inputs #that was introduced in gnuradio 3.7.9 class hier_block(gr.hier_block2): def message_port_register_hier_in(self, port_id): if version(gr.version()) >= version('3.7.9'): super(hier_block, self).message_port_register_hier_in(port_id) else: super(hier_block, self).message_port_register_hier_out(port_id) def message_port_register_hier_out(self, port_id): if version(gr.version()) >= version('3.7.9'): super(hier_block, self).message_port_register_hier_out(port_id) else: super(hier_block, self).message_port_register_hier_in(port_id) gr-gsm-0.41.2/python/qa_arfcn.py000077500000000000000000000265271316153413000164530ustar00rootroot00000000000000#!/usr/bin/env python # -*- coding: utf-8 -*- # @file # @author (C) 2015 by Roman Khassraf # @section LICENSE # # Gr-gsm is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Gr-gsm is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with gr-gsm; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # # from gnuradio import gr, gr_unittest, blocks import grgsm_swig as grgsm import arfcn import os import sys class qa_arfcn(gr_unittest.TestCase): def test_001_is_valid_arfcn(self): self.assertTrue(arfcn.is_valid_arfcn(259)) self.assertTrue(arfcn.is_valid_arfcn(277)) self.assertTrue(arfcn.is_valid_arfcn(293)) self.assertFalse(arfcn.is_valid_arfcn(258)) self.assertFalse(arfcn.is_valid_arfcn(294)) self.assertTrue(arfcn.is_valid_arfcn(306)) self.assertTrue(arfcn.is_valid_arfcn(323)) self.assertTrue(arfcn.is_valid_arfcn(340)) self.assertFalse(arfcn.is_valid_arfcn(305)) self.assertFalse(arfcn.is_valid_arfcn(341)) self.assertTrue(arfcn.is_valid_arfcn(128)) self.assertTrue(arfcn.is_valid_arfcn(199)) self.assertTrue(arfcn.is_valid_arfcn(251)) self.assertFalse(arfcn.is_valid_arfcn(127)) self.assertFalse(arfcn.is_valid_arfcn(252)) self.assertTrue(arfcn.is_valid_arfcn(0)) self.assertTrue(arfcn.is_valid_arfcn(1)) self.assertTrue(arfcn.is_valid_arfcn(124)) self.assertFalse(arfcn.is_valid_arfcn(125)) self.assertTrue(arfcn.is_valid_arfcn(0)) self.assertTrue(arfcn.is_valid_arfcn(1)) self.assertTrue(arfcn.is_valid_arfcn(124)) self.assertFalse(arfcn.is_valid_arfcn(125)) self.assertTrue(arfcn.is_valid_arfcn(955)) self.assertTrue(arfcn.is_valid_arfcn(989)) self.assertTrue(arfcn.is_valid_arfcn(1023)) self.assertFalse(arfcn.is_valid_arfcn(954)) self.assertFalse(arfcn.is_valid_arfcn(1024)) self.assertTrue(arfcn.is_valid_arfcn(512)) self.assertTrue(arfcn.is_valid_arfcn(732)) self.assertTrue(arfcn.is_valid_arfcn(885)) self.assertFalse(arfcn.is_valid_arfcn(511)) self.assertFalse(arfcn.is_valid_arfcn(886)) self.assertTrue(arfcn.is_valid_arfcn(512+2**15)) self.assertTrue(arfcn.is_valid_arfcn(691+2**15)) self.assertTrue(arfcn.is_valid_arfcn(810+2**15)) self.assertFalse(arfcn.is_valid_arfcn(511+2**15)) self.assertFalse(arfcn.is_valid_arfcn(811+2**15)) def test_002_is_valid_uplink(self): self.assertTrue(arfcn.is_valid_uplink(450.6e6)) self.assertTrue(arfcn.is_valid_uplink(457.4e6)) self.assertFalse(arfcn.is_valid_uplink(450.4e6)) self.assertFalse(arfcn.is_valid_uplink(457.6e6)) self.assertTrue(arfcn.is_valid_uplink(479e6)) self.assertTrue(arfcn.is_valid_uplink(485.8e6)) self.assertFalse(arfcn.is_valid_uplink(478.8e6)) self.assertFalse(arfcn.is_valid_uplink(486e6)) self.assertTrue(arfcn.is_valid_uplink(824.2e6)) self.assertTrue(arfcn.is_valid_uplink(848.8e6)) self.assertFalse(arfcn.is_valid_uplink(824e6)) self.assertFalse(arfcn.is_valid_uplink(849e6)) self.assertTrue(arfcn.is_valid_uplink(876.2e6)) self.assertTrue(arfcn.is_valid_uplink(889.8e6)) self.assertTrue(arfcn.is_valid_uplink(890.0e6)) self.assertTrue(arfcn.is_valid_uplink(914.8e6)) self.assertFalse(arfcn.is_valid_uplink(876e6)) self.assertFalse(arfcn.is_valid_uplink(915e6)) self.assertTrue(arfcn.is_valid_uplink(1710.2e6)) self.assertTrue(arfcn.is_valid_uplink(1784.8e6)) self.assertFalse(arfcn.is_valid_uplink(1710e6)) self.assertFalse(arfcn.is_valid_uplink(1785e6)) self.assertTrue(arfcn.is_valid_uplink(1850.2e6)) self.assertTrue(arfcn.is_valid_uplink(1909.8e6)) self.assertFalse(arfcn.is_valid_uplink(1850e6)) self.assertFalse(arfcn.is_valid_uplink(1910e6)) def test_003_is_valid_downlink(self): self.assertTrue(arfcn.is_valid_downlink(460.6e6)) self.assertTrue(arfcn.is_valid_downlink(467.4e6)) self.assertFalse(arfcn.is_valid_downlink(460.4e6)) self.assertFalse(arfcn.is_valid_downlink(467.6e6)) self.assertTrue(arfcn.is_valid_downlink(489e6)) self.assertTrue(arfcn.is_valid_downlink(495.8e6)) self.assertFalse(arfcn.is_valid_downlink(488.8e6)) self.assertFalse(arfcn.is_valid_downlink(496e6)) self.assertTrue(arfcn.is_valid_downlink(869.2e6)) self.assertTrue(arfcn.is_valid_downlink(893.8e6)) self.assertFalse(arfcn.is_valid_downlink(869e6)) self.assertFalse(arfcn.is_valid_downlink(894e6)) self.assertTrue(arfcn.is_valid_downlink(921.2e6)) self.assertTrue(arfcn.is_valid_downlink(934.8e6)) self.assertTrue(arfcn.is_valid_downlink(935.0e6)) self.assertTrue(arfcn.is_valid_downlink(959.8e6)) self.assertFalse(arfcn.is_valid_downlink(921e6)) self.assertFalse(arfcn.is_valid_downlink(960e6)) self.assertTrue(arfcn.is_valid_downlink(1805.2e6)) self.assertTrue(arfcn.is_valid_downlink(1879.8e6)) self.assertFalse(arfcn.is_valid_downlink(1805e6)) self.assertFalse(arfcn.is_valid_downlink(1880e6)) self.assertTrue(arfcn.is_valid_downlink(1930.2e6)) self.assertTrue(arfcn.is_valid_downlink(1989.8e6)) self.assertFalse(arfcn.is_valid_downlink(1930e6)) self.assertFalse(arfcn.is_valid_downlink(1990e6)) def test_004_arfcn2uplink(self): self.assertEqual(450.6e6, arfcn.arfcn2uplink(259)) self.assertEqual(457.4e6, arfcn.arfcn2uplink(293)) self.assertEqual(479e6, arfcn.arfcn2uplink(306)) self.assertEqual(485.8e6, arfcn.arfcn2uplink(340)) self.assertEqual(824.2e6, arfcn.arfcn2uplink(128)) self.assertEqual(848.8e6, arfcn.arfcn2uplink(251)) self.assertEqual(890.2e6, arfcn.arfcn2uplink(1)) self.assertEqual(914.8e6, arfcn.arfcn2uplink(124)) self.assertEqual(890.0e6, arfcn.arfcn2uplink(0)) self.assertEqual(914.8e6, arfcn.arfcn2uplink(124)) self.assertEqual(880.2e6, arfcn.arfcn2uplink(975)) self.assertEqual(889.8e6, arfcn.arfcn2uplink(1023)) self.assertEqual(890.0e6, arfcn.arfcn2uplink(0)) self.assertEqual(914.8e6, arfcn.arfcn2uplink(124)) self.assertEqual(876.2e6, arfcn.arfcn2uplink(955)) self.assertEqual(889.8e6, arfcn.arfcn2uplink(1023)) self.assertEqual(1710.2e6, arfcn.arfcn2uplink(512)) self.assertEqual(1784.8e6, arfcn.arfcn2uplink(885)) self.assertEqual(1850.2e6, arfcn.arfcn2uplink(512+2**15)) self.assertEqual(1909.8e6, arfcn.arfcn2uplink(810+2**15)) def test_005_arfcn2downlink(self): self.assertEqual(460.6e6, arfcn.arfcn2downlink(259)) self.assertEqual(467.4e6, arfcn.arfcn2downlink(293)) self.assertEqual(489e6, arfcn.arfcn2downlink(306)) self.assertEqual(495.8e6, arfcn.arfcn2downlink(340)) self.assertEqual(869.2e6, arfcn.arfcn2downlink(128)) self.assertEqual(893.8e6, arfcn.arfcn2downlink(251)) self.assertEqual(935.2e6, arfcn.arfcn2downlink(1)) self.assertEqual(959.8e6, arfcn.arfcn2downlink(124)) self.assertEqual(935.0e6, arfcn.arfcn2downlink(0)) self.assertEqual(959.8e6, arfcn.arfcn2downlink(124)) self.assertEqual(925.2e6, arfcn.arfcn2downlink(975)) self.assertEqual(934.8e6, arfcn.arfcn2downlink(1023)) self.assertEqual(935.0e6, arfcn.arfcn2downlink(0)) self.assertEqual(959.8e6, arfcn.arfcn2downlink(124)) self.assertEqual(921.2e6, arfcn.arfcn2downlink(955)) self.assertEqual(934.8e6, arfcn.arfcn2downlink(1023)) self.assertEqual(1805.2e6, arfcn.arfcn2downlink(512)) self.assertEqual(1879.8e6, arfcn.arfcn2downlink(885)) self.assertEqual(1930.2e6, arfcn.arfcn2downlink(512+2**15)) self.assertEqual(1989.8e6, arfcn.arfcn2downlink(810+2**15)) def test_006_uplink2arfcn(self): self.assertEqual(259, arfcn.uplink2arfcn(450.6e6)) self.assertEqual(293, arfcn.uplink2arfcn(457.4e6)) self.assertEqual(306, arfcn.uplink2arfcn(479e6)) self.assertEqual(340, arfcn.uplink2arfcn(485.8e6)) self.assertEqual(128, arfcn.uplink2arfcn(824.2e6)) self.assertEqual(251, arfcn.uplink2arfcn(848.8e6)) self.assertEqual(1, arfcn.uplink2arfcn(890.2e6)) self.assertEqual(124, arfcn.uplink2arfcn(914.8e6)) self.assertEqual(0, arfcn.uplink2arfcn(890.0e6)) self.assertEqual(124, arfcn.uplink2arfcn(914.8e6)) self.assertEqual(975, arfcn.uplink2arfcn(880.2e6)) self.assertEqual(1023, arfcn.uplink2arfcn(889.8e6)) self.assertEqual(0, arfcn.uplink2arfcn(890.0e6)) self.assertEqual(124, arfcn.uplink2arfcn(914.8e6)) self.assertEqual(955, arfcn.uplink2arfcn(876.2e6)) self.assertEqual(1023, arfcn.uplink2arfcn(889.8e6)) self.assertEqual(512, arfcn.uplink2arfcn(1710.2e6)) self.assertEqual(885, arfcn.uplink2arfcn(1784.8e6)) self.assertEqual(512+2**15, arfcn.uplink2arfcn(1850.2e6)) self.assertEqual(810+2**15, arfcn.uplink2arfcn(1909.8e6)) def test_007_downlink2arfcn(self): self.assertEqual(259, arfcn.downlink2arfcn(460.6e6)) self.assertEqual(293, arfcn.downlink2arfcn(467.4e6)) self.assertEqual(306, arfcn.downlink2arfcn(489e6,)) self.assertEqual(340, arfcn.downlink2arfcn(495.8e6)) self.assertEqual(128, arfcn.downlink2arfcn(869.2e6)) self.assertEqual(251, arfcn.downlink2arfcn(893.8e6)) self.assertEqual(1, arfcn.downlink2arfcn(935.2e6)) self.assertEqual(124, arfcn.downlink2arfcn(959.8e6)) self.assertEqual(0, arfcn.downlink2arfcn(935.0e6)) self.assertEqual(124, arfcn.downlink2arfcn(959.8e6)) self.assertEqual(975, arfcn.downlink2arfcn(925.2e6)) self.assertEqual(1023, arfcn.downlink2arfcn(934.8e6)) self.assertEqual(0, arfcn.downlink2arfcn(935.0e6)) self.assertEqual(124, arfcn.downlink2arfcn(959.8e6)) self.assertEqual(955, arfcn.downlink2arfcn(921.2e6)) self.assertEqual(1023, arfcn.downlink2arfcn(934.8e6)) self.assertEqual(512, arfcn.downlink2arfcn(1805.2e6)) self.assertEqual(885, arfcn.downlink2arfcn(1879.8e6)) self.assertEqual(512+2**15, arfcn.downlink2arfcn(1930.2e6)) self.assertEqual(810+2**15, arfcn.downlink2arfcn(1989.8e6)) def test_008_get_arfcn_ranges(self): self.assertEqual(1, len(arfcn.get_arfcn_ranges('GSM450'))) self.assertEqual(1, len(arfcn.get_arfcn_ranges('GSM480'))) self.assertEqual(1, len(arfcn.get_arfcn_ranges('GSM850'))) self.assertEqual(2, len(arfcn.get_arfcn_ranges('GSM900'))) self.assertEqual(1, len(arfcn.get_arfcn_ranges('DCS1800'))) self.assertEqual(1, len(arfcn.get_arfcn_ranges('PCS1900'))) if __name__ == '__main__': gr_unittest.run(qa_arfcn, "qa_arfcn.xml") gr-gsm-0.41.2/python/qa_burst_fnr_filter.py000077500000000000000000000367121316153413000207300ustar00rootroot00000000000000#!/usr/bin/env python # -*- coding: utf-8 -*- # @file # @author (C) 2015 by Roman Khassraf # @section LICENSE # # Gr-gsm is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Gr-gsm is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with gr-gsm; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # # from gnuradio import gr, gr_unittest, blocks import grgsm_swig as grgsm import pmt class qa_burst_fnr_filter (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () def tearDown (self): self.tb = None def test_001_less_or_equal (self): """ filter mode less_or_equal, limiting frame number 1500123 25 random framenumbers, timeslots and bursts as input """ framenumbers_input = [1259192, 1076346, 1076242, 235879, 1259218, 2194302, 2714322, 1588, 1259244, 1563637, 1435624, 1928543, 503726, 1571144, 2658397, 1807445, 869789, 624070, 2005511, 1306953, 2284894, 1600339, 551375, 1259270, 1500123] timeslots_input = [6, 3, 4, 3, 5, 3, 2, 7, 1, 6, 0, 7, 2, 3, 2, 0, 7, 1, 0, 6, 0, 6, 5, 7, 0] bursts_input = [ "0001100001000111100111101111100101000100101011000010011110011101001111101100010100111111100000110100011111101011101100100111110011000100010001010000", "0001000101000000001001111110000110010110110111110111101000001101001111101100010100111111001110001001110101110001010001000111011010010001011011000000", "0001001101101101000111001000101011001101001110110001001100111101001111101100010100111111111001001010011010011111010010010101011001001011011100110000", "0000010010100000001001101010100001011100010001101100111111101101001111101100010100111111101101001110100010101110010110101111100010010000110010110000", "0000010101010110010011110101010101101100000000001000100100101010000111011101001000011101011101110000101011001111000100001000000000001110010001111000", "0001000000000010111010100000010101000010001010111010000000011010000111011101001000011101000000100010111110101000000001000000000010111010100000000000", "0001010101111111111010000001010101011111111111101000000001001010000111011101001000011101010111111111111010101000000001010101011011101010000001000000", "0000000000111110101010100001000000100010101110101010000101001010000111011101001000011101001010001111101010001000010000000000101110101010100000010000", "0000010000000010000001001000011001010010000011000101000000001010000111011101001000011101010100100000000001001000001000000100100011000101001000111000", "0001010100110111100000110111100110010100011100011000110110001010000111011101001000011101011111111001111001101010010100000000011111001101000111110000", "0001100110000001011110001000001100101001010100111111000100111010000111011101001000011101000011010010001010111101000100110011111010100010010101000000", "0000010101100101010110000011010000000000000010111001110110101010000111011101001000011101000001000100100001111001100011000101010001110001010100111000", "0001000100000011001010111001111100011010000000000000001001001010000111011101001000011101010110000101111010011001110110001001011010101000011110110000", "0001100001000111111111100001011000000011010110111010110000111010000111011101001000011101100010111100100101110001101000110100110000001010101110011000", "0000000100111011000000000010100100001100101010000000010010101010000111011101001000011101000110110001110110000100110100110110011001100100000101100000", "0000100101111010011110111010100111010100011011011101100111001010000111011101001000011101010000111010000110100000001000010011101011001001110100011000", "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000", "0000110101000011011010110000110011010000000001001010110010001010000111011101001000011101010000011000111001101110000000110010100001101110101000100000", "0000001000010001011111111111101010100000010101011101101010101010000111011101001000011101100010010101010101011110101010101000010001011101111010101000", "0000101110101111011001011001000011110010100010011100110010001010000111011101001000011101100000001110000100010100110111001001100010101101100010101000", "0001100010000001000111011100101101101010100001111101001000101010000111011101001000011101111010000011010110010111011111010010001000001101100011111000", "0001011101101101011100001111001100010001000011011001101110011010000111011101001000011101010010111011100111000001011100100001111010100101111000100000", "0000001000100011000000000000110100000000010000001010100100001010000111011101001000011101000010010000000000001001000001011000000001010000000100010000", "0000100000110001000000000100000110001011100001001000000000001010000111011101001000011101001010010001010000000111010000000011000001000000000101010000", "0000100000110001000000000101000100001010100001001000000000001010000111011101001000011101001010010001101011001011101111101000010001000000000101010000" ] bursts_expected = [ "0001100001000111100111101111100101000100101011000010011110011101001111101100010100111111100000110100011111101011101100100111110011000100010001010000", "0001000101000000001001111110000110010110110111110111101000001101001111101100010100111111001110001001110101110001010001000111011010010001011011000000", "0001001101101101000111001000101011001101001110110001001100111101001111101100010100111111111001001010011010011111010010010101011001001011011100110000", "0000010010100000001001101010100001011100010001101100111111101101001111101100010100111111101101001110100010101110010110101111100010010000110010110000", "0000010101010110010011110101010101101100000000001000100100101010000111011101001000011101011101110000101011001111000100001000000000001110010001111000", "0000000000111110101010100001000000100010101110101010000101001010000111011101001000011101001010001111101010001000010000000000101110101010100000010000", "0000010000000010000001001000011001010010000011000101000000001010000111011101001000011101010100100000000001001000001000000100100011000101001000111000", "0001100110000001011110001000001100101001010100111111000100111010000111011101001000011101000011010010001010111101000100110011111010100010010101000000", "0001000100000011001010111001111100011010000000000000001001001010000111011101001000011101010110000101111010011001110110001001011010101000011110110000", "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000", "0000110101000011011010110000110011010000000001001010110010001010000111011101001000011101010000011000111001101110000000110010100001101110101000100000", "0000101110101111011001011001000011110010100010011100110010001010000111011101001000011101100000001110000100010100110111001001100010101101100010101000", "0000001000100011000000000000110100000000010000001010100100001010000111011101001000011101000010010000000000001001000001011000000001010000000100010000", "0000100000110001000000000100000110001011100001001000000000001010000111011101001000011101001010010001010000000111010000000011000001000000000101010000", "0000100000110001000000000101000100001010100001001000000000001010000111011101001000011101001010010001101011001011101111101000010001000000000101010000" ] fnr_filter = grgsm.burst_fnr_filter(grgsm.FILTER_LESS_OR_EQUAL, 1500123) src = grgsm.burst_source(framenumbers_input, timeslots_input, bursts_input) sink = grgsm.burst_sink() self.tb.msg_connect(src, "out", fnr_filter, "in") self.tb.msg_connect(fnr_filter, "out", sink, "in") self.tb.run () bursts_result = list(sink.get_burst_data()) self.assertEqual(bursts_expected, bursts_result) def test_002_greater_or_equal (self): """ filter mode greater_or_equal, limiting frame number 1500123 25 random framenumbers, timeslots and bursts as input """ framenumbers_input = [1259192, 1076346, 1076242, 235879, 1259218, 2194302, 2714322, 1588, 1259244, 1563637, 1435624, 1928543, 503726, 1571144, 2658397, 1807445, 869789, 624070, 2005511, 1306953, 2284894, 1600339, 551375, 1259270, 1500123] timeslots_input = [6, 3, 4, 3, 5, 3, 2, 7, 1, 6, 0, 7, 2, 3, 2, 0, 7, 1, 0, 6, 0, 6, 5, 7, 0] bursts_input = [ "0001100001000111100111101111100101000100101011000010011110011101001111101100010100111111100000110100011111101011101100100111110011000100010001010000", "0001000101000000001001111110000110010110110111110111101000001101001111101100010100111111001110001001110101110001010001000111011010010001011011000000", "0001001101101101000111001000101011001101001110110001001100111101001111101100010100111111111001001010011010011111010010010101011001001011011100110000", "0000010010100000001001101010100001011100010001101100111111101101001111101100010100111111101101001110100010101110010110101111100010010000110010110000", "0000010101010110010011110101010101101100000000001000100100101010000111011101001000011101011101110000101011001111000100001000000000001110010001111000", "0001000000000010111010100000010101000010001010111010000000011010000111011101001000011101000000100010111110101000000001000000000010111010100000000000", "0001010101111111111010000001010101011111111111101000000001001010000111011101001000011101010111111111111010101000000001010101011011101010000001000000", "0000000000111110101010100001000000100010101110101010000101001010000111011101001000011101001010001111101010001000010000000000101110101010100000010000", "0000010000000010000001001000011001010010000011000101000000001010000111011101001000011101010100100000000001001000001000000100100011000101001000111000", "0001010100110111100000110111100110010100011100011000110110001010000111011101001000011101011111111001111001101010010100000000011111001101000111110000", "0001100110000001011110001000001100101001010100111111000100111010000111011101001000011101000011010010001010111101000100110011111010100010010101000000", "0000010101100101010110000011010000000000000010111001110110101010000111011101001000011101000001000100100001111001100011000101010001110001010100111000", "0001000100000011001010111001111100011010000000000000001001001010000111011101001000011101010110000101111010011001110110001001011010101000011110110000", "0001100001000111111111100001011000000011010110111010110000111010000111011101001000011101100010111100100101110001101000110100110000001010101110011000", "0000000100111011000000000010100100001100101010000000010010101010000111011101001000011101000110110001110110000100110100110110011001100100000101100000", "0000100101111010011110111010100111010100011011011101100111001010000111011101001000011101010000111010000110100000001000010011101011001001110100011000", "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000", "0000110101000011011010110000110011010000000001001010110010001010000111011101001000011101010000011000111001101110000000110010100001101110101000100000", "0000001000010001011111111111101010100000010101011101101010101010000111011101001000011101100010010101010101011110101010101000010001011101111010101000", "0000101110101111011001011001000011110010100010011100110010001010000111011101001000011101100000001110000100010100110111001001100010101101100010101000", "0001100010000001000111011100101101101010100001111101001000101010000111011101001000011101111010000011010110010111011111010010001000001101100011111000", "0001011101101101011100001111001100010001000011011001101110011010000111011101001000011101010010111011100111000001011100100001111010100101111000100000", "0000001000100011000000000000110100000000010000001010100100001010000111011101001000011101000010010000000000001001000001011000000001010000000100010000", "0000100000110001000000000100000110001011100001001000000000001010000111011101001000011101001010010001010000000111010000000011000001000000000101010000", "0000100000110001000000000101000100001010100001001000000000001010000111011101001000011101001010010001101011001011101111101000010001000000000101010000" ] bursts_expected = [ "0001000000000010111010100000010101000010001010111010000000011010000111011101001000011101000000100010111110101000000001000000000010111010100000000000", "0001010101111111111010000001010101011111111111101000000001001010000111011101001000011101010111111111111010101000000001010101011011101010000001000000", "0001010100110111100000110111100110010100011100011000110110001010000111011101001000011101011111111001111001101010010100000000011111001101000111110000", "0000010101100101010110000011010000000000000010111001110110101010000111011101001000011101000001000100100001111001100011000101010001110001010100111000", "0001100001000111111111100001011000000011010110111010110000111010000111011101001000011101100010111100100101110001101000110100110000001010101110011000", "0000000100111011000000000010100100001100101010000000010010101010000111011101001000011101000110110001110110000100110100110110011001100100000101100000", "0000100101111010011110111010100111010100011011011101100111001010000111011101001000011101010000111010000110100000001000010011101011001001110100011000", "0000001000010001011111111111101010100000010101011101101010101010000111011101001000011101100010010101010101011110101010101000010001011101111010101000", "0001100010000001000111011100101101101010100001111101001000101010000111011101001000011101111010000011010110010111011111010010001000001101100011111000", "0001011101101101011100001111001100010001000011011001101110011010000111011101001000011101010010111011100111000001011100100001111010100101111000100000", "0000100000110001000000000101000100001010100001001000000000001010000111011101001000011101001010010001101011001011101111101000010001000000000101010000" ] fnr_filter = grgsm.burst_fnr_filter(grgsm.FILTER_GREATER_OR_EQUAL, 1500123) src = grgsm.burst_source(framenumbers_input, timeslots_input, bursts_input) sink = grgsm.burst_sink() self.tb.msg_connect(src, "out", fnr_filter, "in") self.tb.msg_connect(fnr_filter, "out", sink, "in") self.tb.run () bursts_result = list(sink.get_burst_data()) self.assertEqual(bursts_expected, bursts_result) if __name__ == '__main__': gr_unittest.run(qa_burst_fnr_filter, "qa_burst_fnr_filter.xml") gr-gsm-0.41.2/python/qa_burst_printer.py000077500000000000000000000505071316153413000202570ustar00rootroot00000000000000#!/usr/bin/env python # -*- coding: utf-8 -*- # @file # @author (C) 2015 by Roman Khassraf # @section LICENSE # # Gr-gsm is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Gr-gsm is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with gr-gsm; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # # from gnuradio import gr, gr_unittest, blocks import grgsm_swig as grgsm import os import pmt import sys import tempfile class qa_burst_printer (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block() self.tmpfile = tempfile.NamedTemporaryFile() self.prevfd = os.dup(sys.stdout.fileno()) os.dup2(self.tmpfile.fileno(), sys.stdout.fileno()) self.prev = sys.stdout sys.stdout = os.fdopen(self.prevfd, "w") def tearDown (self): self.tb = None os.dup2(self.prevfd, self.prev.fileno()) sys.stdout = self.prev self.tmpfile.close() def getOutput(self): self.tmpfile.seek(0) return self.tmpfile.read() def getOutputExpected(self, expected_lines): out = "" for l in expected_lines: out = out + l + "\n" return out def test_001_complete_bursts_prefix (self): """ Complete bursts, without any prefix """ framenumbers_input = [2569043, 2569044, 2569045, 2569046] timeslots_input = [2, 2, 2, 2] bursts_input = [ "0001100000010010011110111110011111000000001010001111000000001000110101110010000011010111100101101010000001111010100010110111101011101011100000101000", "0001000101111101111110000010100001011011111010111110101011101000110101110010000011010111110110111101101111110000011011010111011111001011101000011000", "0000001000011110111110101011001000110000000000110110101100011000110101110010000011010111001010100101011111001000111100000100000111111000000101110000", "0001101010111110010001010110101100000011101100011111110100101000110101110010000011010111111000000001010010111001111111011001000000001001000011101000" ] expected_lines = [ "0001100000010010011110111110011111000000001010001111000000001000110101110010000011010111100101101010000001111010100010110111101011101011100000101000", "0001000101111101111110000010100001011011111010111110101011101000110101110010000011010111110110111101101111110000011011010111011111001011101000011000", "0000001000011110111110101011001000110000000000110110101100011000110101110010000011010111001010100101011111001000111100000100000111111000000101110000", "0001101010111110010001010110101100000011101100011111110100101000110101110010000011010111111000000001010010111001111111011001000000001001000011101000" ] src = grgsm.burst_source(framenumbers_input, timeslots_input, bursts_input) printer = grgsm.bursts_printer(pmt.intern(""), False, False, False, False) self.tb.msg_connect(src, "out", printer, "bursts") self.tb.run() self.assertEqual(self.getOutput(), self.getOutputExpected(expected_lines)) def test_002_complete_bursts_prefix (self): """ Complete bursts, with a string prefix """ framenumbers_input = [2569043, 2569044, 2569045, 2569046] timeslots_input = [2, 2, 2, 2] bursts_input = [ "0001100000010010011110111110011111000000001010001111000000001000110101110010000011010111100101101010000001111010100010110111101011101011100000101000", "0001000101111101111110000010100001011011111010111110101011101000110101110010000011010111110110111101101111110000011011010111011111001011101000011000", "0000001000011110111110101011001000110000000000110110101100011000110101110010000011010111001010100101011111001000111100000100000111111000000101110000", "0001101010111110010001010110101100000011101100011111110100101000110101110010000011010111111000000001010010111001111111011001000000001001000011101000" ] expected_lines = [ "Test 0001100000010010011110111110011111000000001010001111000000001000110101110010000011010111100101101010000001111010100010110111101011101011100000101000", "Test 0001000101111101111110000010100001011011111010111110101011101000110101110010000011010111110110111101101111110000011011010111011111001011101000011000", "Test 0000001000011110111110101011001000110000000000110110101100011000110101110010000011010111001010100101011111001000111100000100000111111000000101110000", "Test 0001101010111110010001010110101100000011101100011111110100101000110101110010000011010111111000000001010010111001111111011001000000001001000011101000" ] src = grgsm.burst_source(framenumbers_input, timeslots_input, bursts_input) printer = grgsm.bursts_printer(pmt.intern("Test "), False, False, False, False) self.tb.msg_connect(src, "out", printer, "bursts") self.tb.run() self.assertEqual(self.getOutput(), self.getOutputExpected(expected_lines)) def test_003_complete_bursts_fnr (self): """ Complete bursts, no prefix, with frame number """ framenumbers_input = [2569043, 2569044, 2569045, 2569046] timeslots_input = [2, 2, 2, 2] bursts_input = [ "0001100000010010011110111110011111000000001010001111000000001000110101110010000011010111100101101010000001111010100010110111101011101011100000101000", "0001000101111101111110000010100001011011111010111110101011101000110101110010000011010111110110111101101111110000011011010111011111001011101000011000", "0000001000011110111110101011001000110000000000110110101100011000110101110010000011010111001010100101011111001000111100000100000111111000000101110000", "0001101010111110010001010110101100000011101100011111110100101000110101110010000011010111111000000001010010111001111111011001000000001001000011101000" ] expected_lines = [ "2569043: 0001100000010010011110111110011111000000001010001111000000001000110101110010000011010111100101101010000001111010100010110111101011101011100000101000", "2569044: 0001000101111101111110000010100001011011111010111110101011101000110101110010000011010111110110111101101111110000011011010111011111001011101000011000", "2569045: 0000001000011110111110101011001000110000000000110110101100011000110101110010000011010111001010100101011111001000111100000100000111111000000101110000", "2569046: 0001101010111110010001010110101100000011101100011111110100101000110101110010000011010111111000000001010010111001111111011001000000001001000011101000" ] src = grgsm.burst_source(framenumbers_input, timeslots_input, bursts_input) printer = grgsm.bursts_printer(pmt.intern(""), True, False, False, False) self.tb.msg_connect(src, "out", printer, "bursts") self.tb.run() self.assertEqual(self.getOutput(), self.getOutputExpected(expected_lines)) def test_004_complete_bursts_fcount (self): """ Complete bursts, no prefix, with frame count """ framenumbers_input = [2569043, 2569044, 2569045, 2569046] timeslots_input = [2, 2, 2, 2] bursts_input = [ "0001100000010010011110111110011111000000001010001111000000001000110101110010000011010111100101101010000001111010100010110111101011101011100000101000", "0001000101111101111110000010100001011011111010111110101011101000110101110010000011010111110110111101101111110000011011010111011111001011101000011000", "0000001000011110111110101011001000110000000000110110101100011000110101110010000011010111001010100101011111001000111100000100000111111000000101110000", "0001101010111110010001010110101100000011101100011111110100101000110101110010000011010111111000000001010010111001111111011001000000001001000011101000" ] expected_lines = [ "3967625: 0001100000010010011110111110011111000000001010001111000000001000110101110010000011010111100101101010000001111010100010110111101011101011100000101000", "3967658: 0001000101111101111110000010100001011011111010111110101011101000110101110010000011010111110110111101101111110000011011010111011111001011101000011000", "3967691: 0000001000011110111110101011001000110000000000110110101100011000110101110010000011010111001010100101011111001000111100000100000111111000000101110000", "3967724: 0001101010111110010001010110101100000011101100011111110100101000110101110010000011010111111000000001010010111001111111011001000000001001000011101000" ] src = grgsm.burst_source(framenumbers_input, timeslots_input, bursts_input) printer = grgsm.bursts_printer(pmt.intern(""), False, True, False, False) self.tb.msg_connect(src, "out", printer, "bursts") self.tb.run() self.assertEqual(self.getOutput(), self.getOutputExpected(expected_lines)) def test_005_complete_bursts_fnr_fcount (self): """ Complete bursts, no prefix, with frame number and frame count """ framenumbers_input = [2569043, 2569044, 2569045, 2569046] timeslots_input = [2, 2, 2, 2] bursts_input = [ "0001100000010010011110111110011111000000001010001111000000001000110101110010000011010111100101101010000001111010100010110111101011101011100000101000", "0001000101111101111110000010100001011011111010111110101011101000110101110010000011010111110110111101101111110000011011010111011111001011101000011000", "0000001000011110111110101011001000110000000000110110101100011000110101110010000011010111001010100101011111001000111100000100000111111000000101110000", "0001101010111110010001010110101100000011101100011111110100101000110101110010000011010111111000000001010010111001111111011001000000001001000011101000" ] expected_lines = [ "2569043 3967625: 0001100000010010011110111110011111000000001010001111000000001000110101110010000011010111100101101010000001111010100010110111101011101011100000101000", "2569044 3967658: 0001000101111101111110000010100001011011111010111110101011101000110101110010000011010111110110111101101111110000011011010111011111001011101000011000", "2569045 3967691: 0000001000011110111110101011001000110000000000110110101100011000110101110010000011010111001010100101011111001000111100000100000111111000000101110000", "2569046 3967724: 0001101010111110010001010110101100000011101100011111110100101000110101110010000011010111111000000001010010111001111111011001000000001001000011101000" ] src = grgsm.burst_source(framenumbers_input, timeslots_input, bursts_input) printer = grgsm.bursts_printer(pmt.intern(""), True, True, False, False) self.tb.msg_connect(src, "out", printer, "bursts") self.tb.run() self.assertEqual(self.getOutput(), self.getOutputExpected(expected_lines)) def test_006_payload_prefix_fnr_fcount (self): """ Payload only, no prefix, with frame number and frame count Bursts 4-7 are dummy bursts """ framenumbers_input = [2569043, 2569044, 2569045, 2569046, 1099602, 1099603, 1099604, 1099605] timeslots_input = [2, 2, 2, 2, 4, 4, 4, 4] bursts_input = [ "0001100000010010011110111110011111000000001010001111000000001000110101110010000011010111100101101010000001111010100010110111101011101011100000101000", "0001000101111101111110000010100001011011111010111110101011101000110101110010000011010111110110111101101111110000011011010111011111001011101000011000", "0000001000011110111110101011001000110000000000110110101100011000110101110010000011010111001010100101011111001000111100000100000111111000000101110000", "0001101010111110010001010110101100000011101100011111110100101000110101110010000011010111111000000001010010111001111111011001000000001001000011101000", "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000", "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000", "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000", "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000" ] expected_lines = [ "test_006: 2569043 3967625: 110000001001001111011111001111100000000101000111100000000100101101010000001111010100010110111101011101011100000101", "test_006: 2569044 3967658: 100010111110111111000001010000101101111101011111010101110110110111101101111110000011011010111011111001011101000011", "test_006: 2569045 3967691: 000100001111011111010101100100011000000000011011010110001001010100101011111001000111100000100000111111000000101110", "test_006: 2569046 3967724: 110101011111001000101011010110000001110110001111111010010111000000001010010111001111111011001000000001001000011101", "test_006: 1099602 1699146: 111110110111011000001010010011100000100100010000000111110111010010100011001100111001111010011111000100101111101010", "test_006: 1099603 1699179: 111110110111011000001010010011100000100100010000000111110111010010100011001100111001111010011111000100101111101010", "test_006: 1099604 1699212: 111110110111011000001010010011100000100100010000000111110111010010100011001100111001111010011111000100101111101010", "test_006: 1099605 1699245: 111110110111011000001010010011100000100100010000000111110111010010100011001100111001111010011111000100101111101010" ] src = grgsm.burst_source(framenumbers_input, timeslots_input, bursts_input) printer = grgsm.bursts_printer(pmt.intern("test_006: "), True, True, True, False) self.tb.msg_connect(src, "out", printer, "bursts") self.tb.run() self.assertEqual(self.getOutput(), self.getOutputExpected(expected_lines)) def test_007_payload_prefix_fnr_fcount (self): """ Payload only, no prefix, with frame number, frame count, and ignoring dummy bursts Bursts 4-7 are dummy bursts """ framenumbers_input = [2569043, 2569044, 2569045, 2569046, 1099602, 1099603, 1099604, 1099605] timeslots_input = [2, 2, 2, 2, 4, 4, 4, 4] bursts_input = [ "0001100000010010011110111110011111000000001010001111000000001000110101110010000011010111100101101010000001111010100010110111101011101011100000101000", "0001000101111101111110000010100001011011111010111110101011101000110101110010000011010111110110111101101111110000011011010111011111001011101000011000", "0000001000011110111110101011001000110000000000110110101100011000110101110010000011010111001010100101011111001000111100000100000111111000000101110000", "0001101010111110010001010110101100000011101100011111110100101000110101110010000011010111111000000001010010111001111111011001000000001001000011101000", "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000", "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000", "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000", "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000" ] expected_lines = [ "test_007: 2569043 3967625: 110000001001001111011111001111100000000101000111100000000100101101010000001111010100010110111101011101011100000101", "test_007: 2569044 3967658: 100010111110111111000001010000101101111101011111010101110110110111101101111110000011011010111011111001011101000011", "test_007: 2569045 3967691: 000100001111011111010101100100011000000000011011010110001001010100101011111001000111100000100000111111000000101110", "test_007: 2569046 3967724: 110101011111001000101011010110000001110110001111111010010111000000001010010111001111111011001000000001001000011101" ] src = grgsm.burst_source(framenumbers_input, timeslots_input, bursts_input) printer = grgsm.bursts_printer(pmt.intern("test_007: "), True, True, True, True) self.tb.msg_connect(src, "out", printer, "bursts") self.tb.run() self.assertEqual(self.getOutput(), self.getOutputExpected(expected_lines)) def test_008_complete_prefix_fnr_fcount (self): """ Complete bursts, no prefix, with frame number, frame count, and ignoring dummy bursts Bursts 4-7 are dummy bursts """ framenumbers_input = [2569043, 2569044, 2569045, 2569046, 1099602, 1099603, 1099604, 1099605] timeslots_input = [2, 2, 2, 2, 4, 4, 4, 4] bursts_input = [ "0001100000010010011110111110011111000000001010001111000000001000110101110010000011010111100101101010000001111010100010110111101011101011100000101000", "0001000101111101111110000010100001011011111010111110101011101000110101110010000011010111110110111101101111110000011011010111011111001011101000011000", "0000001000011110111110101011001000110000000000110110101100011000110101110010000011010111001010100101011111001000111100000100000111111000000101110000", "0001101010111110010001010110101100000011101100011111110100101000110101110010000011010111111000000001010010111001111111011001000000001001000011101000", "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000", "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000", "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000", "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000" ] expected_lines = [ "test_008: 2569043 3967625: 0001100000010010011110111110011111000000001010001111000000001000110101110010000011010111100101101010000001111010100010110111101011101011100000101000", "test_008: 2569044 3967658: 0001000101111101111110000010100001011011111010111110101011101000110101110010000011010111110110111101101111110000011011010111011111001011101000011000", "test_008: 2569045 3967691: 0000001000011110111110101011001000110000000000110110101100011000110101110010000011010111001010100101011111001000111100000100000111111000000101110000", "test_008: 2569046 3967724: 0001101010111110010001010110101100000011101100011111110100101000110101110010000011010111111000000001010010111001111111011001000000001001000011101000" ] src = grgsm.burst_source(framenumbers_input, timeslots_input, bursts_input) printer = grgsm.bursts_printer(pmt.intern("test_008: "), True, True, False, True) self.tb.msg_connect(src, "out", printer, "bursts") self.tb.run() self.assertEqual(self.getOutput(), self.getOutputExpected(expected_lines)) if __name__ == '__main__': gr_unittest.run(qa_burst_printer, "qa_burst_printer.xml") gr-gsm-0.41.2/python/qa_burst_sdcch_subslot_filter.py000077500000000000000000000565241316153413000230050ustar00rootroot00000000000000#!/usr/bin/env python # -*- coding: utf-8 -*- # @file # @author (C) 2015 by Roman Khassraf # @section LICENSE # # Gr-gsm is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Gr-gsm is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with gr-gsm; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # # from gnuradio import gr, gr_unittest, blocks import grgsm_swig as grgsm class qa_burst_sdcch_subslot_filter (gr_unittest.TestCase): # 102 random bursts as test input bursts_input = [ '0000111100101011111011010010011001000100001001110110000110110001011011101111000100101111111000110000001111111111000111100100011111010100010011111000', '0001111110000000110110101010001000101000001101111100101100110010001111011010001000111100001010011101000111010111000100000111001111110011000011011000', '0001101110111011011011011010000001011011001011000100100110010101001111101100010100111110110011001100100011111010110111011001000111101011100001111000', '0000001011100110100011110111010101111000011111001011010011110000110101110010000011010110010011111001000110001111111010111011011001101010001100110000', '0001011001110011011101111111100110110111011101001110111110000101001111101100010100111110001111100000000110001000010000010111111011110101100000111000', '0001110110011011010011100010101010000100011000001111110101111101001111101100010100111110100001001101000100000001011001010110011111100010001111001000', '0001101100101101011110011001110110011100001100100100100110000010001111011010001000111101101101001100100001110001011001000001100000011111101000011000', '0000101100001011101001010001111001000000010100000111100110101000110101110010000011010110110000110010100011001111101101101001110111101001000011111000', '0000011011010111011111101100010100110110000001100011100001010001011011101111000100101110001110000011001100100101111000001010000101010000110101110000', '0000111100110111001011010100010010110100101010000000010001110010011101011000001001110100001010011111111111001010111010111010001111111101111110101000', '0000111101101110011111010100010100110001101110001001111100100101001111101100010100111111100010010001001100000000111010001000100011010000110111110000', '0000011100010011111011011001110010011000001111111110101000100000110101110010000011010111101011000100101011000011011011110000010001100110011010001000', '0000011011100100011101000010111010101101001111110000110001111010000111011101001000011101111110101010000011100100111101000111101110011011001001100000', '0000110100110111001010100011100010101001001010011001001111001001001011100001000100101111001001100100001111100111000101110111100011101100110100010000', '0000011101101000110111010010111001011110101000001011111000101010000111011101001000011100100100010110101110101010001000011001001110100001000101001000', '0000101000110000011100111010101000001101000111111101100100110010011101011000001001110101001101110101011110010100101010001110100001100010101000001000', '0000100010110110000111101001011000001010011110000100111101111010011101011000001001110101100010000111010100001000110001110001111101010100100101010000', '0000010110111011011100011101010001001011001110100011100001000101001111101100010100111110100100110001110011001011110001100000000100100111000011111000', '0001101110100101110101100101011101111100111010101011110001101010000111011101001000011100100010100111110110111001001000100111110111100100010010111000', '0000111000101011011101110110001110101111100010100000110111110010000111011101001000011101111011000101010100011111001000010000110101101110000010101000', '0001001010011001111011001110100001000110010111110011111001000010011101011000001001110100001101000101010010001101001010111100100101010101011100110000', '0000100010001111101111100100010010100000010111001011101101001000110101110010000011010110110011100111001001100101011010100101110011100001110010001000', '0000100100010010111100111000011000001100100001110101110011011001011011101111000100101111001011000000010111001011110011000000001101100001001000100000', '0001010000110010100010110111101111100100000011111000000010111010011101011000001001110101111100000011101010001010100001101000011010110000001001111000', '0001101101111011000010001000000010001110101111001111111111110001011011101111000100101110110001011010110110100111000000010010101110111001111011000000', '0001101000100010100001101100100101011100111000001101001010100010011101011000001001110100011100101100000010110101011011100111111011111101100000011000', '0001010110101101110000011111101100001000001001110101100000011010001111011010001000111100000100110001111110110111010101011011011100111000101111010000', '0000010000111000010001010010111110000100011000000101110110001000110101110010000011010111001100010011100001111101000101011110100001100010010110001000', '0000011110101100001001101000001010010100100111101101101000110101001111101100010100111111011001110000011000100001010011100000001100010110101001001000', '0001110111101011100000001011111101100110110001001100101111110010000111011101001000011101110010001111000010011110001101101111101011100001001100100000', '0001111110100011001100101111001001101000101110011100011000100001001011100001000100101110000110110010111111110101000110001011010110011010100011001000', '0001011100010110000001011011001100000101010000011010001000111111011110001001011101111001101111000011111110011001000010000011000101100011111001010000', '0001110111001111101101110111110000001110111011011100110110001001001011100001000100101110100101001001000110101110111110100110100100111111011001011000', '0001011111010100110010101100011000100011000011111000111100010101001111101100010100111111100110001110010110001110000101110000100101010111100100111000', '0001000100110100001010000101011001010000001111001110011010001001001011100001000100101111100011000100111100100010111001010010110100010000110000110000', '0001001100101001010111000101000101000000111101011111000001011010001111011010001000111100110110011000000011010000100110111101110011110011000011010000', '0001011010100110110011000101111111010011110001101000011100101000110101110010000011010110110100000111011101000001101010100001110111001011010101111000', '0000101010001100010011010101011110010101101110011110100110001010001111011010001000111100000010011011100001010001001111111100011111000011001010011000', '0000111001011100101100111001010101000101010111011110111101010001001011100001000100101111100010100101111011000101100000101111000101011110011111100000', '0000010101101111011001100001011100100101001000110111010110001111011110001001011101111000011010010010101111010000110000011001101011100000111110000000', '0001000001011000010001000100100111110011001101111100010011110010011101011000001001110100110100101101100011010111101110110010101101001110001101010000', '0000101000011101110011111001010011111001001010010000101110010001011011101111000100101111011111110000000100000110011001000100110000111001100000011000', '0000100101010011010110101001100100110001011010111110110100011101001111101100010100111110111000110110100011001010110011000111011111110011001011100000', '0001000110100001111010110101011111001000011100001111010110001001011011101111000100101111100001011001100110011001110101100001000001011011111110100000', '0001011010100110001000100000001110010000011000111001001110000001001011100001000100101110011011011001000111101010001010111001101100000100001101001000', '0000001010000101101010000000110000010101111011100110101000110111011110001001011101111001100011100100100100100000010010001111101111110011000001011000', '0000000111000111010110000000001001101110001001001101100110010001011011101111000100101111101011111100101001110100101000011100111001001101101011101000', '0000100100010111010011100110101011011010001011011011011101110010001111011010001000111100000110010111001010011100000011111100111000100100101010110000', '0000101111000000100110100001011000000011111111010101010011011010000111011101001000011101110010101101000100100000001100001000100111001010010000111000', '0000001001001101110111111011010011000011100001100011110011010001001011100001000100101110011100000010010111101100101011011111101011000000001100101000', '0001100111010111011000100111110000111010111001011100011111000000110101110010000011010111001000000010000010011010111001111001011011011111110101011000', '0000100010110111011001100110110010101011011110101001010001000001011011101111000100101111010101100010101110101111111011101000010111001111000101001000', '0001110000101111100101001101001111101011000000011011000101111000110101110010000011010111111100111011111000000001010111001100110100100011010000011000', '0000011000101001110100000000110101011101011010001101110110111001011011101111000100101111110110101011110110100111000000000011110011101000011000001000', '0000101001000100101010001110110111010000011011001011101010010111011110001001011101111001111010110101100100101001111000100000010001000110000000110000', '0000000111100101111111000110011101000110010110001110100101110001011011101111000100101110100010010011100010010001110100010101101101100111100110101000', '0001000011111010000000011010011001010010011111000011110111010010001111011010001000111101101110111000011010001010100111011000001000110000101000000000', '0001101000110010011001001110101101111110000111001101100110011001001011100001000100101110000101000111011001110001100011011101101000101001001001101000', '0001100111010000101101001110010001001001011000011000001011001010011101011000001001110101101110110101111101110010010010000001000100011111010100011000', '0001001101011001110000101110011110100001001000001111000100001001001011100001000100101110100010110100111010110010011000100111000100111111011000101000', '0001001101010000111101110111111011000100101011011001110001001010011101011000001001110101000000011110001101001010110001100011000110100010011010000000', '0000100100011000011010111010110001000101111010001001010110100001011011101111000100101111100001000101011111111110000011111111100110100100110000111000', '0001011101111100011001100110010001000101100001001001000010110001011011101111000100101110101100111111101111111001110110100101000011100110000001011000', '0001101000100100101011000001001101111011100110101010001110100010000111011101001000011101101101011111110001110001010000001111100110111101101000100000', '0000010101011110000000010011100010101011101111011001100111001010001111011010001000111100010001101011101000101100010110100100001101010110010111000000', '0001100011011000111011100010111111000000011111101010000010110001011011101111000100101111010100100110010000001010100011100001111011110010001011001000', '0001001011000011010010000001001110110110010101010011000101001000110101110010000011010111010010011000110011000110000101111000010100001000011111111000', '0000010100100110100110001010001011011000110000101011000001110001001011100001000100101111101010000111110111011010101010001100101100010100001000010000', '0001101100111011110100000010111000000110111101001110111110111010011101011000001001110101011110110010010011001011001110101001101010101001011000010000', '0001100011110111001100101110010110000110101101101111101101111001011011101111000100101111110001100010010000011100010000011011100010100111101001110000', '0001010011010010101001001000100111111010011101011001110110010001011011101111000100101111111010111010010001100100101100011000100110011001101101000000', '0000111011001001001100100100100101011111011100110101011100010010011101011000001001110101010100111100111001000001100010100111100001010011111111111000', '0001100101110101101110111111000100110000001111010000100001011101001111101100010100111110111111110111000010011100101001111011010100001010001010001000', '0000001000011111101111110000000000001100011111011010111010000111011110001001011101111001001100000001010100111111011000000110010111101001110010011000', '0000100000011100011111001001001000001000100010010111101011101010011101011000001001110100000000010010011001110100101111001110111111010000010001000000', '0001000101001011001111111101010111110010010110111111110000010001011011101111000100101111000100010000111110011101000001111100001001100100011100011000', '0001101101101010110000001001110111001001000001110110110000110001001011100001000100101111100001110001000000110101100001111111001001111001101101100000', '0000110011100000100000000010100100011001001000110010110101111001001011100001000100101110000111001100111111110011011001000001001000001111001101001000', '0001001111100001110110001010100011100011110011100001010100001001001011100001000100101111001000101100111101001010111000010111101000000001101100101000', '0000101001000010000001100001000011001010100011110111101110111001001011100001000100101110001010100101111010111000000010111011000010011001101000001000', '0001101000000100110100110001010111010111111001101110110101100111011110001001011101111001000110010011100100000100011101110110111010001001000111101000', '0000100000100110011100101001110010011011100010101101111001110010001111011010001000111101100000111011110010010111001100100010000101111111011101110000', '0000100111111010101000001110100011010010010010100001011010110000110101110010000011010110011000111000111111000100001010010000011011001000011100110000', '0001110110111100101101010011111100101100100100110001110110111001001011100001000100101110010111011011100001001010010100010101110100011111010101001000', '0000111001001000110010011110000010011101000001010111011011111010011101011000001001110101011101101100101110010111010001100100000011100100111101010000', '0001000001010011101010101011111100010010101110100001000111110010011101011000001001110101100000100101011101111101101101111000001101101010001000101000', '0001101000001011010011001010011010100110010100011010101101011010000111011101001000011101100010011011111111101011100110000011110110001111000101101000', '0000001010101101011001000000001000001001110100000111000000101001001011100001000100101110111111011101110101010011001110111111101001011010110000101000', '0001011110101111110100110010010110011100111010011001001110011111011110001001011101111000101010001111000111000101111000100011100010100010010100010000', '0001000001011110010010100001100010111111000111001111010101011111011110001001011101111001010010100101110110111111001111110010111100111010110011110000', '0001111100100010101100010111000000011011001111001101101001000010001111011010001000111101111000000101111001110101101001101010001110100111101011001000', '0000000011001001101001100111101011001011000100101100101001100010001111011010001000111101100100101001010100111000010001011000100110010101010111000000', '0001111000011111011100011010110000000010000000100000111000100010011101011000001001110100011101011101001001000111011101100001011010101000011011011000', '0001011000010101011100101011111010110101011110011011001011010010001111011010001000111100110111000110100100001100110100000001100100100111101010011000', '0001010101101101101001011100101001110000100101011110100011100010011101011000001001110100111100001000000111000001111100011011101000101100111100111000', '0000010101001010001110001001101101011011000110011011110111111000110101110010000011010110000000110010100100111001010110110011011101011001110100100000', '0001111111000101100000111010111010011010011110110010111000010101001111101100010100111110000110010011101101011111001000010001111111000111001111011000', '0000100101100011001010101100011110000111001110010010010000100001011011101111000100101110001111010000001000001101011010110101010111011011001101101000', '0000110000111101100001011100100011101011011000111100001000000111011110001001011101111000111000000111100100101000000101100011011001111100110011110000', '0000011001111001100111110110110000001111110101011110100011010010011101011000001001110101001101110111111100001001000101101101100110001111101011010000', '0000100001011010001010000101110000111100011110110010000010101000110101110010000011010111010001010101111111111101101100110101111010110100001110101000', '0000000111101000111001101101110011001100100000101111001011001111011110001001011101111001010011110001010010000011001100100001011001111010101011011000' ] # 102 sequential framenumbers framenumbers_input = [879852, 879853, 879854, 879855, 879856, 879857, 879858, 879859, 879860, 879861, 879862, 879863, 879864, 879865, 879866, 879867, 879868, 879869, 879870, 879871, 879872, 879873, 879874, 879875, 879876, 879877, 879878, 879879, 879880, 879881, 879882, 879883, 879884, 879885, 879886, 879887, 879888, 879889, 879890, 879891, 879892, 879893, 879894, 879895, 879896, 879897, 879898, 879899, 879900, 879901, 879902, 879903, 879904, 879905, 879906, 879907, 879908, 879909, 879910, 879911, 879912, 879913, 879914, 879915, 879916, 879917, 879918, 879919, 879920, 879921, 879922, 879923, 879924, 879925, 879926, 879927, 879928, 879929, 879930, 879931, 879932, 879933, 879934, 879935, 879936, 879937, 879938, 879939, 879940, 879941, 879942, 879943, 879944, 879945, 879946, 879947, 879948, 879949, 879950, 879951, 879952, 879953] timeslots_input = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] def setUp (self): self.tb = gr.top_block () def tearDown (self): self.tb = None def test_001_sdcch8 (self): bursts_expected = [ '0000011011010111011111101100010100110110000001100011100001010001011011101111000100101110001110000011001100100101111000001010000101010000110101110000', '0000111100110111001011010100010010110100101010000000010001110010011101011000001001110100001010011111111111001010111010111010001111111101111110101000', '0000111101101110011111010100010100110001101110001001111100100101001111101100010100111111100010010001001100000000111010001000100011010000110111110000', '0000011100010011111011011001110010011000001111111110101000100000110101110010000011010111101011000100101011000011011011110000010001100110011010001000', '0001000001011000010001000100100111110011001101111100010011110010011101011000001001110100110100101101100011010111101110110010101101001110001101010000', '0000101000011101110011111001010011111001001010010000101110010001011011101111000100101111011111110000000100000110011001000100110000111001100000011000', '0000100101010011010110101001100100110001011010111110110100011101001111101100010100111110111000110110100011001010110011000111011111110011001011100000', '0001000110100001111010110101011111001000011100001111010110001001011011101111000100101111100001011001100110011001110101100001000001011011111110100000', '0001001101011001110000101110011110100001001000001111000100001001001011100001000100101110100010110100111010110010011000100111000100111111011000101000', '0001001101010000111101110111111011000100101011011001110001001010011101011000001001110101000000011110001101001010110001100011000110100010011010000000', '0000100100011000011010111010110001000101111010001001010110100001011011101111000100101111100001000101011111111110000011111111100110100100110000111000', '0001011101111100011001100110010001000101100001001001000010110001011011101111000100101110101100111111101111111001110110100101000011100110000001011000', ] subslot = 2 src = grgsm.burst_source(self.framenumbers_input, self.timeslots_input, self.bursts_input) ss_filter = grgsm.burst_sdcch_subslot_filter(grgsm.SS_FILTER_SDCCH8, subslot) sink = grgsm.burst_sink() self.tb.msg_connect(src, "out", ss_filter, "in") self.tb.msg_connect(ss_filter, "out", sink, "in") self.tb.run () bursts_result = list(sink.get_burst_data()) self.assertEqual(bursts_expected, bursts_result) def test_002_sdcch4 (self): bursts_expected = [ '0001110111001111101101110111110000001110111011011100110110001001001011100001000100101110100101001001000110101110111110100110100100111111011001011000', '0001011111010100110010101100011000100011000011111000111100010101001111101100010100111111100110001110010110001110000101110000100101010111100100111000', '0001000100110100001010000101011001010000001111001110011010001001001011100001000100101111100011000100111100100010111001010010110100010000110000110000', '0001001100101001010111000101000101000000111101011111000001011010001111011010001000111100110110011000000011010000100110111101110011110011000011010000', '0001110110111100101101010011111100101100100100110001110110111001001011100001000100101110010111011011100001001010010100010101110100011111010101001000', '0000111001001000110010011110000010011101000001010111011011111010011101011000001001110101011101101100101110010111010001100100000011100100111101010000', '0001000001010011101010101011111100010010101110100001000111110010011101011000001001110101100000100101011101111101101101111000001101101010001000101000', '0001101000001011010011001010011010100110010100011010101101011010000111011101001000011101100010011011111111101011100110000011110110001111000101101000', '0001011000010101011100101011111010110101011110011011001011010010001111011010001000111100110111000110100100001100110100000001100100100111101010011000', '0001010101101101101001011100101001110000100101011110100011100010011101011000001001110100111100001000000111000001111100011011101000101100111100111000', '0000010101001010001110001001101101011011000110011011110111111000110101110010000011010110000000110010100100111001010110110011011101011001110100100000', '0001111111000101100000111010111010011010011110110010111000010101001111101100010100111110000110010011101101011111001000010001111111000111001111011000', ] subslot = 2 src = grgsm.burst_source(self.framenumbers_input, self.timeslots_input, self.bursts_input) splitter = grgsm.burst_sdcch_subslot_filter(grgsm.SS_FILTER_SDCCH4, subslot) sink = grgsm.burst_sink() self.tb.msg_connect(src, "out", splitter, "in") self.tb.msg_connect(splitter, "out", sink, "in") self.tb.run () bursts_result = list(sink.get_burst_data()) self.assertEqual(bursts_result, bursts_expected) if __name__ == '__main__': gr_unittest.run(qa_burst_sdcch_subslot_filter, "qa_burst_sdcch_subslot_filter.xml") gr-gsm-0.41.2/python/qa_burst_sdcch_subslot_splitter.py000077500000000000000000001321451316153413000233600ustar00rootroot00000000000000#!/usr/bin/env python # -*- coding: utf-8 -*- # @file # @author (C) 2015 by Roman Khassraf # @section LICENSE # # Gr-gsm is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Gr-gsm is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with gr-gsm; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # # from gnuradio import gr, gr_unittest, blocks import grgsm_swig as grgsm import pmt class qa_burst_sdcch_subslot_splitter (gr_unittest.TestCase): # 102 random bursts as test input bursts_input = [ '0000111100101011111011010010011001000100001001110110000110110001011011101111000100101111111000110000001111111111000111100100011111010100010011111000', '0001111110000000110110101010001000101000001101111100101100110010001111011010001000111100001010011101000111010111000100000111001111110011000011011000', '0001101110111011011011011010000001011011001011000100100110010101001111101100010100111110110011001100100011111010110111011001000111101011100001111000', '0000001011100110100011110111010101111000011111001011010011110000110101110010000011010110010011111001000110001111111010111011011001101010001100110000', '0001011001110011011101111111100110110111011101001110111110000101001111101100010100111110001111100000000110001000010000010111111011110101100000111000', '0001110110011011010011100010101010000100011000001111110101111101001111101100010100111110100001001101000100000001011001010110011111100010001111001000', '0001101100101101011110011001110110011100001100100100100110000010001111011010001000111101101101001100100001110001011001000001100000011111101000011000', '0000101100001011101001010001111001000000010100000111100110101000110101110010000011010110110000110010100011001111101101101001110111101001000011111000', '0000011011010111011111101100010100110110000001100011100001010001011011101111000100101110001110000011001100100101111000001010000101010000110101110000', '0000111100110111001011010100010010110100101010000000010001110010011101011000001001110100001010011111111111001010111010111010001111111101111110101000', '0000111101101110011111010100010100110001101110001001111100100101001111101100010100111111100010010001001100000000111010001000100011010000110111110000', '0000011100010011111011011001110010011000001111111110101000100000110101110010000011010111101011000100101011000011011011110000010001100110011010001000', '0000011011100100011101000010111010101101001111110000110001111010000111011101001000011101111110101010000011100100111101000111101110011011001001100000', '0000110100110111001010100011100010101001001010011001001111001001001011100001000100101111001001100100001111100111000101110111100011101100110100010000', '0000011101101000110111010010111001011110101000001011111000101010000111011101001000011100100100010110101110101010001000011001001110100001000101001000', '0000101000110000011100111010101000001101000111111101100100110010011101011000001001110101001101110101011110010100101010001110100001100010101000001000', '0000100010110110000111101001011000001010011110000100111101111010011101011000001001110101100010000111010100001000110001110001111101010100100101010000', '0000010110111011011100011101010001001011001110100011100001000101001111101100010100111110100100110001110011001011110001100000000100100111000011111000', '0001101110100101110101100101011101111100111010101011110001101010000111011101001000011100100010100111110110111001001000100111110111100100010010111000', '0000111000101011011101110110001110101111100010100000110111110010000111011101001000011101111011000101010100011111001000010000110101101110000010101000', '0001001010011001111011001110100001000110010111110011111001000010011101011000001001110100001101000101010010001101001010111100100101010101011100110000', '0000100010001111101111100100010010100000010111001011101101001000110101110010000011010110110011100111001001100101011010100101110011100001110010001000', '0000100100010010111100111000011000001100100001110101110011011001011011101111000100101111001011000000010111001011110011000000001101100001001000100000', '0001010000110010100010110111101111100100000011111000000010111010011101011000001001110101111100000011101010001010100001101000011010110000001001111000', '0001101101111011000010001000000010001110101111001111111111110001011011101111000100101110110001011010110110100111000000010010101110111001111011000000', '0001101000100010100001101100100101011100111000001101001010100010011101011000001001110100011100101100000010110101011011100111111011111101100000011000', '0001010110101101110000011111101100001000001001110101100000011010001111011010001000111100000100110001111110110111010101011011011100111000101111010000', '0000010000111000010001010010111110000100011000000101110110001000110101110010000011010111001100010011100001111101000101011110100001100010010110001000', '0000011110101100001001101000001010010100100111101101101000110101001111101100010100111111011001110000011000100001010011100000001100010110101001001000', '0001110111101011100000001011111101100110110001001100101111110010000111011101001000011101110010001111000010011110001101101111101011100001001100100000', '0001111110100011001100101111001001101000101110011100011000100001001011100001000100101110000110110010111111110101000110001011010110011010100011001000', '0001011100010110000001011011001100000101010000011010001000111111011110001001011101111001101111000011111110011001000010000011000101100011111001010000', '0001110111001111101101110111110000001110111011011100110110001001001011100001000100101110100101001001000110101110111110100110100100111111011001011000', '0001011111010100110010101100011000100011000011111000111100010101001111101100010100111111100110001110010110001110000101110000100101010111100100111000', '0001000100110100001010000101011001010000001111001110011010001001001011100001000100101111100011000100111100100010111001010010110100010000110000110000', '0001001100101001010111000101000101000000111101011111000001011010001111011010001000111100110110011000000011010000100110111101110011110011000011010000', '0001011010100110110011000101111111010011110001101000011100101000110101110010000011010110110100000111011101000001101010100001110111001011010101111000', '0000101010001100010011010101011110010101101110011110100110001010001111011010001000111100000010011011100001010001001111111100011111000011001010011000', '0000111001011100101100111001010101000101010111011110111101010001001011100001000100101111100010100101111011000101100000101111000101011110011111100000', '0000010101101111011001100001011100100101001000110111010110001111011110001001011101111000011010010010101111010000110000011001101011100000111110000000', '0001000001011000010001000100100111110011001101111100010011110010011101011000001001110100110100101101100011010111101110110010101101001110001101010000', '0000101000011101110011111001010011111001001010010000101110010001011011101111000100101111011111110000000100000110011001000100110000111001100000011000', '0000100101010011010110101001100100110001011010111110110100011101001111101100010100111110111000110110100011001010110011000111011111110011001011100000', '0001000110100001111010110101011111001000011100001111010110001001011011101111000100101111100001011001100110011001110101100001000001011011111110100000', '0001011010100110001000100000001110010000011000111001001110000001001011100001000100101110011011011001000111101010001010111001101100000100001101001000', '0000001010000101101010000000110000010101111011100110101000110111011110001001011101111001100011100100100100100000010010001111101111110011000001011000', '0000000111000111010110000000001001101110001001001101100110010001011011101111000100101111101011111100101001110100101000011100111001001101101011101000', '0000100100010111010011100110101011011010001011011011011101110010001111011010001000111100000110010111001010011100000011111100111000100100101010110000', '0000101111000000100110100001011000000011111111010101010011011010000111011101001000011101110010101101000100100000001100001000100111001010010000111000', '0000001001001101110111111011010011000011100001100011110011010001001011100001000100101110011100000010010111101100101011011111101011000000001100101000', '0001100111010111011000100111110000111010111001011100011111000000110101110010000011010111001000000010000010011010111001111001011011011111110101011000', '0000100010110111011001100110110010101011011110101001010001000001011011101111000100101111010101100010101110101111111011101000010111001111000101001000', '0001110000101111100101001101001111101011000000011011000101111000110101110010000011010111111100111011111000000001010111001100110100100011010000011000', '0000011000101001110100000000110101011101011010001101110110111001011011101111000100101111110110101011110110100111000000000011110011101000011000001000', '0000101001000100101010001110110111010000011011001011101010010111011110001001011101111001111010110101100100101001111000100000010001000110000000110000', '0000000111100101111111000110011101000110010110001110100101110001011011101111000100101110100010010011100010010001110100010101101101100111100110101000', '0001000011111010000000011010011001010010011111000011110111010010001111011010001000111101101110111000011010001010100111011000001000110000101000000000', '0001101000110010011001001110101101111110000111001101100110011001001011100001000100101110000101000111011001110001100011011101101000101001001001101000', '0001100111010000101101001110010001001001011000011000001011001010011101011000001001110101101110110101111101110010010010000001000100011111010100011000', '0001001101011001110000101110011110100001001000001111000100001001001011100001000100101110100010110100111010110010011000100111000100111111011000101000', '0001001101010000111101110111111011000100101011011001110001001010011101011000001001110101000000011110001101001010110001100011000110100010011010000000', '0000100100011000011010111010110001000101111010001001010110100001011011101111000100101111100001000101011111111110000011111111100110100100110000111000', '0001011101111100011001100110010001000101100001001001000010110001011011101111000100101110101100111111101111111001110110100101000011100110000001011000', '0001101000100100101011000001001101111011100110101010001110100010000111011101001000011101101101011111110001110001010000001111100110111101101000100000', '0000010101011110000000010011100010101011101111011001100111001010001111011010001000111100010001101011101000101100010110100100001101010110010111000000', '0001100011011000111011100010111111000000011111101010000010110001011011101111000100101111010100100110010000001010100011100001111011110010001011001000', '0001001011000011010010000001001110110110010101010011000101001000110101110010000011010111010010011000110011000110000101111000010100001000011111111000', '0000010100100110100110001010001011011000110000101011000001110001001011100001000100101111101010000111110111011010101010001100101100010100001000010000', '0001101100111011110100000010111000000110111101001110111110111010011101011000001001110101011110110010010011001011001110101001101010101001011000010000', '0001100011110111001100101110010110000110101101101111101101111001011011101111000100101111110001100010010000011100010000011011100010100111101001110000', '0001010011010010101001001000100111111010011101011001110110010001011011101111000100101111111010111010010001100100101100011000100110011001101101000000', '0000111011001001001100100100100101011111011100110101011100010010011101011000001001110101010100111100111001000001100010100111100001010011111111111000', '0001100101110101101110111111000100110000001111010000100001011101001111101100010100111110111111110111000010011100101001111011010100001010001010001000', '0000001000011111101111110000000000001100011111011010111010000111011110001001011101111001001100000001010100111111011000000110010111101001110010011000', '0000100000011100011111001001001000001000100010010111101011101010011101011000001001110100000000010010011001110100101111001110111111010000010001000000', '0001000101001011001111111101010111110010010110111111110000010001011011101111000100101111000100010000111110011101000001111100001001100100011100011000', '0001101101101010110000001001110111001001000001110110110000110001001011100001000100101111100001110001000000110101100001111111001001111001101101100000', '0000110011100000100000000010100100011001001000110010110101111001001011100001000100101110000111001100111111110011011001000001001000001111001101001000', '0001001111100001110110001010100011100011110011100001010100001001001011100001000100101111001000101100111101001010111000010111101000000001101100101000', '0000101001000010000001100001000011001010100011110111101110111001001011100001000100101110001010100101111010111000000010111011000010011001101000001000', '0001101000000100110100110001010111010111111001101110110101100111011110001001011101111001000110010011100100000100011101110110111010001001000111101000', '0000100000100110011100101001110010011011100010101101111001110010001111011010001000111101100000111011110010010111001100100010000101111111011101110000', '0000100111111010101000001110100011010010010010100001011010110000110101110010000011010110011000111000111111000100001010010000011011001000011100110000', '0001110110111100101101010011111100101100100100110001110110111001001011100001000100101110010111011011100001001010010100010101110100011111010101001000', '0000111001001000110010011110000010011101000001010111011011111010011101011000001001110101011101101100101110010111010001100100000011100100111101010000', '0001000001010011101010101011111100010010101110100001000111110010011101011000001001110101100000100101011101111101101101111000001101101010001000101000', '0001101000001011010011001010011010100110010100011010101101011010000111011101001000011101100010011011111111101011100110000011110110001111000101101000', '0000001010101101011001000000001000001001110100000111000000101001001011100001000100101110111111011101110101010011001110111111101001011010110000101000', '0001011110101111110100110010010110011100111010011001001110011111011110001001011101111000101010001111000111000101111000100011100010100010010100010000', '0001000001011110010010100001100010111111000111001111010101011111011110001001011101111001010010100101110110111111001111110010111100111010110011110000', '0001111100100010101100010111000000011011001111001101101001000010001111011010001000111101111000000101111001110101101001101010001110100111101011001000', '0000000011001001101001100111101011001011000100101100101001100010001111011010001000111101100100101001010100111000010001011000100110010101010111000000', '0001111000011111011100011010110000000010000000100000111000100010011101011000001001110100011101011101001001000111011101100001011010101000011011011000', '0001011000010101011100101011111010110101011110011011001011010010001111011010001000111100110111000110100100001100110100000001100100100111101010011000', '0001010101101101101001011100101001110000100101011110100011100010011101011000001001110100111100001000000111000001111100011011101000101100111100111000', '0000010101001010001110001001101101011011000110011011110111111000110101110010000011010110000000110010100100111001010110110011011101011001110100100000', '0001111111000101100000111010111010011010011110110010111000010101001111101100010100111110000110010011101101011111001000010001111111000111001111011000', '0000100101100011001010101100011110000111001110010010010000100001011011101111000100101110001111010000001000001101011010110101010111011011001101101000', '0000110000111101100001011100100011101011011000111100001000000111011110001001011101111000111000000111100100101000000101100011011001111100110011110000', '0000011001111001100111110110110000001111110101011110100011010010011101011000001001110101001101110111111100001001000101101101100110001111101011010000', '0000100001011010001010000101110000111100011110110010000010101000110101110010000011010111010001010101111111111101101100110101111010110100001110101000', '0000000111101000111001101101110011001100100000101111001011001111011110001001011101111001010011110001010010000011001100100001011001111010101011011000' ] # 102 sequential framenumbers framenumbers_input = [879852, 879853, 879854, 879855, 879856, 879857, 879858, 879859, 879860, 879861, 879862, 879863, 879864, 879865, 879866, 879867, 879868, 879869, 879870, 879871, 879872, 879873, 879874, 879875, 879876, 879877, 879878, 879879, 879880, 879881, 879882, 879883, 879884, 879885, 879886, 879887, 879888, 879889, 879890, 879891, 879892, 879893, 879894, 879895, 879896, 879897, 879898, 879899, 879900, 879901, 879902, 879903, 879904, 879905, 879906, 879907, 879908, 879909, 879910, 879911, 879912, 879913, 879914, 879915, 879916, 879917, 879918, 879919, 879920, 879921, 879922, 879923, 879924, 879925, 879926, 879927, 879928, 879929, 879930, 879931, 879932, 879933, 879934, 879935, 879936, 879937, 879938, 879939, 879940, 879941, 879942, 879943, 879944, 879945, 879946, 879947, 879948, 879949, 879950, 879951, 879952, 879953] timeslots_input = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] def setUp (self): self.tb = gr.top_block () def tearDown (self): self.tb = None def test_001_sdcch8 (self): bursts_expected_0 = [ '0000111100101011111011010010011001000100001001110110000110110001011011101111000100101111111000110000001111111111000111100100011111010100010011111000', '0001111110000000110110101010001000101000001101111100101100110010001111011010001000111100001010011101000111010111000100000111001111110011000011011000', '0001101110111011011011011010000001011011001011000100100110010101001111101100010100111110110011001100100011111010110111011001000111101011100001111000', '0000001011100110100011110111010101111000011111001011010011110000110101110010000011010110010011111001000110001111111010111011011001101010001100110000', '0001110111001111101101110111110000001110111011011100110110001001001011100001000100101110100101001001000110101110111110100110100100111111011001011000', '0001011111010100110010101100011000100011000011111000111100010101001111101100010100111111100110001110010110001110000101110000100101010111100100111000', '0001000100110100001010000101011001010000001111001110011010001001001011100001000100101111100011000100111100100010111001010010110100010000110000110000', '0001001100101001010111000101000101000000111101011111000001011010001111011010001000111100110110011000000011010000100110111101110011110011000011010000', '0000100010110111011001100110110010101011011110101001010001000001011011101111000100101111010101100010101110101111111011101000010111001111000101001000', '0001110000101111100101001101001111101011000000011011000101111000110101110010000011010111111100111011111000000001010111001100110100100011010000011000', '0000011000101001110100000000110101011101011010001101110110111001011011101111000100101111110110101011110110100111000000000011110011101000011000001000', '0000101001000100101010001110110111010000011011001011101010010111011110001001011101111001111010110101100100101001111000100000010001000110000000110000', ] bursts_expected_1 = [ '0001011001110011011101111111100110110111011101001110111110000101001111101100010100111110001111100000000110001000010000010111111011110101100000111000', '0001110110011011010011100010101010000100011000001111110101111101001111101100010100111110100001001101000100000001011001010110011111100010001111001000', '0001101100101101011110011001110110011100001100100100100110000010001111011010001000111101101101001100100001110001011001000001100000011111101000011000', '0000101100001011101001010001111001000000010100000111100110101000110101110010000011010110110000110010100011001111101101101001110111101001000011111000', '0001011010100110110011000101111111010011110001101000011100101000110101110010000011010110110100000111011101000001101010100001110111001011010101111000', '0000101010001100010011010101011110010101101110011110100110001010001111011010001000111100000010011011100001010001001111111100011111000011001010011000', '0000111001011100101100111001010101000101010111011110111101010001001011100001000100101111100010100101111011000101100000101111000101011110011111100000', '0000010101101111011001100001011100100101001000110111010110001111011110001001011101111000011010010010101111010000110000011001101011100000111110000000', '0000000111100101111111000110011101000110010110001110100101110001011011101111000100101110100010010011100010010001110100010101101101100111100110101000', '0001000011111010000000011010011001010010011111000011110111010010001111011010001000111101101110111000011010001010100111011000001000110000101000000000', '0001101000110010011001001110101101111110000111001101100110011001001011100001000100101110000101000111011001110001100011011101101000101001001001101000', '0001100111010000101101001110010001001001011000011000001011001010011101011000001001110101101110110101111101110010010010000001000100011111010100011000', ] bursts_expected_2 = [ '0000011011010111011111101100010100110110000001100011100001010001011011101111000100101110001110000011001100100101111000001010000101010000110101110000', '0000111100110111001011010100010010110100101010000000010001110010011101011000001001110100001010011111111111001010111010111010001111111101111110101000', '0000111101101110011111010100010100110001101110001001111100100101001111101100010100111111100010010001001100000000111010001000100011010000110111110000', '0000011100010011111011011001110010011000001111111110101000100000110101110010000011010111101011000100101011000011011011110000010001100110011010001000', '0001000001011000010001000100100111110011001101111100010011110010011101011000001001110100110100101101100011010111101110110010101101001110001101010000', '0000101000011101110011111001010011111001001010010000101110010001011011101111000100101111011111110000000100000110011001000100110000111001100000011000', '0000100101010011010110101001100100110001011010111110110100011101001111101100010100111110111000110110100011001010110011000111011111110011001011100000', '0001000110100001111010110101011111001000011100001111010110001001011011101111000100101111100001011001100110011001110101100001000001011011111110100000', '0001001101011001110000101110011110100001001000001111000100001001001011100001000100101110100010110100111010110010011000100111000100111111011000101000', '0001001101010000111101110111111011000100101011011001110001001010011101011000001001110101000000011110001101001010110001100011000110100010011010000000', '0000100100011000011010111010110001000101111010001001010110100001011011101111000100101111100001000101011111111110000011111111100110100100110000111000', '0001011101111100011001100110010001000101100001001001000010110001011011101111000100101110101100111111101111111001110110100101000011100110000001011000', ] bursts_expected_3 = [ '0000011011100100011101000010111010101101001111110000110001111010000111011101001000011101111110101010000011100100111101000111101110011011001001100000', '0000110100110111001010100011100010101001001010011001001111001001001011100001000100101111001001100100001111100111000101110111100011101100110100010000', '0000011101101000110111010010111001011110101000001011111000101010000111011101001000011100100100010110101110101010001000011001001110100001000101001000', '0000101000110000011100111010101000001101000111111101100100110010011101011000001001110101001101110101011110010100101010001110100001100010101000001000', '0001011010100110001000100000001110010000011000111001001110000001001011100001000100101110011011011001000111101010001010111001101100000100001101001000', '0000001010000101101010000000110000010101111011100110101000110111011110001001011101111001100011100100100100100000010010001111101111110011000001011000', '0000000111000111010110000000001001101110001001001101100110010001011011101111000100101111101011111100101001110100101000011100111001001101101011101000', '0000100100010111010011100110101011011010001011011011011101110010001111011010001000111100000110010111001010011100000011111100111000100100101010110000', '0001101000100100101011000001001101111011100110101010001110100010000111011101001000011101101101011111110001110001010000001111100110111101101000100000', '0000010101011110000000010011100010101011101111011001100111001010001111011010001000111100010001101011101000101100010110100100001101010110010111000000', '0001100011011000111011100010111111000000011111101010000010110001011011101111000100101111010100100110010000001010100011100001111011110010001011001000', '0001001011000011010010000001001110110110010101010011000101001000110101110010000011010111010010011000110011000110000101111000010100001000011111111000', ] bursts_expected_4 = [ '0000100010110110000111101001011000001010011110000100111101111010011101011000001001110101100010000111010100001000110001110001111101010100100101010000', '0000010110111011011100011101010001001011001110100011100001000101001111101100010100111110100100110001110011001011110001100000000100100111000011111000', '0001101110100101110101100101011101111100111010101011110001101010000111011101001000011100100010100111110110111001001000100111110111100100010010111000', '0000111000101011011101110110001110101111100010100000110111110010000111011101001000011101111011000101010100011111001000010000110101101110000010101000', '0000010100100110100110001010001011011000110000101011000001110001001011100001000100101111101010000111110111011010101010001100101100010100001000010000', '0001101100111011110100000010111000000110111101001110111110111010011101011000001001110101011110110010010011001011001110101001101010101001011000010000', '0001100011110111001100101110010110000110101101101111101101111001011011101111000100101111110001100010010000011100010000011011100010100111101001110000', '0001010011010010101001001000100111111010011101011001110110010001011011101111000100101111111010111010010001100100101100011000100110011001101101000000', '0001110110111100101101010011111100101100100100110001110110111001001011100001000100101110010111011011100001001010010100010101110100011111010101001000', '0000111001001000110010011110000010011101000001010111011011111010011101011000001001110101011101101100101110010111010001100100000011100100111101010000', '0001000001010011101010101011111100010010101110100001000111110010011101011000001001110101100000100101011101111101101101111000001101101010001000101000', '0001101000001011010011001010011010100110010100011010101101011010000111011101001000011101100010011011111111101011100110000011110110001111000101101000', ] bursts_expected_5 = [ '0001001010011001111011001110100001000110010111110011111001000010011101011000001001110100001101000101010010001101001010111100100101010101011100110000', '0000100010001111101111100100010010100000010111001011101101001000110101110010000011010110110011100111001001100101011010100101110011100001110010001000', '0000100100010010111100111000011000001100100001110101110011011001011011101111000100101111001011000000010111001011110011000000001101100001001000100000', '0001010000110010100010110111101111100100000011111000000010111010011101011000001001110101111100000011101010001010100001101000011010110000001001111000', '0000111011001001001100100100100101011111011100110101011100010010011101011000001001110101010100111100111001000001100010100111100001010011111111111000', '0001100101110101101110111111000100110000001111010000100001011101001111101100010100111110111111110111000010011100101001111011010100001010001010001000', '0000001000011111101111110000000000001100011111011010111010000111011110001001011101111001001100000001010100111111011000000110010111101001110010011000', '0000100000011100011111001001001000001000100010010111101011101010011101011000001001110100000000010010011001110100101111001110111111010000010001000000', '0000001010101101011001000000001000001001110100000111000000101001001011100001000100101110111111011101110101010011001110111111101001011010110000101000', '0001011110101111110100110010010110011100111010011001001110011111011110001001011101111000101010001111000111000101111000100011100010100010010100010000', '0001000001011110010010100001100010111111000111001111010101011111011110001001011101111001010010100101110110111111001111110010111100111010110011110000', '0001111100100010101100010111000000011011001111001101101001000010001111011010001000111101111000000101111001110101101001101010001110100111101011001000', ] bursts_expected_6 = [ '0001101101111011000010001000000010001110101111001111111111110001011011101111000100101110110001011010110110100111000000010010101110111001111011000000', '0001101000100010100001101100100101011100111000001101001010100010011101011000001001110100011100101100000010110101011011100111111011111101100000011000', '0001010110101101110000011111101100001000001001110101100000011010001111011010001000111100000100110001111110110111010101011011011100111000101111010000', '0000010000111000010001010010111110000100011000000101110110001000110101110010000011010111001100010011100001111101000101011110100001100010010110001000', '0001000101001011001111111101010111110010010110111111110000010001011011101111000100101111000100010000111110011101000001111100001001100100011100011000', '0001101101101010110000001001110111001001000001110110110000110001001011100001000100101111100001110001000000110101100001111111001001111001101101100000', '0000110011100000100000000010100100011001001000110010110101111001001011100001000100101110000111001100111111110011011001000001001000001111001101001000', '0001001111100001110110001010100011100011110011100001010100001001001011100001000100101111001000101100111101001010111000010111101000000001101100101000', '0000000011001001101001100111101011001011000100101100101001100010001111011010001000111101100100101001010100111000010001011000100110010101010111000000', '0001111000011111011100011010110000000010000000100000111000100010011101011000001001110100011101011101001001000111011101100001011010101000011011011000', '0001011000010101011100101011111010110101011110011011001011010010001111011010001000111100110111000110100100001100110100000001100100100111101010011000', '0001010101101101101001011100101001110000100101011110100011100010011101011000001001110100111100001000000111000001111100011011101000101100111100111000', ] bursts_expected_7 = [ '0000011110101100001001101000001010010100100111101101101000110101001111101100010100111111011001110000011000100001010011100000001100010110101001001000', '0001110111101011100000001011111101100110110001001100101111110010000111011101001000011101110010001111000010011110001101101111101011100001001100100000', '0001111110100011001100101111001001101000101110011100011000100001001011100001000100101110000110110010111111110101000110001011010110011010100011001000', '0001011100010110000001011011001100000101010000011010001000111111011110001001011101111001101111000011111110011001000010000011000101100011111001010000', '0000101001000010000001100001000011001010100011110111101110111001001011100001000100101110001010100101111010111000000010111011000010011001101000001000', '0001101000000100110100110001010111010111111001101110110101100111011110001001011101111001000110010011100100000100011101110110111010001001000111101000', '0000100000100110011100101001110010011011100010101101111001110010001111011010001000111101100000111011110010010111001100100010000101111111011101110000', '0000100111111010101000001110100011010010010010100001011010110000110101110010000011010110011000111000111111000100001010010000011011001000011100110000', '0000010101001010001110001001101101011011000110011011110111111000110101110010000011010110000000110010100100111001010110110011011101011001110100100000', '0001111111000101100000111010111010011010011110110010111000010101001111101100010100111110000110010011101101011111001000010001111111000111001111011000', '0000100101100011001010101100011110000111001110010010010000100001011011101111000100101110001111010000001000001101011010110101010111011011001101101000', '0000110000111101100001011100100011101011011000111100001000000111011110001001011101111000111000000111100100101000000101100011011001111100110011110000', ] src = grgsm.burst_source(self.framenumbers_input, self.timeslots_input, self.bursts_input) splitter = grgsm.burst_sdcch_subslot_splitter(grgsm.SPLITTER_SDCCH8) sink_0 = grgsm.burst_sink() sink_1 = grgsm.burst_sink() sink_2 = grgsm.burst_sink() sink_3 = grgsm.burst_sink() sink_4 = grgsm.burst_sink() sink_5 = grgsm.burst_sink() sink_6 = grgsm.burst_sink() sink_7 = grgsm.burst_sink() self.tb.msg_connect(src, "out", splitter, "in") self.tb.msg_connect(splitter, "out0", sink_0, "in") self.tb.msg_connect(splitter, "out1", sink_1, "in") self.tb.msg_connect(splitter, "out2", sink_2, "in") self.tb.msg_connect(splitter, "out3", sink_3, "in") self.tb.msg_connect(splitter, "out4", sink_4, "in") self.tb.msg_connect(splitter, "out5", sink_5, "in") self.tb.msg_connect(splitter, "out6", sink_6, "in") self.tb.msg_connect(splitter, "out7", sink_7, "in") self.tb.run () bursts_result_0 = list(sink_0.get_burst_data()) bursts_result_1 = list(sink_1.get_burst_data()) bursts_result_2 = list(sink_2.get_burst_data()) bursts_result_3 = list(sink_3.get_burst_data()) bursts_result_4 = list(sink_4.get_burst_data()) bursts_result_5 = list(sink_5.get_burst_data()) bursts_result_6 = list(sink_6.get_burst_data()) bursts_result_7 = list(sink_7.get_burst_data()) self.assertEqual(bursts_expected_0, bursts_result_0) self.assertEqual(bursts_expected_1, bursts_result_1) self.assertEqual(bursts_expected_2, bursts_result_2) self.assertEqual(bursts_expected_3, bursts_result_3) self.assertEqual(bursts_expected_4, bursts_result_4) self.assertEqual(bursts_expected_5, bursts_result_5) self.assertEqual(bursts_expected_6, bursts_result_6) self.assertEqual(bursts_expected_7, bursts_result_7) def test_002_sdcch4 (self): bursts_expected_0 = [ '0000100100010010111100111000011000001100100001110101110011011001011011101111000100101111001011000000010111001011110011000000001101100001001000100000', '0001010000110010100010110111101111100100000011111000000010111010011101011000001001110101111100000011101010001010100001101000011010110000001001111000', '0001101101111011000010001000000010001110101111001111111111110001011011101111000100101110110001011010110110100111000000010010101110111001111011000000', '0001101000100010100001101100100101011100111000001101001010100010011101011000001001110100011100101100000010110101011011100111111011111101100000011000', '0000100101010011010110101001100100110001011010111110110100011101001111101100010100111110111000110110100011001010110011000111011111110011001011100000', '0001000110100001111010110101011111001000011100001111010110001001011011101111000100101111100001011001100110011001110101100001000001011011111110100000', '0001011010100110001000100000001110010000011000111001001110000001001011100001000100101110011011011001000111101010001010111001101100000100001101001000', '0000001010000101101010000000110000010101111011100110101000110111011110001001011101111001100011100100100100100000010010001111101111110011000001011000', '0000001000011111101111110000000000001100011111011010111010000111011110001001011101111001001100000001010100111111011000000110010111101001110010011000', '0000100000011100011111001001001000001000100010010111101011101010011101011000001001110100000000010010011001110100101111001110111111010000010001000000', '0001000101001011001111111101010111110010010110111111110000010001011011101111000100101111000100010000111110011101000001111100001001100100011100011000', '0001101101101010110000001001110111001001000001110110110000110001001011100001000100101111100001110001000000110101100001111111001001111001101101100000', ] bursts_expected_1 = [ '0001010110101101110000011111101100001000001001110101100000011010001111011010001000111100000100110001111110110111010101011011011100111000101111010000', '0000010000111000010001010010111110000100011000000101110110001000110101110010000011010111001100010011100001111101000101011110100001100010010110001000', '0000011110101100001001101000001010010100100111101101101000110101001111101100010100111111011001110000011000100001010011100000001100010110101001001000', '0001110111101011100000001011111101100110110001001100101111110010000111011101001000011101110010001111000010011110001101101111101011100001001100100000', '0000000111000111010110000000001001101110001001001101100110010001011011101111000100101111101011111100101001110100101000011100111001001101101011101000', '0000100100010111010011100110101011011010001011011011011101110010001111011010001000111100000110010111001010011100000011111100111000100100101010110000', '0000101111000000100110100001011000000011111111010101010011011010000111011101001000011101110010101101000100100000001100001000100111001010010000111000', '0000001001001101110111111011010011000011100001100011110011010001001011100001000100101110011100000010010111101100101011011111101011000000001100101000', '0000110011100000100000000010100100011001001000110010110101111001001011100001000100101110000111001100111111110011011001000001001000001111001101001000', '0001001111100001110110001010100011100011110011100001010100001001001011100001000100101111001000101100111101001010111000010111101000000001101100101000', '0000101001000010000001100001000011001010100011110111101110111001001011100001000100101110001010100101111010111000000010111011000010011001101000001000', '0001101000000100110100110001010111010111111001101110110101100111011110001001011101111001000110010011100100000100011101110110111010001001000111101000', ] bursts_expected_2 = [ '0001110111001111101101110111110000001110111011011100110110001001001011100001000100101110100101001001000110101110111110100110100100111111011001011000', '0001011111010100110010101100011000100011000011111000111100010101001111101100010100111111100110001110010110001110000101110000100101010111100100111000', '0001000100110100001010000101011001010000001111001110011010001001001011100001000100101111100011000100111100100010111001010010110100010000110000110000', '0001001100101001010111000101000101000000111101011111000001011010001111011010001000111100110110011000000011010000100110111101110011110011000011010000', '0001110110111100101101010011111100101100100100110001110110111001001011100001000100101110010111011011100001001010010100010101110100011111010101001000', '0000111001001000110010011110000010011101000001010111011011111010011101011000001001110101011101101100101110010111010001100100000011100100111101010000', '0001000001010011101010101011111100010010101110100001000111110010011101011000001001110101100000100101011101111101101101111000001101101010001000101000', '0001101000001011010011001010011010100110010100011010101101011010000111011101001000011101100010011011111111101011100110000011110110001111000101101000', '0001011000010101011100101011111010110101011110011011001011010010001111011010001000111100110111000110100100001100110100000001100100100111101010011000', '0001010101101101101001011100101001110000100101011110100011100010011101011000001001110100111100001000000111000001111100011011101000101100111100111000', '0000010101001010001110001001101101011011000110011011110111111000110101110010000011010110000000110010100100111001010110110011011101011001110100100000', '0001111111000101100000111010111010011010011110110010111000010101001111101100010100111110000110010011101101011111001000010001111111000111001111011000', ] bursts_expected_3 = [ '0001011010100110110011000101111111010011110001101000011100101000110101110010000011010110110100000111011101000001101010100001110111001011010101111000', '0000101010001100010011010101011110010101101110011110100110001010001111011010001000111100000010011011100001010001001111111100011111000011001010011000', '0000111001011100101100111001010101000101010111011110111101010001001011100001000100101111100010100101111011000101100000101111000101011110011111100000', '0000010101101111011001100001011100100101001000110111010110001111011110001001011101111000011010010010101111010000110000011001101011100000111110000000', '0000001010101101011001000000001000001001110100000111000000101001001011100001000100101110111111011101110101010011001110111111101001011010110000101000', '0001011110101111110100110010010110011100111010011001001110011111011110001001011101111000101010001111000111000101111000100011100010100010010100010000', '0001000001011110010010100001100010111111000111001111010101011111011110001001011101111001010010100101110110111111001111110010111100111010110011110000', '0001111100100010101100010111000000011011001111001101101001000010001111011010001000111101111000000101111001110101101001101010001110100111101011001000', '0000100101100011001010101100011110000111001110010010010000100001011011101111000100101110001111010000001000001101011010110101010111011011001101101000', '0000110000111101100001011100100011101011011000111100001000000111011110001001011101111000111000000111100100101000000101100011011001111100110011110000', '0000011001111001100111110110110000001111110101011110100011010010011101011000001001110101001101110111111100001001000101101101100110001111101011010000', '0000100001011010001010000101110000111100011110110010000010101000110101110010000011010111010001010101111111111101101100110101111010110100001110101000', ] src = grgsm.burst_source(self.framenumbers_input, self.timeslots_input, self.bursts_input) splitter = grgsm.burst_sdcch_subslot_splitter(grgsm.SPLITTER_SDCCH4) sink_0 = grgsm.burst_sink() sink_1 = grgsm.burst_sink() sink_2 = grgsm.burst_sink() sink_3 = grgsm.burst_sink() self.tb.msg_connect(src, "out", splitter, "in") self.tb.msg_connect(splitter, "out0", sink_0, "in") self.tb.msg_connect(splitter, "out1", sink_1, "in") self.tb.msg_connect(splitter, "out2", sink_2, "in") self.tb.msg_connect(splitter, "out3", sink_3, "in") self.tb.run () bursts_result_0 = list(sink_0.get_burst_data()) bursts_result_1 = list(sink_1.get_burst_data()) bursts_result_2 = list(sink_2.get_burst_data()) bursts_result_3 = list(sink_3.get_burst_data()) self.assertEqual(bursts_expected_0, bursts_result_0) self.assertEqual(bursts_expected_1, bursts_result_1) self.assertEqual(bursts_expected_2, bursts_result_2) self.assertEqual(bursts_expected_3, bursts_result_3) if __name__ == '__main__': gr_unittest.run(qa_burst_sdcch_subslot_splitter, "qa_burst_sdcch_subslot_splitter.xml") gr-gsm-0.41.2/python/qa_burst_timeslot_filter.py000077500000000000000000000151421316153413000217750ustar00rootroot00000000000000#!/usr/bin/env python # -*- coding: utf-8 -*- # @file # @author (C) 2015 by Roman Khassraf # @section LICENSE # # Gr-gsm is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Gr-gsm is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with gr-gsm; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # # from gnuradio import gr, gr_unittest, blocks import grgsm_swig as grgsm import pmt class qa_burst_timeslot_filter (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () def tearDown (self): self.tb = None def test_001 (self): """ 24 random framenumbers, timeslots and bursts as input """ framenumbers_input = [1259192, 1076346, 1076242, 235879, 1259218, 2194302, 2714322, 1588, 1259244, 1563637, 1435624, 1928543, 503726, 1571144, 2658397, 1807445, 869789, 624070, 2005511, 1306953, 2284894, 1600339, 551375, 1259270] timeslots_input = [6, 1, 4, 3, 5, 3, 2, 7, 1, 6, 0, 7, 2, 1, 2, 0, 7, 1, 0, 6, 0, 6, 5, 7] bursts_input = [ "0001100001000111100111101111100101000100101011000010011110011101001111101100010100111111100000110100011111101011101100100111110011000100010001010000", "0001000101000000001001111110000110010110110111110111101000001101001111101100010100111111001110001001110101110001010001000111011010010001011011000000", "0001001101101101000111001000101011001101001110110001001100111101001111101100010100111111111001001010011010011111010010010101011001001011011100110000", "0000010010100000001001101010100001011100010001101100111111101101001111101100010100111111101101001110100010101110010110101111100010010000110010110000", "0000010101010110010011110101010101101100000000001000100100101010000111011101001000011101011101110000101011001111000100001000000000001110010001111000", "0001000000000010111010100000010101000010001010111010000000011010000111011101001000011101000000100010111110101000000001000000000010111010100000000000", "0001010101111111111010000001010101011111111111101000000001001010000111011101001000011101010111111111111010101000000001010101011011101010000001000000", "0000000000111110101010100001000000100010101110101010000101001010000111011101001000011101001010001111101010001000010000000000101110101010100000010000", "0000010000000010000001001000011001010010000011000101000000001010000111011101001000011101010100100000000001001000001000000100100011000101001000111000", "0001010100110111100000110111100110010100011100011000110110001010000111011101001000011101011111111001111001101010010100000000011111001101000111110000", "0001100110000001011110001000001100101001010100111111000100111010000111011101001000011101000011010010001010111101000100110011111010100010010101000000", "0000010101100101010110000011010000000000000010111001110110101010000111011101001000011101000001000100100001111001100011000101010001110001010100111000", "0001000100000011001010111001111100011010000000000000001001001010000111011101001000011101010110000101111010011001110110001001011010101000011110110000", "0001100001000111111111100001011000000011010110111010110000111010000111011101001000011101100010111100100101110001101000110100110000001010101110011000", "0000000100111011000000000010100100001100101010000000010010101010000111011101001000011101000110110001110110000100110100110110011001100100000101100000", "0000100101111010011110111010100111010100011011011101100111001010000111011101001000011101010000111010000110100000001000010011101011001001110100011000", "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000", "0000110101000011011010110000110011010000000001001010110010001010000111011101001000011101010000011000111001101110000000110010100001101110101000100000", "0000001000010001011111111111101010100000010101011101101010101010000111011101001000011101100010010101010101011110101010101000010001011101111010101000", "0000101110101111011001011001000011110010100010011100110010001010000111011101001000011101100000001110000100010100110111001001100010101101100010101000", "0001100010000001000111011100101101101010100001111101001000101010000111011101001000011101111010000011010110010111011111010010001000001101100011111000", "0001011101101101011100001111001100010001000011011001101110011010000111011101001000011101010010111011100111000001011100100001111010100101111000100000", "0000001000100011000000000000110100000000010000001010100100001010000111011101001000011101000010010000000000001001000001011000000001010000000100010000", "0000100000110001000000000100000110001011100001001000000000001010000111011101001000011101001010010001010000000111010000000011000001000000000101010000" ] bursts_expected = [ "0001000101000000001001111110000110010110110111110111101000001101001111101100010100111111001110001001110101110001010001000111011010010001011011000000", "0000010000000010000001001000011001010010000011000101000000001010000111011101001000011101010100100000000001001000001000000100100011000101001000111000", "0001100001000111111111100001011000000011010110111010110000111010000111011101001000011101100010111100100101110001101000110100110000001010101110011000", "0000110101000011011010110000110011010000000001001010110010001010000111011101001000011101010000011000111001101110000000110010100001101110101000100000" ] timeslot = 1 src = grgsm.burst_source(framenumbers_input, timeslots_input, bursts_input) ts_filter = grgsm.burst_timeslot_filter(timeslot) sink = grgsm.burst_sink() self.tb.msg_connect(src, "out", ts_filter, "in") self.tb.msg_connect(ts_filter, "out", sink, "in") self.tb.run () bursts_result = list(sink.get_burst_data()) self.assertEqual(bursts_expected, bursts_result) if __name__ == '__main__': gr_unittest.run(qa_burst_timeslot_filter, "qa_burst_timeslot_filter.xml") gr-gsm-0.41.2/python/qa_burst_timeslot_splitter.py000077500000000000000000000271151316153413000223610ustar00rootroot00000000000000#!/usr/bin/env python # -*- coding: utf-8 -*- # @file # @author (C) 2015 by Roman Khassraf # @section LICENSE # # Gr-gsm is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Gr-gsm is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with gr-gsm; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # # from gnuradio import gr, gr_unittest, blocks import grgsm_swig as grgsm import pmt class qa_burst_timeslot_splitter (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () def tearDown (self): self.tb = None def test_001 (self): """ 24 random framenumbers, timeslots and bursts as input """ framenumbers_input = [1259192, 1076346, 1076242, 235879, 1259218, 2194302, 2714322, 1588, 1259244, 1563637, 1435624, 1928543, 503726, 1571144, 2658397, 1807445, 869789, 624070, 2005511, 1306953, 2284894, 1600339, 551375, 1259270] timeslots_input = [6, 3, 4, 3, 5, 3, 2, 7, 1, 6, 0, 7, 2, 3, 2, 0, 7, 1, 0, 6, 0, 6, 5, 7] bursts_input = [ "0001100001000111100111101111100101000100101011000010011110011101001111101100010100111111100000110100011111101011101100100111110011000100010001010000", "0001000101000000001001111110000110010110110111110111101000001101001111101100010100111111001110001001110101110001010001000111011010010001011011000000", "0001001101101101000111001000101011001101001110110001001100111101001111101100010100111111111001001010011010011111010010010101011001001011011100110000", "0000010010100000001001101010100001011100010001101100111111101101001111101100010100111111101101001110100010101110010110101111100010010000110010110000", "0000010101010110010011110101010101101100000000001000100100101010000111011101001000011101011101110000101011001111000100001000000000001110010001111000", "0001000000000010111010100000010101000010001010111010000000011010000111011101001000011101000000100010111110101000000001000000000010111010100000000000", "0001010101111111111010000001010101011111111111101000000001001010000111011101001000011101010111111111111010101000000001010101011011101010000001000000", "0000000000111110101010100001000000100010101110101010000101001010000111011101001000011101001010001111101010001000010000000000101110101010100000010000", "0000010000000010000001001000011001010010000011000101000000001010000111011101001000011101010100100000000001001000001000000100100011000101001000111000", "0001010100110111100000110111100110010100011100011000110110001010000111011101001000011101011111111001111001101010010100000000011111001101000111110000", "0001100110000001011110001000001100101001010100111111000100111010000111011101001000011101000011010010001010111101000100110011111010100010010101000000", "0000010101100101010110000011010000000000000010111001110110101010000111011101001000011101000001000100100001111001100011000101010001110001010100111000", "0001000100000011001010111001111100011010000000000000001001001010000111011101001000011101010110000101111010011001110110001001011010101000011110110000", "0001100001000111111111100001011000000011010110111010110000111010000111011101001000011101100010111100100101110001101000110100110000001010101110011000", "0000000100111011000000000010100100001100101010000000010010101010000111011101001000011101000110110001110110000100110100110110011001100100000101100000", "0000100101111010011110111010100111010100011011011101100111001010000111011101001000011101010000111010000110100000001000010011101011001001110100011000", "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000", "0000110101000011011010110000110011010000000001001010110010001010000111011101001000011101010000011000111001101110000000110010100001101110101000100000", "0000001000010001011111111111101010100000010101011101101010101010000111011101001000011101100010010101010101011110101010101000010001011101111010101000", "0000101110101111011001011001000011110010100010011100110010001010000111011101001000011101100000001110000100010100110111001001100010101101100010101000", "0001100010000001000111011100101101101010100001111101001000101010000111011101001000011101111010000011010110010111011111010010001000001101100011111000", "0001011101101101011100001111001100010001000011011001101110011010000111011101001000011101010010111011100111000001011100100001111010100101111000100000", "0000001000100011000000000000110100000000010000001010100100001010000111011101001000011101000010010000000000001001000001011000000001010000000100010000", "0000100000110001000000000100000110001011100001001000000000001010000111011101001000011101001010010001010000000111010000000011000001000000000101010000" ] bursts_expected_0 = [ "0001100110000001011110001000001100101001010100111111000100111010000111011101001000011101000011010010001010111101000100110011111010100010010101000000", "0000100101111010011110111010100111010100011011011101100111001010000111011101001000011101010000111010000110100000001000010011101011001001110100011000", "0000001000010001011111111111101010100000010101011101101010101010000111011101001000011101100010010101010101011110101010101000010001011101111010101000", "0001100010000001000111011100101101101010100001111101001000101010000111011101001000011101111010000011010110010111011111010010001000001101100011111000" ] bursts_expected_1 = [ "0000010000000010000001001000011001010010000011000101000000001010000111011101001000011101010100100000000001001000001000000100100011000101001000111000", "0000110101000011011010110000110011010000000001001010110010001010000111011101001000011101010000011000111001101110000000110010100001101110101000100000" ] bursts_expected_2 = [ "0001010101111111111010000001010101011111111111101000000001001010000111011101001000011101010111111111111010101000000001010101011011101010000001000000", "0001000100000011001010111001111100011010000000000000001001001010000111011101001000011101010110000101111010011001110110001001011010101000011110110000", "0000000100111011000000000010100100001100101010000000010010101010000111011101001000011101000110110001110110000100110100110110011001100100000101100000" ] bursts_expected_3 = [ "0001000101000000001001111110000110010110110111110111101000001101001111101100010100111111001110001001110101110001010001000111011010010001011011000000", "0000010010100000001001101010100001011100010001101100111111101101001111101100010100111111101101001110100010101110010110101111100010010000110010110000", "0001000000000010111010100000010101000010001010111010000000011010000111011101001000011101000000100010111110101000000001000000000010111010100000000000", "0001100001000111111111100001011000000011010110111010110000111010000111011101001000011101100010111100100101110001101000110100110000001010101110011000" ] bursts_expected_4 = [ "0001001101101101000111001000101011001101001110110001001100111101001111101100010100111111111001001010011010011111010010010101011001001011011100110000" ] bursts_expected_5 = [ "0000010101010110010011110101010101101100000000001000100100101010000111011101001000011101011101110000101011001111000100001000000000001110010001111000", "0000001000100011000000000000110100000000010000001010100100001010000111011101001000011101000010010000000000001001000001011000000001010000000100010000" ] bursts_expected_6 = [ "0001100001000111100111101111100101000100101011000010011110011101001111101100010100111111100000110100011111101011101100100111110011000100010001010000", "0001010100110111100000110111100110010100011100011000110110001010000111011101001000011101011111111001111001101010010100000000011111001101000111110000", "0000101110101111011001011001000011110010100010011100110010001010000111011101001000011101100000001110000100010100110111001001100010101101100010101000", "0001011101101101011100001111001100010001000011011001101110011010000111011101001000011101010010111011100111000001011100100001111010100101111000100000" ] bursts_expected_7 = [ "0000000000111110101010100001000000100010101110101010000101001010000111011101001000011101001010001111101010001000010000000000101110101010100000010000", "0000010101100101010110000011010000000000000010111001110110101010000111011101001000011101000001000100100001111001100011000101010001110001010100111000", "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000", "0000100000110001000000000100000110001011100001001000000000001010000111011101001000011101001010010001010000000111010000000011000001000000000101010000" ] src = grgsm.burst_source(framenumbers_input, timeslots_input, bursts_input) splitter = grgsm.burst_timeslot_splitter() sink_0 = grgsm.burst_sink() sink_1 = grgsm.burst_sink() sink_2 = grgsm.burst_sink() sink_3 = grgsm.burst_sink() sink_4 = grgsm.burst_sink() sink_5 = grgsm.burst_sink() sink_6 = grgsm.burst_sink() sink_7 = grgsm.burst_sink() self.tb.msg_connect(src, "out", splitter, "in") self.tb.msg_connect(splitter, "out0", sink_0, "in") self.tb.msg_connect(splitter, "out1", sink_1, "in") self.tb.msg_connect(splitter, "out2", sink_2, "in") self.tb.msg_connect(splitter, "out3", sink_3, "in") self.tb.msg_connect(splitter, "out4", sink_4, "in") self.tb.msg_connect(splitter, "out5", sink_5, "in") self.tb.msg_connect(splitter, "out6", sink_6, "in") self.tb.msg_connect(splitter, "out7", sink_7, "in") self.tb.run () bursts_result_0 = list(sink_0.get_burst_data()) bursts_result_1 = list(sink_1.get_burst_data()) bursts_result_2 = list(sink_2.get_burst_data()) bursts_result_3 = list(sink_3.get_burst_data()) bursts_result_4 = list(sink_4.get_burst_data()) bursts_result_5 = list(sink_5.get_burst_data()) bursts_result_6 = list(sink_6.get_burst_data()) bursts_result_7 = list(sink_7.get_burst_data()) self.assertEqual(bursts_expected_0, bursts_result_0) self.assertEqual(bursts_expected_1, bursts_result_1) self.assertEqual(bursts_expected_2, bursts_result_2) self.assertEqual(bursts_expected_3, bursts_result_3) self.assertEqual(bursts_expected_4, bursts_result_4) self.assertEqual(bursts_expected_5, bursts_result_5) self.assertEqual(bursts_expected_6, bursts_result_6) self.assertEqual(bursts_expected_7, bursts_result_7) if __name__ == '__main__': gr_unittest.run(qa_burst_timeslot_splitter, "qa_burst_timeslot_splitter.xml") gr-gsm-0.41.2/python/qa_controlled_fractional_resampler_cc.py000077500000000000000000000024461316153413000244420ustar00rootroot00000000000000#!/usr/bin/env python # -*- coding: utf-8 -*- # @file # @author (C) 2016 by Piotr Krysik # @section LICENSE # # Gr-gsm is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Gr-gsm is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with gr-gsm; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # # from gnuradio import gr, gr_unittest from gnuradio import blocks import grgsm_swig as grgsm class qa_controlled_fractional_resampler_cc (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () def tearDown (self): self.tb = None def test_001_t (self): # set up fg self.tb.run () # check data if __name__ == '__main__': gr_unittest.run(qa_controlled_fractional_resampler_cc, "qa_controlled_fractional_resampler_cc.xml") gr-gsm-0.41.2/python/qa_decryption.py000077500000000000000000000253101316153413000175270ustar00rootroot00000000000000#!/usr/bin/env python # -*- coding: utf-8 -*- # @file # @author (C) 2015 by Roman Khassraf # @section LICENSE # # Gr-gsm is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Gr-gsm is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with gr-gsm; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # # from gnuradio import gr, gr_unittest, blocks import grgsm_swig as grgsm import pmt class qa_decryption (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () def tearDown (self): self.tb = None def test_001_a51 (self): """ A system information message on the SACCH of TCH/F, encrypted with A5/1 """ framenumbers_input = [1259192, 1259218, 1259244, 1259270] timeslots_input = [2, 2, 2, 2] bursts_input = [ "0001100001000111100111101111100101000100101011000010011110011101001111101100010100111111100000110100011111101011101100100111110011000100010001010000", "0001000101000000001001111110000110010110110111110111101000001101001111101100010100111111001110001001110101110001010001000111011010010001011011000000", "0001001101101101000111001000101011001101001110110001001100111101001111101100010100111111111001001010011010011111010010010101011001001011011100110000", "0000010010100000001001101010100001011100010001101100111111101101001111101100010100111111101101001110100010101110010110101111100010010000110010110000" ] bursts_expected = [ "0000010111000110010001010000000101010011110101100000100000011101001111101100010100111111010110110000000001101110000101000000000101000100011000110000", "0000010110101100010100111101011001000000000101010011000100001101001111101100010100111111011001101001110000100001000110000000101100010111100111010000", "0000011110110111011011100001010000000000110100100000100001001101001111101100010100111111100010000000000000001101000000100000010011001110100000010000", "0000011000010001000000001101000001001001000010001000000000001101001111101100010100111111000010110001001110000000110111001110010000010111000111001000" ] key = [0x32,0xE5,0x45,0x53,0x20,0x8C,0xE0,0x00] a5_version = 1 src = grgsm.burst_source(framenumbers_input, timeslots_input, bursts_input) decryption = grgsm.decryption((key), a5_version) dst = grgsm.burst_sink() self.tb.msg_connect(src, "out", decryption, "bursts") self.tb.msg_connect(decryption, "bursts", dst, "in") self.tb.run () # have to convert tuple to list framenumbers_result = list(dst.get_framenumbers()) timeslots_result = list(dst.get_timeslots()) bursts_result = list(dst.get_burst_data()) self.assertEqual(framenumbers_input, framenumbers_result) self.assertEqual(timeslots_input, timeslots_result) self.assertEqual(bursts_expected, bursts_result) def test_002_a51 (self): """ A TMSI Reallocation command on SDCCH/8, encrypted with A5/1 """ framenumbers_input = [2569043, 2569044, 2569045, 2569046] timeslots_input = [4, 4, 4, 4] bursts_input = [ "0000111101111110011111000111000100110100001101100001000110011000110101110010000011010111010110101100100010011000000100111010001000011000010010010000", "0001010010001100110000000111100110101111001001101111000000101000110101110010000011010111001101001101000001000001110101101100101111010011001000111000", "0001110111101000110100001111000010100001101011000001010010011000110101110010000011010111101110000011100010110110101010100101010011011111111001000000", "0001111011000100011010100010000110001101111001000110010100001000110101110010000011010111000100101011110110000100110110001110010011110110110101100000" ] bursts_expected = [ "0001100000010010011110111110011111000000001010001111000000001000110101110010000011010111100101101010000001111010100010110111101011101011100000101000", "0001000101111101111110000010100001011011111010111110101011101000110101110010000011010111110110111101101111110000011011010111011111001011101000011000", "0000001000011110111110101011001000110000000000110110101100011000110101110010000011010111001010100101011111001000111100000100000111111000000101110000", "0001101010111110010001010110101100000011101100011111110100101000110101110010000011010111111000000001010010111001111111011001000000001001000011101000" ] key = [0xAD,0x6A,0x3E,0xC2,0xB4,0x42,0xE4,0x00] a5_version = 1 src = grgsm.burst_source(framenumbers_input, timeslots_input, bursts_input) decryption = grgsm.decryption((key), a5_version) dst = grgsm.burst_sink() self.tb.msg_connect(src, "out", decryption, "bursts") self.tb.msg_connect(decryption, "bursts", dst, "in") self.tb.run () # have to convert tuple to list framenumbers_result = list(dst.get_framenumbers()) timeslots_result = list(dst.get_timeslots()) bursts_result = list(dst.get_burst_data()) self.assertEqual(framenumbers_input, framenumbers_result) self.assertEqual(timeslots_input, timeslots_result) self.assertEqual(bursts_expected, bursts_result) def test_003_a53 (self): """ A cp-ack message of a SMS, encrypted with A5/3 """ framenumbers_input = [1935011, 1935012, 1935013, 1935014] timeslots_input = [2, 2, 2, 2] bursts_input = [ "0001111001001110001101111101111111110100011010101100100001011101001111101100010100111111101101011110100011101111001000110110100101101011110010100000", "0001111000110011010110000111010010100101001100111011000001011101001111101100010100111111000100101000001011010001100000010100011000011111001111011000", "0000000110100101110010011101101100101110001100000000101001011101001111101100010100111111100100100010110110111011010101010001001100010100100100111000", "0000011100111011101010000111001010010001100110011011100101011101001111101100010100111111101110110100101101010100111101000000111001011011100010101000" ] bursts_expected = [ "0001000000000010100111000010010101001010011110010010101110011101001111101100010100111111011010111010111100110000011100111010001010100010100110000000", "0000101110001111011110100111101010000000101101101011101001011101001111101100010100111111010110100111001100100011000100100011110101001010110001001000", "0000001111011010110111000100111111000011001010100011000110011101001111101100010100111111100111100010011100000010110011100001101000000000000011001000", "0000011011100010001000101000101010010011010000100011110011001101001111101100010100111111010100100010010100111010101110001101101110101110011100101000" ] key = [0x41,0xBC,0x19,0x30,0xB6,0x31,0x8A,0xC8] a5_version = 3 src = grgsm.burst_source(framenumbers_input, timeslots_input, bursts_input) decryption = grgsm.decryption((key), a5_version) dst = grgsm.burst_sink() self.tb.msg_connect(src, "out", decryption, "bursts") self.tb.msg_connect(decryption, "bursts", dst, "in") self.tb.run () # have to convert tuple to list framenumbers_result = list(dst.get_framenumbers()) timeslots_result = list(dst.get_timeslots()) bursts_result = list(dst.get_burst_data()) self.assertEqual(framenumbers_input, framenumbers_result) self.assertEqual(timeslots_input, timeslots_result) self.assertEqual(bursts_expected, bursts_result) def test_004_a53 (self): """ An assignment command for a TCH channel, encrypted with A5/3 """ framenumbers_input = [435897, 435898, 435899, 435900] timeslots_input = [2, 2, 2, 2] bursts_input = [ "0001001000010110001000001101001010100000011100011011110101011101001111101100010100111111010000100000100101101111000010001100001000100101100101010000", "0000011101010011010110101000011011101010100001011001100011001101001111101100010100111111000110011001110101110111000100101001111100110100011011011000", "0000000000110011000001110101110101111011011111000111101001011101001111101100010100111111101100010011010000010001101101000110000011011000011100011000", "0000000001110011001010110101100110100111110010000101001011111101001111101100010100111111101110001101111111001001001000101101010110010101010110100000", ] bursts_expected = [ "0001101100011001110111101010110000001111000010110011000110101101001111101100010100111111100010000011100010101001010110101100001111101111110010011000", "0001101001110110000111000011111110011011001001101010011000001101001111101100010100111111110010001001001001101011111010010100100011100110110000011000", "0001000001110000001011101010011010010100010010100110010010001101001111101100010100111111010011011101010110100000111111011111100000010100000111000000", "0000001000001010010001010000101011101100100100001010011101111101001111101100010100111111000001001001100100101010000011101010100001110000100000001000" ] key = [0xAD,0x2C,0xB3,0x83,0x2F,0x4A,0x6C,0xF1] a5_version = 3 src = grgsm.burst_source(framenumbers_input, timeslots_input, bursts_input) decryption = grgsm.decryption((key), a5_version) dst = grgsm.burst_sink() self.tb.msg_connect(src, "out", decryption, "bursts") self.tb.msg_connect(decryption, "bursts", dst, "in") self.tb.run () # have to convert tuple to list framenumbers_result = list(dst.get_framenumbers()) timeslots_result = list(dst.get_timeslots()) bursts_result = list(dst.get_burst_data()) self.assertEqual(framenumbers_input, framenumbers_result) self.assertEqual(timeslots_input, timeslots_result) self.assertEqual(bursts_expected, bursts_result) if __name__ == '__main__': gr_unittest.run(qa_decryption, "qa_decryption.xml") gr-gsm-0.41.2/python/qa_dummy_burst_filter.py000077500000000000000000000203651316153413000212730ustar00rootroot00000000000000#!/usr/bin/env python # -*- coding: utf-8 -*- # @file # @author (C) 2015 by Roman Khassraf # @section LICENSE # # Gr-gsm is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Gr-gsm is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with gr-gsm; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # # from gnuradio import gr, gr_unittest, blocks import grgsm_swig as grgsm class qa_dummy_burst_filter (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () def tearDown (self): self.tb = None def test_001 (self): """ filter mode less_or_equal, limiting frame number 1500123 24 bursts as input, 10 of them dummy bursts """ framenumbers_input = [1259192, 1076346, 1076242, 235879, 1259218, 2194302, 2714322, 1588, 1259244, 1563637, 1435624, 1928543, 503726, 1571144, 2658397, 1807445, 869789, 624070, 2005511, 1306953, 2284894, 1600339, 551375, 1259270] timeslots_input = [6, 3, 4, 3, 5, 3, 2, 7, 1, 6, 0, 7, 2, 3, 2, 0, 7, 1, 0, 6, 0, 6, 5, 7] bursts_input = [ "0001100001000111100111101111100101000100101011000010011110011101001111101100010100111111100000110100011111101011101100100111110011000100010001010000", "0001000101000000001001111110000110010110110111110111101000001101001111101100010100111111001110001001110101110001010001000111011010010001011011000000", "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000", "0000010010100000001001101010100001011100010001101100111111101101001111101100010100111111101101001110100010101110010110101111100010010000110010110000", "0000010101010110010011110101010101101100000000001000100100101010000111011101001000011101011101110000101011001111000100001000000000001110010001111000", "0001000000000010111010100000010101000010001010111010000000011010000111011101001000011101000000100010111110101000000001000000000010111010100000000000", "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000", "0000000000111110101010100001000000100010101110101010000101001010000111011101001000011101001010001111101010001000010000000000101110101010100000010000", "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000", "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000", "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000", "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000", "0001000100000011001010111001111100011010000000000000001001001010000111011101001000011101010110000101111010011001110110001001011010101000011110110000", "0001100001000111111111100001011000000011010110111010110000111010000111011101001000011101100010111100100101110001101000110100110000001010101110011000", "0000000100111011000000000010100100001100101010000000010010101010000111011101001000011101000110110001110110000100110100110110011001100100000101100000", "0000100101111010011110111010100111010100011011011101100111001010000111011101001000011101010000111010000110100000001000010011101011001001110100011000", "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000", "0000110101000011011010110000110011010000000001001010110010001010000111011101001000011101010000011000111001101110000000110010100001101110101000100000", "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000", "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000", "0001100010000001000111011100101101101010100001111101001000101010000111011101001000011101111010000011010110010111011111010010001000001101100011111000", "0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000", "0000001000100011000000000000110100000000010000001010100100001010000111011101001000011101000010010000000000001001000001011000000001010000000100010000", "0000100000110001000000000100000110001011100001001000000000001010000111011101001000011101001010010001010000000111010000000011000001000000000101010000", ] bursts_expected = [ "0001100001000111100111101111100101000100101011000010011110011101001111101100010100111111100000110100011111101011101100100111110011000100010001010000", "0001000101000000001001111110000110010110110111110111101000001101001111101100010100111111001110001001110101110001010001000111011010010001011011000000", "0000010010100000001001101010100001011100010001101100111111101101001111101100010100111111101101001110100010101110010110101111100010010000110010110000", "0000010101010110010011110101010101101100000000001000100100101010000111011101001000011101011101110000101011001111000100001000000000001110010001111000", "0001000000000010111010100000010101000010001010111010000000011010000111011101001000011101000000100010111110101000000001000000000010111010100000000000", "0000000000111110101010100001000000100010101110101010000101001010000111011101001000011101001010001111101010001000010000000000101110101010100000010000", "0001000100000011001010111001111100011010000000000000001001001010000111011101001000011101010110000101111010011001110110001001011010101000011110110000", "0001100001000111111111100001011000000011010110111010110000111010000111011101001000011101100010111100100101110001101000110100110000001010101110011000", "0000000100111011000000000010100100001100101010000000010010101010000111011101001000011101000110110001110110000100110100110110011001100100000101100000", "0000100101111010011110111010100111010100011011011101100111001010000111011101001000011101010000111010000110100000001000010011101011001001110100011000", "0000110101000011011010110000110011010000000001001010110010001010000111011101001000011101010000011000111001101110000000110010100001101110101000100000", "0001100010000001000111011100101101101010100001111101001000101010000111011101001000011101111010000011010110010111011111010010001000001101100011111000", "0000001000100011000000000000110100000000010000001010100100001010000111011101001000011101000010010000000000001001000001011000000001010000000100010000", "0000100000110001000000000100000110001011100001001000000000001010000111011101001000011101001010010001010000000111010000000011000001000000000101010000" ] dummy_burst_filter = grgsm.dummy_burst_filter() src = grgsm.burst_source(framenumbers_input, timeslots_input, bursts_input) sink = grgsm.burst_sink() self.tb.msg_connect(src, "out", dummy_burst_filter, "in") self.tb.msg_connect(dummy_burst_filter, "out", sink, "in") self.tb.run() bursts_result = list(sink.get_burst_data()) self.assertEqual(bursts_expected, bursts_result) if __name__ == '__main__': gr_unittest.run(qa_dummy_burst_filter, "qa_dummy_burst_filter.xml") gr-gsm-0.41.2/python/qa_message_printer.py000077500000000000000000000175331316153413000205460ustar00rootroot00000000000000#!/usr/bin/env python # -*- coding: utf-8 -*- # @file # @author (C) 2015 by Roman Khassraf # @section LICENSE # # Gr-gsm is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Gr-gsm is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with gr-gsm; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # # from gnuradio import gr, gr_unittest, blocks import grgsm_swig as grgsm import os import pmt import sys import tempfile class qa_message_printer (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block() self.tmpfile = tempfile.NamedTemporaryFile() self.prevfd = os.dup(sys.stdout.fileno()) os.dup2(self.tmpfile.fileno(), sys.stdout.fileno()) self.prev = sys.stdout sys.stdout = os.fdopen(self.prevfd, "w") def tearDown (self): self.tb = None os.dup2(self.prevfd, self.prev.fileno()) sys.stdout = self.prev self.tmpfile.close() def getOutput(self): self.tmpfile.seek(0) return self.tmpfile.read() def getOutputExpected(self, expected_lines): out = "" for l in expected_lines: out = out + l + "\n" return out def test_001_no_prefix_no_header (self): """ Four messages, without any prefix, no gsmtap header """ msgs_input = [ "02 04 01 00 00 00 c9 00 00 1d 3c e5 02 00 01 00 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b", "02 04 01 00 00 00 ca 00 00 1d 3c e9 02 00 02 00 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b", "02 04 01 00 00 00 cb 00 00 1d 3d 0e 01 00 00 00 59 06 1a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff e5 04 00", "02 04 01 00 00 00 cb 00 00 1d 3d 12 02 00 00 00 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b" ] # there is a whitespace at the beginning of message_printer output msgs_expected = [ " 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b", " 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b", " 59 06 1a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff e5 04 00", " 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b" ] src = grgsm.message_source(msgs_input) printer = grgsm.message_printer(pmt.intern(""), False) self.tb.msg_connect(src, "msgs", printer, "msgs") self.tb.run() self.assertEqual(self.getOutput(), self.getOutputExpected(msgs_expected)) def test_002_prefix_no_header (self): """ Four messages, with prefix "test_002:", no gsmtap header """ msgs_input = [ "02 04 01 00 00 00 c9 00 00 1d 3c e5 02 00 01 00 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b", "02 04 01 00 00 00 ca 00 00 1d 3c e9 02 00 02 00 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b", "02 04 01 00 00 00 cb 00 00 1d 3d 0e 01 00 00 00 59 06 1a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff e5 04 00", "02 04 01 00 00 00 cb 00 00 1d 3d 12 02 00 00 00 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b" ] msgs_expected = [ "test_002: 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b", "test_002: 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b", "test_002: 59 06 1a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff e5 04 00", "test_002: 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b" ] src = grgsm.message_source(msgs_input) printer = grgsm.message_printer(pmt.intern("test_002:"), False) self.tb.msg_connect(src, "msgs", printer, "msgs") self.tb.run() self.assertEqual(self.getOutput(), self.getOutputExpected(msgs_expected)) def test_003_no_prefix_header (self): """ Four messages, without any prefix, with gsmtap header """ msgs_input = [ "02 04 01 00 00 00 c9 00 00 1d 3c e5 02 00 01 00 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b", "02 04 01 00 00 00 ca 00 00 1d 3c e9 02 00 02 00 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b", "02 04 01 00 00 00 cb 00 00 1d 3d 0e 01 00 00 00 59 06 1a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff e5 04 00", "02 04 01 00 00 00 cb 00 00 1d 3d 12 02 00 00 00 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b" ] # there is a whitespace at the beginning of message_printer output msgs_expected = [ " 02 04 01 00 00 00 c9 00 00 1d 3c e5 02 00 01 00 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b", " 02 04 01 00 00 00 ca 00 00 1d 3c e9 02 00 02 00 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b", " 02 04 01 00 00 00 cb 00 00 1d 3d 0e 01 00 00 00 59 06 1a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff e5 04 00", " 02 04 01 00 00 00 cb 00 00 1d 3d 12 02 00 00 00 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b" ] src = grgsm.message_source(msgs_input) printer = grgsm.message_printer(pmt.intern(""), False, False, True) self.tb.msg_connect(src, "msgs", printer, "msgs") self.tb.run() self.assertEqual(self.getOutput(), self.getOutputExpected(msgs_expected)) def test_004_prefix_header (self): """ Four messages, with prefix "test_004:", with gsmtap header """ msgs_input = [ "02 04 01 00 00 00 c9 00 00 1d 3c e5 02 00 01 00 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b", "02 04 01 00 00 00 ca 00 00 1d 3c e9 02 00 02 00 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b", "02 04 01 00 00 00 cb 00 00 1d 3d 0e 01 00 00 00 59 06 1a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff e5 04 00", "02 04 01 00 00 00 cb 00 00 1d 3d 12 02 00 00 00 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b" ] # there is a whitespace at the beginning of message_printer output msgs_expected = [ "test_004: 02 04 01 00 00 00 c9 00 00 1d 3c e5 02 00 01 00 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b", "test_004: 02 04 01 00 00 00 ca 00 00 1d 3c e9 02 00 02 00 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b", "test_004: 02 04 01 00 00 00 cb 00 00 1d 3d 0e 01 00 00 00 59 06 1a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff e5 04 00", "test_004: 02 04 01 00 00 00 cb 00 00 1d 3d 12 02 00 00 00 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b" ] src = grgsm.message_source(msgs_input) printer = grgsm.message_printer(pmt.intern("test_004:"), False, False, True) self.tb.msg_connect(src, "msgs", printer, "msgs") self.tb.run() self.assertEqual(self.getOutput(), self.getOutputExpected(msgs_expected)) if __name__ == '__main__': gr_unittest.run(qa_message_printer, "qa_message_printer.xml") gr-gsm-0.41.2/python/qa_message_source_sink.py000077500000000000000000000061471316153413000214060ustar00rootroot00000000000000#!/usr/bin/env python # -*- coding: utf-8 -*- # @file # @author (C) 2015 by Roman Khassraf # @section LICENSE # # Gr-gsm is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Gr-gsm is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with gr-gsm; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # # from gnuradio import gr, gr_unittest, blocks import grgsm_swig as grgsm import os import pmt import sys import tempfile class qa_message_source_sink (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block() self.tmpfile = tempfile.NamedTemporaryFile() def tearDown (self): self.tmpfile.close() #def getOutput(self): #self.tmpfile.seek(0) #return self.tmpfile.read() #def getOutputExpected(self, expected_lines): #out = "" #for l in expected_lines: #out = out + l + "\n" #return out def test_001_no_prefix_no_header (self): """ Four messages, without any prefix, no gsmtap header """ msgs_input = [ "02 04 01 00 00 00 c9 00 00 1d 3c e5 02 00 01 00 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b", #"02 04 01 00 00 00 ca 00 00 1d 3c e9 02 00 02 00 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b", #"02 04 01 00 00 00 cb 00 00 1d 3d 0e 01 00 00 00 59 06 1a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff e5 04 00", #"02 04 01 00 00 00 cb 00 00 1d 3d 12 02 00 00 00 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b" ] # there is a whitespace at the beginning of message_printer output msgs_expected = [ "02 04 01 00 00 00 c9 00 00 1d 3c e5 02 00 01 00 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b", #"02 04 01 00 00 00 ca 00 00 1d 3c e9 02 00 02 00 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b", #" 59 06 1a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff e5 04 00", #" 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b" ] src = grgsm.message_source(msgs_input) file_sink = grgsm.message_file_sink(self.tmpfile.name) #printer = grgsm.message_printer(pmt.intern(""), False) #self.tb.msg_connect(src, "msgs", printer, "msgs") self.tb.run() #self.assertEqual(self.getOutput(), self.getOutputExpected(msgs_expected)) if __name__ == '__main__': gr_unittest.run(qa_message_source_sink, "qa_message_source_sink.xml") gr-gsm-0.41.2/python/qa_msg_to_tag.py000077500000000000000000000023361316153413000174750ustar00rootroot00000000000000#!/usr/bin/env python # -*- coding: utf-8 -*- # @file # @author (C) 2016 by Piotr Krysik # @section LICENSE # # Gr-gsm is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Gr-gsm is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with gr-gsm; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # # from gnuradio import gr, gr_unittest from gnuradio import blocks import grgsm_swig as grgsm class qa_msg_to_tag (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () def tearDown (self): self.tb = None def test_001_t (self): # set up fg self.tb.run () # check data if __name__ == '__main__': gr_unittest.run(qa_msg_to_tag, "qa_msg_to_tag.xml") gr-gsm-0.41.2/python/qa_uplink_downlink_splitter.py000077500000000000000000000024101316153413000225000ustar00rootroot00000000000000#!/usr/bin/env python # -*- coding: utf-8 -*- # @file # @author (C) 2016 by Piotr Krysik # @section LICENSE # # Gr-gsm is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Gr-gsm is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with gr-gsm; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # # from gnuradio import gr, gr_unittest from gnuradio import blocks import grgsm_swig as grgsm class qa_uplink_downlink_splitter (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () def tearDown (self): self.tb = None def test_001_t (self): # set up fg self.tb.run () # check data if __name__ == '__main__': gr_unittest.run(qa_uplink_downlink_splitter, "qa_uplink_downlink_splitter.xml") gr-gsm-0.41.2/python/receiver/000077500000000000000000000000001316153413000161145ustar00rootroot00000000000000gr-gsm-0.41.2/python/receiver/CMakeLists.txt000066400000000000000000000016631316153413000206620ustar00rootroot00000000000000# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. GR_PYTHON_INSTALL( FILES gsm_input.py fcch_burst_tagger.py sch_detector.py fcch_detector.py chirpz.py DESTINATION ${GR_PYTHON_DIR}/grgsm ) gr-gsm-0.41.2/python/receiver/README000066400000000000000000000010511316153413000167710ustar00rootroot00000000000000chirpz.py - implementation of chirpz transform gsm_input.py - adapts signal to the input of the gsm receiver, executes clock offset correction fcch_detector.py - (experimental componen for a new gsm receiver) detects fcch bursts fcch_burst_tagger.py - (experimental componen for a new gsm receiver) part of fcch_detector - add fcch tag when FCCH burst is found sch_detector.py - (experimental componen for a new gsm receiver) unfinished block that detects exact position of a SCH burst based on fcch tags, should probably also read content of SCH burstsgr-gsm-0.41.2/python/receiver/chirpz.py000066400000000000000000000362411316153413000177730ustar00rootroot00000000000000# This program is public domain # Authors: Paul Kienzle, Nadav Horesh """ Chirp z-transform. CZT: callable (x,axis=-1)->array define a chirp-z transform that can be applied to different signals ZoomFFT: callable (x,axis=-1)->array define a Fourier transform on a range of frequencies ScaledFFT: callable (x,axis=-1)->array define a limited frequency FFT czt: array compute the chirp-z transform for a signal zoomfft: array compute the Fourier transform on a range of frequencies scaledfft: array compute a limited frequency FFT for a signal """ __all__ = ['czt', 'zoomfft', 'scaledfft'] import math, cmath import numpy as np from numpy import pi, arange from scipy.fftpack import fft, ifft, fftshift class CZT: """ Chirp-Z Transform. Transform to compute the frequency response around a spiral. Objects of this class are callables which can compute the chirp-z transform on their inputs. This object precalculates constants for the given transform. If w does not lie on the unit circle, then the transform will be around a spiral with exponentially increasing radius. Regardless, angle will increase linearly. The chirp-z transform can be faster than an equivalent fft with zero padding. Try it with your own array sizes to see. It is theoretically faster for large prime fourier transforms, but not in practice. The chirp-z transform is considerably less precise than the equivalent zero-padded FFT, with differences on the order of 1e-11 from the direct transform rather than the on the order of 1e-15 as seen with zero-padding. See zoomfft for a friendlier interface to partial fft calculations. """ def __init__(self, n, m=None, w=1, a=1): """ Chirp-Z transform definition. Parameters: ---------- n: int The size of the signal m: int The number of points desired. The default is the length of the input data. a: complex The starting point in the complex plane. The default is 1. w: complex or float If w is complex, it is the ratio between points in each step. If w is float, it serves as a frequency scaling factor. for instance when assigning w=0.5, the result FT will span half of frequncy range (that fft would result) at half of the frequncy step size. Returns: -------- CZT: callable object f(x,axis=-1) for computing the chirp-z transform on x """ if m is None: m = n if w is None: w = cmath.exp(-1j*pi/m) elif type(w) in (float, int): w = cmath.exp(-1j*pi/m * w) else: w = cmath.sqrt(w) self.w, self.a = w, a self.m, self.n = m, n k = arange(max(m,n)) wk2 = w**(k**2) nfft = 2**nextpow2(n+m-1) self._Awk2 = (a**-k * wk2)[:n] self._nfft = nfft self._Fwk2 = fft(1/np.hstack((wk2[n-1:0:-1], wk2[:m])), nfft) self._wk2 = wk2[:m] self._yidx = slice(n-1, n+m-1) def __call__(self, x, axis=-1): """ Parameters: ---------- x: array The signal to transform. axis: int Array dimension to operate over. The default is the final dimension. Returns: ------- An array of the same dimensions as x, but with the length of the transformed axis set to m. Note that this is a view on a much larger array. To save space, you may want to call it as y = czt(x).copy() """ x = np.asarray(x) if x.shape[axis] != self.n: raise ValueError("CZT defined for length %d, not %d" % (self.n, x.shape[axis])) # Calculate transpose coordinates, to allow operation on any given axis trnsp = np.arange(x.ndim) trnsp[[axis, -1]] = [-1, axis] x = x.transpose(*trnsp) y = ifft(self._Fwk2 * fft(x*self._Awk2, self._nfft)) y = y[..., self._yidx] * self._wk2 return y.transpose(*trnsp) def nextpow2(n): """ Return the smallest power of two greater than or equal to n. """ return int(math.ceil(math.log(n)/math.log(2))) def ZoomFFT(n, f1, f2=None, m=None, Fs=2): """ Zoom FFT transform definition. Computes the Fourier transform for a set of equally spaced frequencies. Parameters: ---------- n: int size of the signal m: int size of the output f1, f2: float start and end frequencies; if f2 is not specified, use 0 to f1 Fs: float sampling frequency (default=2) Returns: ------- A CZT instance A callable object f(x,axis=-1) for computing the zoom FFT on x. Sampling frequency is 1/dt, the time step between samples in the signal x. The unit circle corresponds to frequencies from 0 up to the sampling frequency. The default sampling frequency of 2 means that f1,f2 values up to the Nyquist frequency are in the range [0,1). For f1,f2 values expressed in radians, a sampling frequency of 1/pi should be used. To graph the magnitude of the resulting transform, use:: plot(linspace(f1,f2,m), abs(zoomfft(x,f1,f2,m))). Use the zoomfft wrapper if you only need to compute one transform. """ if m is None: m = n if f2 is None: f1, f2 = 0., f1 w = cmath.exp(-2j * pi * (f2-f1) / ((m-1)*Fs)) a = cmath.exp(2j * pi * f1/Fs) return CZT(n, m=m, w=w, a=a) def ScaledFFT(n, m=None, scale=1.0): """ Scaled fft transform definition. Similar to fft, where the frequency range is scaled by a factor 'scale' and divided into 'm-1' equal steps. Like the FFT, frequencies are arranged from 0 to scale*Fs/2-delta followed by -scale*Fs/2 to -delta, where delta is the step size scale*Fs/m for sampling frequence Fs. The intended use is in a convolution of two signals, each has its own sampling step. This is equivalent to: fftshift(zoomfft(x, -scale, scale*(m-2.)/m, m=m)) For example: m,n = 10,len(x) sf = ScaledFFT(n, m=m, scale=0.25) X = fftshift(fft(x)) W = linspace(-8, 8*(n-2.)/n, n) SX = fftshift(sf(x)) SW = linspace(-2, 2*(m-2.)/m, m) plot(X,W,SX,SW) Parameters: ---------- n: int Size of the signal m: int The size of the output. Default: m=n scale: float Frequenct scaling factor. Default: scale=1.0 Returns: ------- function A callable f(x,axis=-1) for computing the scaled FFT on x. """ if m is None: m = n w = np.exp(-2j * pi / m * scale) a = w**(m//2) transform = CZT(n=n, m=m, a=a, w=w) return lambda x, axis=-1: fftshift(transform(x, axis), axes=(axis,)) def scaledfft(x, m=None, scale=1.0, axis=-1): """ Partial with a frequency scaling. See ScaledFFT doc for details Parameters: ---------- x: input array m: int The length of the output signal scale: float A frequency scaling factor axis: int The array dimension to operate over. The default is the final dimension. Returns: ------- An array of the same rank of 'x', but with the size if the 'axis' dimension set to 'm' """ return ScaledFFT(x.shape[axis], m, scale)(x,axis) def czt(x, m=None, w=1.0, a=1, axis=-1): """ Compute the frequency response around a spiral. Parameters: ---------- x: array The set of data to transform. m: int The number of points desired. The default is the length of the input data. a: complex The starting point in the complex plane. The default is 1. w: complex or float If w is complex, it is the ratio between points in each step. If w is float, it is the frequency step scale (relative to the normal dft frquency step). axis: int Array dimension to operate over. The default is the final dimension. Returns: ------- An array of the same dimensions as x, but with the length of the transformed axis set to m. Note that this is a view on a much larger array. To save space, you may want to call it as y = ascontiguousarray(czt(x)) See zoomfft for a friendlier interface to partial fft calculations. If the transform needs to be repeated, use CZT to construct a specialized transform function which can be reused without recomputing constants. """ x = np.asarray(x) transform = CZT(x.shape[axis], m=m, w=w, a=a) return transform(x,axis=axis) def zoomfft(x, f1, f2=None, m=None, Fs=2, axis=-1): """ Compute the Fourier transform of x for frequencies in [f1, f2]. Parameters: ---------- m: int The number of points to evaluate. The default is the length of x. f1, f2: float The frequency range. If f2 is not specified, the range 0-f1 is assumed. Fs: float The sampling frequency. With a sampling frequency of 10kHz for example, the range f1 and f2 can be expressed in kHz. The default sampling frequency is 2, so f1 and f2 should be in the range 0,1 to keep the transform below the Nyquist frequency. x : array The input signal. axis: int The array dimension the transform operates over. The default is the final dimension. Returns: ------- array The transformed signal. The fourier transform will be calculate at the points f1, f1+df, f1+2df, ..., f2, where df=(f2-f1)/m. zoomfft(x,0,2-2./len(x)) is equivalent to fft(x). To graph the magnitude of the resulting transform, use:: plot(linspace(f1,f2,m), abs(zoomfit(x,f1,f2,m))). If the transform needs to be repeated, use ZoomFFT to construct a specialized transform function which can be reused without recomputing constants. """ x = np.asarray(x) transform = ZoomFFT(x.shape[axis], f1, f2=f2, m=m, Fs=Fs) return transform(x,axis=axis) def _test1(x,show=False,plots=[1,2,3,4]): norm = np.linalg.norm # Normal fft and zero-padded fft equivalent to 10x oversampling over=10 w = np.linspace(0,2-2./len(x),len(x)) y = fft(x) wover = np.linspace(0,2-2./(over*len(x)),over*len(x)) yover = fft(x,over*len(x)) # Check that zoomfft is the equivalent of fft y1 = zoomfft(x,0,2-2./len(y)) # Check that zoomfft with oversampling is equivalent to zero padding y2 = zoomfft(x,0,2-2./len(yover), m=len(yover)) # Check that zoomfft works on a subrange f1,f2 = w[3],w[6] y3 = zoomfft(x,f1,f2,m=3*over+1) w3 = np.linspace(f1,f2,len(y3)) idx3 = slice(3*over,6*over+1) if not show: plots = [] if plots != []: import pylab if 0 in plots: pylab.figure(0) pylab.plot(x) pylab.ylabel('Intensity') if 1 in plots: pylab.figure(1) pylab.subplot(311) pylab.plot(w,abs(y),'o',w,abs(y1)) pylab.legend(['fft','zoom']) pylab.ylabel('Magnitude') pylab.title('FFT equivalent') pylab.subplot(312) pylab.plot(w,np.angle(y),'o',w,np.angle(y1)) pylab.legend(['fft','zoom']) pylab.ylabel('Phase (radians)') pylab.subplot(313) pylab.plot(w,abs(y)-abs(y1)) #,w,np.angle(y)-np.angle(y1)) #pylab.legend(['magnitude','phase']) pylab.ylabel('Residuals') if 2 in plots: pylab.figure(2) pylab.subplot(211) pylab.plot(w,abs(y),'o',wover,abs(y2),wover,abs(yover)) pylab.ylabel('Magnitude') pylab.title('Oversampled FFT') pylab.legend(['fft','zoom','pad']) pylab.subplot(212) pylab.plot(wover,abs(yover)-abs(y2), w,abs(y)-abs(y2[0::over]),'o', w,abs(y)-abs(yover[0::over]),'x') pylab.legend(['pad-zoom','fft-zoom','fft-pad']) pylab.ylabel('Residuals') if 3 in plots: pylab.figure(3) ax1=pylab.subplot(211) pylab.plot(w,abs(y),'o',w3,abs(y3),wover,abs(yover), w[3:7],abs(y3[::over]),'x') pylab.title('Zoomed FFT') pylab.ylabel('Magnitude') pylab.legend(['fft','zoom','pad']) pylab.plot(w3,abs(y3),'x') ax1.set_xlim(f1,f2) ax2=pylab.subplot(212) pylab.plot(wover[idx3],abs(yover[idx3])-abs(y3), w[3:7],abs(y[3:7])-abs(y3[::over]),'o', w[3:7],abs(y[3:7])-abs(yover[3*over:6*over+1:over]),'x') pylab.legend(['pad-zoom','fft-zoom','fft-pad']) ax2.set_xlim(f1,f2) pylab.ylabel('Residuals') if plots != []: pylab.show() err = norm(y-y1)/norm(y) #print "direct err %g"%err assert err < 1e-10, "error for direct transform is %g"%(err,) err = norm(yover-y2)/norm(yover) #print "over err %g"%err assert err < 1e-10, "error for oversampling is %g"%(err,) err = norm(yover[idx3]-y3)/norm(yover[idx3]) #print "range err %g"%err assert err < 1e-10, "error for subrange is %g"%(err,) def _testscaled(x): n = len(x) norm = np.linalg.norm assert norm(fft(x)-scaledfft(x)) < 1e-10 assert norm(fftshift(fft(x))[n/4:3*n/4] - fftshift(scaledfft(x,scale=0.5,m=n/2))) < 1e-10 def test(demo=None,plots=[1,2,3]): # 0: Gauss t = np.linspace(-2,2,128) x = np.exp(-t**2/0.01) _test1(x, show=(demo==0), plots=plots) # 1: Linear x=[1,2,3,4,5,6,7] _test1(x, show=(demo==1), plots=plots) # Check near powers of two _test1(range(126-31), show=False) _test1(range(127-31), show=False) _test1(range(128-31), show=False) _test1(range(129-31), show=False) _test1(range(130-31), show=False) # Check transform on n-D array input x = np.reshape(np.arange(3*2*28),(3,2,28)) y1 = zoomfft(x,0,2-2./28) y2 = zoomfft(x[2,0,:],0,2-2./28) err = np.linalg.norm(y2-y1[2,0]) assert err < 1e-15, "error for n-D array is %g"%(err,) # 2: Random (not a test condition) if demo==2: x = np.random.rand(101) _test1(x, show=True, plots=plots) # 3: Spikes t=np.linspace(0,1,128) x=np.sin(2*pi*t*5)+np.sin(2*pi*t*13) _test1(x, show=(demo==3), plots=plots) # 4: Sines x=np.zeros(100) x[[1,5,21]]=1 _test1(x, show=(demo==4), plots=plots) # 5: Sines plus complex component x += 1j*np.linspace(0,0.5,x.shape[0]) _test1(x, show=(demo==5), plots=plots) # 6: Scaled FFT on complex sines x += 1j*np.linspace(0,0.5,x.shape[0]) if demo == 6: demo_scaledfft(x,0.25,200) _testscaled(x) def demo_scaledfft(v, scale, m): import pylab shift = pylab.fftshift n = len(v) x = pylab.linspace(-0.5, 0.5 - 1./n, n) xz = pylab.linspace(-scale*0.5, scale*0.5*(m-2.)/m, m) pylab.figure() pylab.plot(x, shift(abs(fft(v))), label='fft') pylab.plot(x, shift(abs(scaledfft(v))),'ro', label='x1 scaled fft') pylab.plot(xz, abs(zoomfft(v, -scale, scale*(m-2.)/m, m=m)), 'bo',label='zoomfft') pylab.plot(xz, shift(abs(scaledfft(v, m=m, scale=scale))), 'gx', label='x'+str(scale)+' scaled fft') pylab.gca().set_yscale('log') pylab.legend() pylab.show() if __name__ == "__main__": # Choose demo in [0,4] to show plot, or None for testing only test(demo=None) gr-gsm-0.41.2/python/receiver/fcch_burst_tagger.py000066400000000000000000000132511316153413000221430ustar00rootroot00000000000000#!/usr/bin/env python2 # -*- coding: utf-8 -*- # @file # @author (C) 2014 by Piotr Krysik # @section LICENSE # # This is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # This software is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this software; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # from numpy import * #from pylab import * from gnuradio import gr import pmt from grgsm.chirpz import ZoomFFT class fcch_burst_tagger(gr.sync_block): """ docstring for block fcch_burst_tagger """ def __init__(self, OSR): gr.sync_block.__init__(self, name="fcch_burst_tagger", in_sig=[complex64, float32], out_sig=[complex64]) self.state=False self.symbol_rate = 1625000/6 self.OSR=OSR self.samp_rate = self.symbol_rate*OSR self.burst_size = int(156.25*self.OSR) self.guard_period = int(round(8.25*self.OSR)) self.block_size = self.burst_size+self.guard_period self.processed_block_size = int(142*self.OSR) self.set_history(self.block_size) self.set_output_multiple(self.guard_period) self.prev_offset=0 #parameters of zoomfft frequency estimator f1 = self.symbol_rate/4*0.9 f2 = self.symbol_rate/4*1.1 m=5000*self.OSR self.zoomfft = ZoomFFT(self.processed_block_size, f1, f2, m, Fs=self.samp_rate) self.f_axis = linspace(f1,f2,m) def work(self, input_items, output_items): in0=input_items[0] output_items[0][:] = in0[self.history()-1:] threshold = input_items[1][self.history()-1:] threshold_diff = diff(concatenate([[0],threshold])) up_to_high_indexes = nonzero(threshold_diff>0)[0] up_to_high_idx=[] for up_to_high_idx in up_to_high_indexes: #look for "high" value at the trigger if up_to_high_idx==0 and self.state==True: #if it's not transition from "low" to "high" continue #then continue self.state=True #if found - change state if self.state==True and up_to_high_idx and any(threshold_diff<0): #and look for transition from high to low last_up_to_high_idx = up_to_high_idx last_high_to_low_idx = nonzero(threshold_diff<0)[0][-1] if last_high_to_low_idx-last_up_to_high_idx>0: coarse_idx = int(last_high_to_low_idx+self.history()-self.block_size) inst_freq = angle(in0[coarse_idx:coarse_idx+self.block_size]*in0[coarse_idx-self.OSR:coarse_idx+self.block_size-self.OSR].conj())/(2*pi)*self.symbol_rate #instantaneus frequency estimate precise_idx = self.find_best_position(inst_freq) # measured_freq = mean(inst_freq[precise_idx:precise_idx+self.processed_block_size]) expected_freq = self.symbol_rate/4 print "input_items:",len(in0) print "coarse_idx",coarse_idx print "coarse_idx+precise_idx",coarse_idx+precise_idx zoomed_spectrum = abs(self.zoomfft(in0[coarse_idx+precise_idx:coarse_idx+precise_idx+self.processed_block_size])) measured_freq = self.f_axis[argmax(zoomed_spectrum)] freq_offset = measured_freq - expected_freq offset = self.nitems_written(0) + coarse_idx + precise_idx - self.guard_period key = pmt.string_to_symbol("fcch") value = pmt.from_double(freq_offset) self.add_item_tag(0,offset, key, value) self.state=False # Some additional plots and prints for debugging # print "coarse_idx+precise_idx",coarse_idx+precise_idx # print "offset-self.nitems_written(0):",offset-self.nitems_written(0) print offset-self.prev_offset self.prev_offset=offset print "freq offset", freq_offset # freq_offset = measured_freq - expected_freq # plot(self.f_axis, zoomed_spectrum) # show() # plot(inst_freq[precise_idx:precise_idx+self.burst_size]) # show() # plot(unwrap(angle(in0[coarse_idx+precise_idx:coarse_idx+precise_idx+self.burst_size]))) # show() # return len(output_items[0]) def find_best_position(self, inst_freq): lowest_max_min_diff = 1e6 #1e6 - just some large value start_pos = 0 for ii in xrange(0,int(2*self.guard_period)): min_inst_freq = min(inst_freq[ii:self.processed_block_size+ii-1]); max_inst_freq = max(inst_freq[ii:self.processed_block_size+ii-1]); if (lowest_max_min_diff > max_inst_freq - min_inst_freq): lowest_max_min_diff = max_inst_freq - min_inst_freq; start_pos = ii # print 'start_pos',start_pos # plot(xrange(start_pos,start_pos+self.processed_block_size),inst_freq[start_pos:start_pos+self.processed_block_size],'r.') # hold(True) # plot(inst_freq) # show() return start_pos gr-gsm-0.41.2/python/receiver/fcch_detector.py000066400000000000000000000075451316153413000212750ustar00rootroot00000000000000#!/usr/bin/env python2 # -*- coding: utf-8 -*- # @file # @author (C) 2014 by Piotr Krysik # @section LICENSE # # Gr-gsm is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Gr-gsm is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with gr-gsm; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # ################################################## # Gnuradio Python Flow Graph # Title: FCCH Bursts Detector # Author: Piotr Krysik # # Description: Detects positions of FCCH bursts. At the end of each # detected FCCH burst adds to the stream a tag with key "fcch" and value # which is a frequency offset estimate. The input sampling frequency # should be integer multiply of GSM GMKS symbol rate - 1625000/6 Hz. ################################################## from gnuradio import blocks from gnuradio import gr from gnuradio.filter import firdes import grgsm class fcch_detector(grgsm.hier_block): def __init__(self, OSR=4): grgsm.hier_block.__init__( self, "FCCH bursts detector", gr.io_signature(1, 1, gr.sizeof_gr_complex*1), gr.io_signature(1, 1, gr.sizeof_gr_complex*1), ) ################################################## # Parameters ################################################## self.OSR = OSR ################################################## # Variables ################################################## self.f_symb = f_symb = 1625000.0/6.0 self.samp_rate = samp_rate = f_symb*OSR ################################################## # Blocks ################################################## self.gsm_fcch_burst_tagger_0 = grgsm.fcch_burst_tagger(OSR) self.blocks_threshold_ff_0_0 = blocks.threshold_ff(0, 0, 0) self.blocks_threshold_ff_0 = blocks.threshold_ff(int((138)*samp_rate/f_symb), int((138)*samp_rate/f_symb), 0) self.blocks_multiply_conjugate_cc_0 = blocks.multiply_conjugate_cc(1) self.blocks_moving_average_xx_0 = blocks.moving_average_ff(int((142)*samp_rate/f_symb), 1, int(1e6)) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, int(OSR)) self.blocks_complex_to_arg_0 = blocks.complex_to_arg(1) ################################################## # Connections ################################################## self.connect((self, 0), (self.blocks_multiply_conjugate_cc_0, 0)) self.connect((self.blocks_delay_0, 0), (self.blocks_multiply_conjugate_cc_0, 1)) self.connect((self.blocks_complex_to_arg_0, 0), (self.blocks_threshold_ff_0_0, 0)) self.connect((self, 0), (self.blocks_delay_0, 0)) self.connect((self.blocks_multiply_conjugate_cc_0, 0), (self.blocks_complex_to_arg_0, 0)) self.connect((self.blocks_moving_average_xx_0, 0), (self.blocks_threshold_ff_0, 0)) self.connect((self.blocks_threshold_ff_0_0, 0), (self.blocks_moving_average_xx_0, 0)) self.connect((self.gsm_fcch_burst_tagger_0, 0), (self, 0)) self.connect((self, 0), (self.gsm_fcch_burst_tagger_0, 0)) self.connect((self.blocks_threshold_ff_0, 0), (self.gsm_fcch_burst_tagger_0, 1)) def get_OSR(self): return self.OSR def set_OSR(self, OSR): self.OSR = OSR self.set_samp_rate(self.f_symb*self.OSR) self.blocks_delay_0.set_dly(int(self.OSR)) gr-gsm-0.41.2/python/receiver/gsm_input.py000066400000000000000000000105621316153413000204770ustar00rootroot00000000000000#!/usr/bin/env python2 # -*- coding: utf-8 -*- # @file # @author (C) 2014 by Piotr Krysik # @section LICENSE # # Gr-gsm is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Gr-gsm is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with gr-gsm; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # ################################################## # GNU Radio Python Flow Graph # Title: GSM input adaptor # Author: Piotr Krysik # Description: Adaptor of input stream for the GSM receiver. Contains frequency ofset corrector doing also resampling to integer multiplies of GSM sample rate and LP filter filtering GSM channel. # Generated: Sun Jul 17 17:36:46 2016 ################################################## from gnuradio import filter from gnuradio import gr from gnuradio.filter import firdes import grgsm class gsm_input(grgsm.hier_block): def __init__(self, fc=940e6, osr=4, ppm=0, samp_rate_in=1e6): gr.hier_block2.__init__( self, "GSM input adaptor", gr.io_signature(1, 1, gr.sizeof_gr_complex*1), gr.io_signature(1, 1, gr.sizeof_gr_complex*1), ) self.message_port_register_hier_in("ctrl_in") ################################################## # Parameters ################################################## self.fc = fc self.osr = osr self.ppm = ppm self.samp_rate_in = samp_rate_in ################################################## # Variables ################################################## self.gsm_symb_rate = gsm_symb_rate = 1625000.0/6.0 self.samp_rate_out = samp_rate_out = gsm_symb_rate*osr ################################################## # Blocks ################################################## self.low_pass_filter_0_0 = filter.fir_filter_ccf(1, firdes.low_pass( 1, samp_rate_out, 125e3, 5e3, firdes.WIN_HAMMING, 6.76)) self.gsm_clock_offset_corrector_tagged_0 = grgsm.clock_offset_corrector_tagged( fc=fc, samp_rate_in=samp_rate_in, ppm=ppm, osr=osr, ) ################################################## # Connections ################################################## self.msg_connect((self, 'ctrl_in'), (self.gsm_clock_offset_corrector_tagged_0, 'ctrl')) self.connect((self.gsm_clock_offset_corrector_tagged_0, 0), (self.low_pass_filter_0_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self, 0)) self.connect((self, 0), (self.gsm_clock_offset_corrector_tagged_0, 0)) def get_fc(self): return self.fc def set_fc(self, fc): self.fc = fc self.gsm_clock_offset_corrector_tagged_0.set_fc(self.fc) def get_osr(self): return self.osr def set_osr(self, osr): self.osr = osr self.set_samp_rate_out(self.gsm_symb_rate*self.osr) self.gsm_clock_offset_corrector_tagged_0.set_osr(self.osr) def get_ppm(self): return self.ppm def set_ppm(self, ppm): self.ppm = ppm self.gsm_clock_offset_corrector_tagged_0.set_ppm(self.ppm) def get_samp_rate_in(self): return self.samp_rate_in def set_samp_rate_in(self, samp_rate_in): self.samp_rate_in = samp_rate_in self.gsm_clock_offset_corrector_tagged_0.set_samp_rate_in(self.samp_rate_in) def get_gsm_symb_rate(self): return self.gsm_symb_rate def set_gsm_symb_rate(self, gsm_symb_rate): self.gsm_symb_rate = gsm_symb_rate self.set_samp_rate_out(self.gsm_symb_rate*self.osr) def get_samp_rate_out(self): return self.samp_rate_out def set_samp_rate_out(self, samp_rate_out): self.samp_rate_out = samp_rate_out self.low_pass_filter_0_0.set_taps(firdes.low_pass(1, self.samp_rate_out, 125e3, 5e3, firdes.WIN_HAMMING, 6.76)) gr-gsm-0.41.2/python/receiver/sch_detector.py000066400000000000000000000156221316153413000211420ustar00rootroot00000000000000#!/usr/bin/env python # -*- coding: utf-8 -*- # @file # @author (C) 2014 by Piotr Krysik # @section LICENSE # # This is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # This software is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this software; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # from numpy import * #from pylab import * from gnuradio import gr import pmt from scipy.ndimage.filters import uniform_filter1d class sch_receiver(): """ docstring for class sch_reciever """ def __init__(self, OSR): self.sync_seq = array([1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1]) self.OSR = OSR sync_seq_msk_tmp = self.msk_mod(self.sync_seq, -1j) self.sync_seq_msk = sync_seq_msk_tmp[5:59] self.sync_seq_msk_interp = zeros(self.OSR*len(self.sync_seq_msk), dtype=complex64) self.sync_seq_msk_interp[::OSR] = self.sync_seq_msk self.L = 5 def msk_mod(self, x, start_point): x_nrz = 2*x-1 x_diffenc = x_nrz[1:]*x_nrz[0:-1] mod_tmp = concatenate((array([start_point]),1j*x_diffenc)) return cumprod(mod_tmp) def get_chan_imp_resp(self, sch_burst): sch_burst_bl = resize(array(sch_burst), (int(len(sch_burst)/self.OSR),self.OSR)) correlation_bl = zeros(shape(sch_burst_bl), dtype=complex64) for ii in xrange(0,self.OSR): correlation_bl[:,ii]=correlate(sch_burst_bl[:,ii],self.sync_seq_msk,'same') correlation_bl = correlation_bl/len(self.sync_seq_msk) power_bl_mov_avg = uniform_filter1d(abs(correlation_bl)**2,self.L+1,mode='constant',axis=0) print "correlation_bl.argmax()",argmax(abs(correlation_bl)) print "power_bl_mov_avg.argmax()",(power_bl_mov_avg).argmax() print 'unravel_index(correlation_bl.argmax(), correlation_bl.shape)',unravel_index(argmax(abs(correlation_bl)), correlation_bl.shape) print 'unravel_index(power_bl_mov_avg.argmax(), power_bl_mov_avg.shape)',unravel_index(power_bl_mov_avg.argmax(), power_bl_mov_avg.shape) (r_corrmax, c_corrmax)=unravel_index(argmax(abs(correlation_bl)), correlation_bl.shape) (r_powmax, c_powmax)=unravel_index(power_bl_mov_avg.argmax(), power_bl_mov_avg.shape) # correlation = zeros(shape(sch_burst)) # correlation = correlate(sch_burst, self.sync_seq_msk_interp,'same')/len(self.sync_seq_msk) # print "pozycja maksimum",argmax(abs(correlation)) # plot(abs(hstack(correlation_bl))*1000) ## hold(True) ## plot(abs(sch_burst)*500) ## print shape(range(0,len(sch_burst),self.OSR)) ## print shape(correlation_bl[:,0]) # for ii in range(0,self.OSR): # if ii == c_powmax: # plot(range(ii,len(correlation_bl[:,0])*self.OSR,self.OSR),power_bl_mov_avg[:,ii]*5e6,'g.') # else: # plot(range(ii,len(correlation_bl[:,0])*self.OSR,self.OSR),power_bl_mov_avg[:,ii]*5e6,'r.') # show() # figure() print 'r_powmax: ',r_powmax # plot(abs(correlation_bl[range(r_powmax-(self.L+1)/2+1,r_powmax+(self.L+1)/2+1), c_powmax]),'g') # hold(True) # plot(abs(correlation_bl[range(r_corrmax-(self.L+1)/2+1,r_corrmax+(self.L+1)/2+1), c_corrmax]),'r') # show() def receive(self, input_corr, chan_imp_resp): pass class sch_detector(gr.sync_block): """ docstring for block sch_detector """ def __init__(self, OSR): gr.sync_block.__init__(self, name="sch_detector", in_sig=[complex64], out_sig=[complex64]) self.OSR = OSR self.states = {"waiting_for_fcch_tag":1, "reaching_sch_burst":2, "sch_at_input_buffer":3} self.state = self.states["waiting_for_fcch_tag"] self.sch_offset = -100 #-100 - just some invalid value of sch burst position in the stream self.burst_size = int(round(156.25*self.OSR)) self.guard_period = int(round(8.25*self.OSR)) self.block_size = self.burst_size + self.guard_period self.set_history(self.block_size) self.set_output_multiple(self.guard_period) self.sch_receiver = sch_receiver(OSR) def work(self, input_items, output_items): in0 = input_items[0] out = output_items[0] to_consume = len(in0)-self.history() if self.state == self.states["waiting_for_fcch_tag"]: fcch_tags = [] start = self.nitems_written(0) stop = start + len(in0) key = pmt.string_to_symbol("fcch") fcch_tags = self.get_tags_in_range(0, start, stop, key) if fcch_tags: self.sch_offset = fcch_tags[0].offset + int(round(8*self.burst_size+0*self.guard_period)) #156.25 is number of GMSK symbols per timeslot, #8.25 is arbitrary safety margin in order to avoid cutting boundary of SCH burst self.state = self.states["reaching_sch_burst"] elif self.state == self.states["reaching_sch_burst"]: samples_left = self.sch_offset-self.nitems_written(0) if samples_left <= len(in0)-self.history(): to_consume = samples_left self.state = self.states["sch_at_input_buffer"] elif self.state == self.states["sch_at_input_buffer"]: offset = self.nitems_written(0) key = pmt.string_to_symbol("sch") value = pmt.from_double(0) self.add_item_tag(0,offset, key, value) self.state = self.states["waiting_for_fcch_tag"] self.sch_receiver.get_chan_imp_resp(in0[0:self.block_size+self.guard_period]) # plot(unwrap(angle(in0[0:2*self.block_size]))) # show() out[:] = in0[self.history()-1:] return to_consume def get_OSR(self): return self.OSR def set_OSR(self, OSR): self.OSR = OSR self.burst_size = int(round(156.25*self.OSR)) self.guard_period = int(round(8.25*self.OSR)) self.block_size = self.burst_size + self.guard_period self.set_history(self.block_size) self.sch_receiver = sch_receiver(OSR) gr-gsm-0.41.2/swig/000077500000000000000000000000001316153413000137405ustar00rootroot00000000000000gr-gsm-0.41.2/swig/CMakeLists.txt000066400000000000000000000046571316153413000165140ustar00rootroot00000000000000# Copyright 2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. ######################################################################## # Include swig generation macros ######################################################################## find_package(SWIG) find_package(PythonLibs 2) if(NOT SWIG_FOUND OR NOT PYTHONLIBS_FOUND) return() endif() include(GrSwig) include(GrPython) IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") # Mac OS X specific code # Without this flag it does not find some of the libraries SET(CMAKE_MODULE_LINKER_FLAGS "-undefined dynamic_lookup") ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") ######################################################################## # Setup swig generation ######################################################################## foreach(incdir ${GNURADIO_RUNTIME_INCLUDE_DIRS}) list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/gnuradio/swig) endforeach(incdir) list(APPEND GR_SWIG_INCLUDE_DIRS ${FFTW3F_INCLUDE_DIRS}) set(GR_SWIG_LIBRARIES grgsm) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/grgsm_swig_doc.i) set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include) GR_SWIG_MAKE(grgsm_swig grgsm_swig.i) ######################################################################## # Install the build swig module ######################################################################## GR_SWIG_INSTALL(TARGETS grgsm_swig DESTINATION ${GR_PYTHON_DIR}/grgsm) ######################################################################## # Install swig .i files for development ######################################################################## install( FILES grgsm_swig.i constants.i ${CMAKE_CURRENT_BINARY_DIR}/grgsm_swig_doc.i DESTINATION ${GR_INCLUDE_DIR}/grgsm/swig ) gr-gsm-0.41.2/swig/constants.i000066400000000000000000000023041316153413000161250ustar00rootroot00000000000000/* -*- c++ -*- */ /* * Copyright 2006,2009,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU Radio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ namespace gr { namespace gsm{ %rename(build_date) build_date; %rename(version) version; %rename(version_info) version_info; const std::string build_date(); const std::string version(); const std::string major_version(); const std::string api_version(); const std::string minor_version(); const std::string maint_version(); } /* namespace gsm */ } /* namespace gr */ gr-gsm-0.41.2/swig/grgsm_swig.i000066400000000000000000000133531316153413000162670ustar00rootroot00000000000000/* -*- c++ -*- */ /* * @file * @author (C) 2014 by Piotr Krysik * @section LICENSE * * Gr-gsm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * Gr-gsm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with gr-gsm; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #define GRGSM_API %include "gnuradio.i" // the common stuff //load generated python docstrings %include "grgsm_swig_doc.i" %{ #include "grgsm/constants.h" #include "grgsm/receiver/receiver.h" #include "grgsm/receiver/clock_offset_control.h" #include "grgsm/receiver/cx_channel_hopper.h" #include "grgsm/decoding/control_channels_decoder.h" #include "grgsm/decoding/tch_f_decoder.h" #include "grgsm/decryption/decryption.h" #include "grgsm/demapping/universal_ctrl_chans_demapper.h" #include "grgsm/demapping/tch_f_chans_demapper.h" #include "grgsm/flow_control/common.h" #include "grgsm/flow_control/burst_timeslot_splitter.h" #include "grgsm/flow_control/burst_sdcch_subslot_splitter.h" #include "grgsm/flow_control/burst_timeslot_filter.h" #include "grgsm/flow_control/burst_sdcch_subslot_filter.h" #include "grgsm/flow_control/burst_fnr_filter.h" #include "grgsm/flow_control/dummy_burst_filter.h" #include "grgsm/flow_control/uplink_downlink_splitter.h" #include "grgsm/misc_utils/bursts_printer.h" #include "grgsm/misc_utils/controlled_rotator_cc.h" #include "grgsm/misc_utils/extract_system_info.h" #include "grgsm/misc_utils/extract_immediate_assignment.h" #include "grgsm/misc_utils/message_printer.h" #include "grgsm/misc_utils/tmsi_dumper.h" #include "grgsm/misc_utils/burst_file_sink.h" #include "grgsm/misc_utils/burst_file_source.h" #include "grgsm/misc_utils/collect_system_info.h" #include "grgsm/misc_utils/extract_cmc.h" #include "grgsm/qa_utils/burst_sink.h" #include "grgsm/qa_utils/burst_source.h" #include "grgsm/qa_utils/message_source.h" #include "grgsm/qa_utils/message_sink.h" #include "grgsm/misc_utils/message_file_sink.h" #include "grgsm/misc_utils/message_file_source.h" #include "grgsm/misc_utils/msg_to_tag.h" #include "grgsm/misc_utils/controlled_fractional_resampler_cc.h" %} %include "constants.i" %include "grgsm/receiver/receiver.h" GR_SWIG_BLOCK_MAGIC2(gsm, receiver); %include "grgsm/receiver/clock_offset_control.h" GR_SWIG_BLOCK_MAGIC2(gsm, clock_offset_control); %include "grgsm/receiver/cx_channel_hopper.h" GR_SWIG_BLOCK_MAGIC2(gsm, cx_channel_hopper); %include "grgsm/decoding/control_channels_decoder.h" GR_SWIG_BLOCK_MAGIC2(gsm, control_channels_decoder); %include "grgsm/decoding/tch_f_decoder.h" GR_SWIG_BLOCK_MAGIC2(gsm, tch_f_decoder); %include "grgsm/decryption/decryption.h" GR_SWIG_BLOCK_MAGIC2(gsm, decryption); %include "grgsm/demapping/universal_ctrl_chans_demapper.h" GR_SWIG_BLOCK_MAGIC2(gsm, universal_ctrl_chans_demapper); %include "grgsm/demapping/tch_f_chans_demapper.h" GR_SWIG_BLOCK_MAGIC2(gsm, tch_f_chans_demapper); %include "grgsm/flow_control/common.h" %include "grgsm/flow_control/burst_timeslot_splitter.h" GR_SWIG_BLOCK_MAGIC2(gsm, burst_timeslot_splitter); %include "grgsm/flow_control/burst_sdcch_subslot_splitter.h" GR_SWIG_BLOCK_MAGIC2(gsm, burst_sdcch_subslot_splitter); %include "grgsm/flow_control/burst_timeslot_filter.h" GR_SWIG_BLOCK_MAGIC2(gsm, burst_timeslot_filter); %include "grgsm/flow_control/burst_sdcch_subslot_filter.h" GR_SWIG_BLOCK_MAGIC2(gsm, burst_sdcch_subslot_filter); %include "grgsm/flow_control/burst_fnr_filter.h" GR_SWIG_BLOCK_MAGIC2(gsm, burst_fnr_filter); %include "grgsm/flow_control/dummy_burst_filter.h" GR_SWIG_BLOCK_MAGIC2(gsm, dummy_burst_filter); %include "grgsm/flow_control/uplink_downlink_splitter.h" GR_SWIG_BLOCK_MAGIC2(grgsm, uplink_downlink_splitter); %include "grgsm/misc_utils/bursts_printer.h" GR_SWIG_BLOCK_MAGIC2(gsm, bursts_printer); %include "grgsm/misc_utils/burst_file_sink.h" GR_SWIG_BLOCK_MAGIC2(gsm, burst_file_sink); %include "grgsm/misc_utils/burst_file_source.h" GR_SWIG_BLOCK_MAGIC2(gsm, burst_file_source); %include "grgsm/misc_utils/collect_system_info.h" GR_SWIG_BLOCK_MAGIC2(gsm, collect_system_info); %include "grgsm/misc_utils/extract_system_info.h" GR_SWIG_BLOCK_MAGIC2(gsm, extract_system_info); %include "grgsm/misc_utils/extract_immediate_assignment.h" GR_SWIG_BLOCK_MAGIC2(gsm, extract_immediate_assignment); %include "grgsm/misc_utils/controlled_rotator_cc.h" GR_SWIG_BLOCK_MAGIC2(gsm, controlled_rotator_cc); %include "grgsm/misc_utils/message_printer.h" GR_SWIG_BLOCK_MAGIC2(gsm, message_printer); %include "grgsm/misc_utils/tmsi_dumper.h" GR_SWIG_BLOCK_MAGIC2(gsm, tmsi_dumper); %include "grgsm/misc_utils/message_file_sink.h" GR_SWIG_BLOCK_MAGIC2(gsm, message_file_sink); %include "grgsm/misc_utils/message_file_source.h" GR_SWIG_BLOCK_MAGIC2(gsm, message_file_source); %include "grgsm/misc_utils/msg_to_tag.h" GR_SWIG_BLOCK_MAGIC2(gsm, msg_to_tag); %include "grgsm/misc_utils/controlled_fractional_resampler_cc.h" GR_SWIG_BLOCK_MAGIC2(gsm, controlled_fractional_resampler_cc); %include "grgsm/misc_utils/extract_cmc.h" GR_SWIG_BLOCK_MAGIC2(gsm, extract_cmc); %include "grgsm/qa_utils/burst_sink.h" GR_SWIG_BLOCK_MAGIC2(gsm, burst_sink); %include "grgsm/qa_utils/burst_source.h" GR_SWIG_BLOCK_MAGIC2(gsm, burst_source); %include "grgsm/qa_utils/message_source.h" GR_SWIG_BLOCK_MAGIC2(gsm, message_source); %include "grgsm/qa_utils/message_sink.h" GR_SWIG_BLOCK_MAGIC2(gsm, message_sink); gr-gsm-0.41.2/test_data/000077500000000000000000000000001316153413000147375ustar00rootroot00000000000000gr-gsm-0.41.2/tests/000077500000000000000000000000001316153413000141315ustar00rootroot00000000000000gr-gsm-0.41.2/tests/dockerfiles/000077500000000000000000000000001316153413000164235ustar00rootroot00000000000000gr-gsm-0.41.2/tests/dockerfiles/Debian_Jessie.docker000066400000000000000000000013461316153413000223040ustar00rootroot00000000000000FROM debian:testing # We know it's going to foul up, so we run this install separately and then ...fix... dpkg status RUN apt-get update && apt-get install -y uhd-host || \ sed -i "s/Status: install ok half-configured/Status: install ok installed/g" /var/lib/dpkg/status RUN apt-get install -y \ git \ vim \ cmake \ autoconf \ libtool \ build-essential \ python-docutils \ libboost-all-dev \ libcppunit-dev swig \ doxygen \ liblog4cpp5-dev \ python-scipy \ gnuradio \ gnuradio-dev \ gr-osmosdr \ libosmogsm5 COPY ./ /src/ RUN ls /src RUN mkdir /src/build && \ cd /src/build && \ cmake .. && \ make && \ make test && \ make install && \ ldconfig gr-gsm-0.41.2/tests/dockerfiles/Debian_testing.docker000066400000000000000000000007011316153413000225310ustar00rootroot00000000000000FROM debian:testing MAINTAINER Ash Wilson RUN apt-get update && apt-get install -y \ cmake \ autoconf \ libtool \ build-essential \ python-docutils \ libcppunit-dev \ swig \ doxygen \ liblog4cpp5-dev \ python-scipy \ gnuradio-dev \ gr-osmosdr \ libosmocore-dev COPY ./ /src/ RUN ls /src RUN mkdir /src/build WORKDIR /src/build RUN cmake .. && \ make && \ make install && \ ldconfig gr-gsm-0.41.2/tests/dockerfiles/Ubuntu_15_04.docker000066400000000000000000000031711316153413000217100ustar00rootroot00000000000000FROM ubuntu:15.04 MAINTAINER Ash Wilson ENV OSMOSDR_GIT="git://git.osmocom.org/libosmocore.git" ENV OSMOCORE_TAG=0.6.3 # We know it's going to foul up, so we run this install separately and then ...fix... dpkg status RUN apt-get update && apt-get install -y uhd-host || \ sed -i "s/Status: install ok half-configured/Status: install ok installed/g" /var/lib/dpkg/status RUN apt-get update && apt-get install -y \ git \ python \ python-scipy \ cmake \ make \ autoconf \ automake \ cpp-4.9 \ gcc \ g++ \ libstdc++-4.9-dev \ libcppunit-dev \ swig \ swig2.0 \ doxygen \ liblog4cpp5 \ liblog4cpp5-dev \ build-essential \ python-docutils \ libtool \ shtool \ pkg-config \ libpcsclite-dev \ gnuradio \ gnuradio-dev \ gr-osmosdr \ libfftw3-dev \ libusb-1.0-0-dev \ libvolk-dev \ libvolk0.0.0 \ libboost-all-dev \ libgnuradio-osmosdr0.1.3 \ libmirisdr0 \ libosmosdr-dev \ libosmosdr0 \ librtlsdr-dev \ librtlsdr0 \ osmo-sdr \ rtl-sdr \ wget \ python-talloc-dev \ libtalloc2 \ libtalloc-dev \ unzip # Build libosmosdr RUN git clone $OSMOSDR_GIT WORKDIR libosmocore RUN git checkout tags/$OSMOCORE_TAG && \ autoreconf -i && \ ./configure && \ make && \ make install && \ ldconfig -i COPY ./ /src/ RUN mkdir /root/.gnuradio/ RUN echo "[grc]\nlocal_blocks_path=/usr/local/share/gnuradio/grc/blocks" > \ /root/.gnuradio/config.conf RUN mkdir /src/build WORKDIR /src/build RUN cmake .. && \ make && \ make test && \ make install && \ ldconfig gr-gsm-0.41.2/tests/dockerfiles/Ubuntu_16_04.docker000066400000000000000000000006771316153413000217210ustar00rootroot00000000000000FROM ubuntu:16.04 MAINTAINER Ash Wilson RUN apt-get update && apt-get install -y \ cmake \ autoconf \ libtool \ build-essential \ python-docutils \ libcppunit-dev \ swig \ doxygen \ liblog4cpp5-dev \ python-scipy \ gnuradio-dev \ gr-osmosdr \ libosmocore-dev COPY ./ /src/ RUN ls /src RUN mkdir /src/build WORKDIR /src/build RUN cmake .. && \ make && \ make install && \ ldconfig gr-gsm-0.41.2/tests/dockerfiles/Ubuntu_16_04_debbuild.docker000066400000000000000000000006541316153413000235460ustar00rootroot00000000000000FROM ubuntu:16.04 MAINTAINER Ash Wilson RUN apt-get update && apt-get install -y \ cmake \ autoconf \ libtool \ build-essential \ libcppunit-dev \ swig \ doxygen \ liblog4cpp5-dev \ python-scipy \ gnuradio-dev \ gr-osmosdr \ libosmocore-dev COPY ./ /src/ RUN ls /src RUN mkdir /src/build WORKDIR /src/build RUN cmake .. && \ make package && \ cpack -G DEB && \ ls gr-gsm-0.41.2/tests/dockerfiles/Ubuntu_16_04_debinstall.docker000066400000000000000000000003651316153413000241140ustar00rootroot00000000000000FROM ubuntu:16.04 MAINTAINER Ash Wilson RUN apt-get update && apt-get install -y \ software-properties-common RUN add-apt-repository -y ppa:ptrkrysik/gr-gsm RUN apt-get update && apt-get install -y \ gr-gsm COPY ./ /src/ RUN ls /src gr-gsm-0.41.2/tests/fixtures/000077500000000000000000000000001316153413000160025ustar00rootroot00000000000000gr-gsm-0.41.2/tests/fixtures/grgsm_decode_test1_expected000066400000000000000000000077121316153413000233570ustar00rootroot00000000000000860933 1329237: 59 06 1a 8f 6d 18 10 80 00 00 00 00 00 00 00 00 00 00 00 78 b9 00 00 860937 1329369: 05 06 20 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 860943 1329541: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 860947 1329673: 25 06 21 20 05 f4 01 4f af 9a 81 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 860953 1329871: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 860957 1330003: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 860963 1330201: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 860967 1330307: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 860973 1330505: 25 06 21 20 05 f4 01 5c ff 9b 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 860977 1330637: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 860984 1329236: 49 06 1b 2b d9 62 f2 20 01 3e c8 07 0a 15 60 09 b9 00 00 e8 1f 46 1b 860988 1329368: 05 06 20 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 860994 1329540: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 860998 1329672: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 861004 1329870: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 861008 1330002: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 861014 1330200: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 861018 1330306: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 861024 1330504: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 861028 1330636: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 861035 1329235: 31 06 1c 62 f2 20 01 3e 60 09 b9 00 00 e8 1f 73 2b 2b 2b 2b 2b 2b 2b 861039 1329367: 05 06 20 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 861045 1329539: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 861049 1329671: 25 06 21 20 05 f4 01 5c e5 e7 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 861055 1329869: 25 06 21 20 05 f4 01 5c 54 02 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 861059 1330001: 25 06 21 20 05 f4 01 5b 98 57 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 861065 1330199: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 861069 1330305: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 861075 1330503: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 861079 1330635: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 861086 1329234: 01 06 00 c0 00 58 47 eb 4a 92 43 40 62 84 eb 2b 2b 2b 2b 2b 2b 2b 2b 861090 1329366: 05 06 20 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 861096 1329538: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 861100 1329670: 25 06 21 20 05 f4 01 5c ff d1 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 861106 1329868: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 861110 1330000: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 861116 1330198: 25 06 21 20 05 f4 01 59 e8 c2 81 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 861120 1330304: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 861126 1330502: 25 06 21 20 05 f4 01 59 42 cb 81 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 861130 1330634: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 861137 1329233: 01 06 03 60 00 00 00 00 00 04 15 50 10 00 00 00 00 0a a8 2b 2b 2b 2b 861141 1329365: 05 06 07 20 00 46 24 40 00 03 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 861147 1329537: 25 06 21 20 05 f4 01 52 80 26 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 861151 1329669: 25 06 21 20 05 f4 ec 03 a9 72 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 861157 1329867: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 861161 1329999: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 861167 1330197: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b gr-gsm-0.41.2/tests/scripts/000077500000000000000000000000001316153413000156205ustar00rootroot00000000000000gr-gsm-0.41.2/tests/scripts/decode.sh000077500000000000000000000015621316153413000174060ustar00rootroot00000000000000#!/bin/bash TEST_DIR=`dirname "$0"` export AP_DECODE="grgsm_decode" export CAPFILE="../../test_data/vf_call6_a725_d174_g5_Kc1EF00BAB3BAC7002.cfile" export SHORTENED_CAPFILE="tmp.cfile" export RESULT_EXPECTED="../fixtures/grgsm_decode_test1_expected" export RESULT_OBTAINED="grgsm_decode_test1_result" export RUNLINE="$AP_DECODE -c $SHORTENED_CAPFILE -s $((100000000/174)) -m BCCH -t 0 -v --ppm -10" echo "Testing with:" echo " $RUNLINE" gnuradio-companion --version cd $TEST_DIR cat $CAPFILE | head -c 6000000 > $SHORTENED_CAPFILE $RUNLINE | grep -A 999999 "860933 1329237: 59 06 1a 8f 6d 18 10 80 00 00 00 00 00 00 00 00 00 00 00 78 b9 00 00" | tee $RESULT_OBTAINED diff $RESULT_EXPECTED $RESULT_OBTAINED TEST_RESULT=$? rm $RESULT_OBTAINED rm $SHORTENED_CAPFILE if [ $TEST_RESULT == 0 ] then echo " Result: PASSED" exit 0 else echo " Result: FAILED" exit 1 fi gr-gsm-0.41.2/tests/scripts/scanner.sh000077500000000000000000000022531316153413000176120ustar00rootroot00000000000000#!/bin/bash # This script runs integration tests for grgsm_scanner. # Run it fron the enclosing directory. export TEST_IMAGE_NAMES=() export TEST_SCAN_BANDS=(P-GSM DCS1800 PCS1900 E-GSM R-GSM GSM450 GSM480 GSM850) export TEMP_DIR=`mktemp -d` cd ../../ export GR_SRC_DIR=`echo $PWD` echo "Using source dir: $GR_SRC_DIR" echo "Using destination dir: $TEMP_DIR" cp -R $GR_SRC_DIR $TEMP_DIR cd $TEMP_DIR/gr-gsm export DOCKERFILE_LIST=($TEMP_DIR/gr-gsm/tests/dockerfiles/*.docker) for DOCKERFILE in ${DOCKERFILE_LIST[*]} do cat $DOCKERFILE > Dockerfile export IMAGE_BASE=`echo $DOCKERFILE | \ sed -e "s|$TEMP_DIR/gr-gsm/dockerfiles/||g" | \ sed -e 's/\.docker//g'` export IMAGE_NAME=`echo $IMAGE_BASE | tr '[:upper:]' '[:lower:]'` echo "Attempt to build $IMAGE_NAME" docker build -t $IMAGE_NAME ./ && TEST_IMAGE_NAMES+=($IMAGE_NAME) done for BAND in ${TEST_SCAN_BANDS[*]} do export SCAN_COMMAND="/usr/bin/python /usr/local/bin/grgsm_scanner -b `echo $BAND` -v" for IMG in ${TEST_IMAGE_NAMES[*]} do echo "Now we test: $SCAN_COMMAND on $IMG" docker run -it --rm --privileged $IMG `echo $SCAN_COMMAND` done done cd $GR_SRC_DIR/build_test/scripts && rm -rf $TEMP_DIR