././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1593252894.9134328 sireader-1.1.3/0000775000000000000000000000000000000000000013253 5ustar00rootroot00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1409519626.0 sireader-1.1.3/COPYING0000644000000000000000000010437400000000000014315 0ustar00rootroot00000000000000 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 . ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1409602902.0 sireader-1.1.3/MANIFEST.in0000664000000000000000000000002000000000000015001 0ustar00rootroot00000000000000include COPYING ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1593252894.9134328 sireader-1.1.3/PKG-INFO0000664000000000000000000001033700000000000014354 0ustar00rootroot00000000000000Metadata-Version: 1.1 Name: sireader Version: 1.1.3 Summary: Python module to communicate with SportIdent main stations Home-page: http://bosco.durcheinandertal.ch/ Author: Gaudenz Steinlin Author-email: gaudenz@durcheinandertal.ch License: GPLv3+ Description: SportIdent Reader ================= Sireader is a python module to communicate with a SportIdent main station to read out SportIdent cards. SportIdent is an electronic punching system mainly used for orienteering events. Sireader supports two major operation modes. It can be used for complete card readout or in control station mode to send punches from a control. The first mode is typically used for card readout after the finish line to read the card data into an event software. The second mode is used to get live result from an intermediate control. Website: http://bosco.durcheinandertal.ch/ GIT Repository: https://github.com/gaudenz/sireader/ Usage ----- There are 3 classes in the sireader module. **SIReader** is the base class containing common functions. It's imported to have easy access to it's constants. **SIReaderReadout** implements classical card readout. **SIReaderControl** implements a station configured as control which continuously sends punches. First import the relevant classes:: from sireader import SIReader, SIReaderReadout, SIReaderControl SIReader only supports the so called "Extended Protocol" mode. If your base station is not in this mode you have to change the protocol mode first:: # change to extended protocol mode si.set_extended_protocol() To use a SportIdent base station for card readout:: from time import sleep # connect to base station, the station is automatically detected, # if this does not work, give the path to the port as an argument # see the pyserial documentation for further information. si = SIReaderReadout() # wait for a card to be inserted into the reader while not si.poll_sicard(): sleep(1) # some properties are now set card_number = si.sicard card_type = si.cardtype # read out card data card_data = si.read_sicard() # beep si.ack_sicard() To use a base station as a control sending punches:: # configure station si.set_operating_mode(SIReader.M_CONTROL) si.set_station_code(99) si.set_autosend() # connect to station si = SIReaderControl() # poll for new punches punches = si.poll_punch() # reset station configuration si.set_operating_mode(SIReader.M_READOUT) si.set_autosend(False) Finally set the station back to basic protocol:: # change back to basic protocl si.set_extended_protocol(False) API Documentation ----------------- Complete documentation is contained in the module source code and can be read online at: http://bosco.durcheinandertal.ch/epydoc-sireader/ This documentation is autogenerated from the source code and represents the version in the GIT repository. Keywords: sportident orienteering bosco Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: Topic :: System :: Hardware :: Hardware Drivers Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+) Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.2 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1494449086.0 sireader-1.1.3/README.rst0000664000000000000000000000512600000000000014746 0ustar00rootroot00000000000000 SportIdent Reader ================= Sireader is a python module to communicate with a SportIdent main station to read out SportIdent cards. SportIdent is an electronic punching system mainly used for orienteering events. Sireader supports two major operation modes. It can be used for complete card readout or in control station mode to send punches from a control. The first mode is typically used for card readout after the finish line to read the card data into an event software. The second mode is used to get live result from an intermediate control. Website: http://bosco.durcheinandertal.ch/ GIT Repository: https://github.com/gaudenz/sireader/ Usage ----- There are 3 classes in the sireader module. **SIReader** is the base class containing common functions. It's imported to have easy access to it's constants. **SIReaderReadout** implements classical card readout. **SIReaderControl** implements a station configured as control which continuously sends punches. First import the relevant classes:: from sireader import SIReader, SIReaderReadout, SIReaderControl SIReader only supports the so called "Extended Protocol" mode. If your base station is not in this mode you have to change the protocol mode first:: # change to extended protocol mode si.set_extended_protocol() To use a SportIdent base station for card readout:: from time import sleep # connect to base station, the station is automatically detected, # if this does not work, give the path to the port as an argument # see the pyserial documentation for further information. si = SIReaderReadout() # wait for a card to be inserted into the reader while not si.poll_sicard(): sleep(1) # some properties are now set card_number = si.sicard card_type = si.cardtype # read out card data card_data = si.read_sicard() # beep si.ack_sicard() To use a base station as a control sending punches:: # configure station si.set_operating_mode(SIReader.M_CONTROL) si.set_station_code(99) si.set_autosend() # connect to station si = SIReaderControl() # poll for new punches punches = si.poll_punch() # reset station configuration si.set_operating_mode(SIReader.M_READOUT) si.set_autosend(False) Finally set the station back to basic protocol:: # change back to basic protocl si.set_extended_protocol(False) API Documentation ----------------- Complete documentation is contained in the module source code and can be read online at: http://bosco.durcheinandertal.ch/epydoc-sireader/ This documentation is autogenerated from the source code and represents the version in the GIT repository. ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1593252894.9134328 sireader-1.1.3/setup.cfg0000664000000000000000000000016600000000000015077 0ustar00rootroot00000000000000[bdist_wheel] universal = 1 [sdist] formats = gztar owner = root group = root [egg_info] tag_build = tag_date = 0 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1593252863.0 sireader-1.1.3/setup.py0000664000000000000000000000427700000000000014777 0ustar00rootroot00000000000000from setuptools import setup from codecs import open # To use a consistent encoding from os import path here = path.abspath(path.dirname(__file__)) # Get the long description from the relevant file with open(path.join(here, 'README.rst'), encoding='utf-8') as f: long_description = f.read() setup( name='sireader', version='1.1.3', description='Python module to communicate with SportIdent main stations', long_description=long_description, url='http://bosco.durcheinandertal.ch/', # Author details author='Gaudenz Steinlin', author_email='gaudenz@durcheinandertal.ch', # Choose your license license='GPLv3+', # See https://pypi.python.org/pypi?%3Aaction=list_classifiers classifiers=[ # How mature is this project? Common values are 'Development Status :: 5 - Production/Stable', # Indicate who your project is intended for 'Intended Audience :: Developers', 'Topic :: System :: Hardware :: Hardware Drivers', # Pick your license as you wish (should match "license" above) 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)', # Specify the Python versions you support here. In particular, ensure # that you indicate whether you support Python 2, Python 3 or both. 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', ], # What does your project relate to? keywords='sportident orienteering bosco', # You can just specify the packages manually here if your project is # simple. Or you can use find_packages(). py_modules=['sireader'], # List run-time dependencies here. These will be installed by pip when your # project is installed. For an analysis of "install_requires" vs pip's # requirements files see: # https://packaging.python.org/en/latest/technical.html#install-requires-vs-requirements-files install_requires=['pyserial', 'six'], ) ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1593252894.9134328 sireader-1.1.3/sireader.egg-info/0000775000000000000000000000000000000000000016543 5ustar00rootroot00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1593252894.0 sireader-1.1.3/sireader.egg-info/PKG-INFO0000664000000000000000000001033700000000000017644 0ustar00rootroot00000000000000Metadata-Version: 1.1 Name: sireader Version: 1.1.3 Summary: Python module to communicate with SportIdent main stations Home-page: http://bosco.durcheinandertal.ch/ Author: Gaudenz Steinlin Author-email: gaudenz@durcheinandertal.ch License: GPLv3+ Description: SportIdent Reader ================= Sireader is a python module to communicate with a SportIdent main station to read out SportIdent cards. SportIdent is an electronic punching system mainly used for orienteering events. Sireader supports two major operation modes. It can be used for complete card readout or in control station mode to send punches from a control. The first mode is typically used for card readout after the finish line to read the card data into an event software. The second mode is used to get live result from an intermediate control. Website: http://bosco.durcheinandertal.ch/ GIT Repository: https://github.com/gaudenz/sireader/ Usage ----- There are 3 classes in the sireader module. **SIReader** is the base class containing common functions. It's imported to have easy access to it's constants. **SIReaderReadout** implements classical card readout. **SIReaderControl** implements a station configured as control which continuously sends punches. First import the relevant classes:: from sireader import SIReader, SIReaderReadout, SIReaderControl SIReader only supports the so called "Extended Protocol" mode. If your base station is not in this mode you have to change the protocol mode first:: # change to extended protocol mode si.set_extended_protocol() To use a SportIdent base station for card readout:: from time import sleep # connect to base station, the station is automatically detected, # if this does not work, give the path to the port as an argument # see the pyserial documentation for further information. si = SIReaderReadout() # wait for a card to be inserted into the reader while not si.poll_sicard(): sleep(1) # some properties are now set card_number = si.sicard card_type = si.cardtype # read out card data card_data = si.read_sicard() # beep si.ack_sicard() To use a base station as a control sending punches:: # configure station si.set_operating_mode(SIReader.M_CONTROL) si.set_station_code(99) si.set_autosend() # connect to station si = SIReaderControl() # poll for new punches punches = si.poll_punch() # reset station configuration si.set_operating_mode(SIReader.M_READOUT) si.set_autosend(False) Finally set the station back to basic protocol:: # change back to basic protocl si.set_extended_protocol(False) API Documentation ----------------- Complete documentation is contained in the module source code and can be read online at: http://bosco.durcheinandertal.ch/epydoc-sireader/ This documentation is autogenerated from the source code and represents the version in the GIT repository. Keywords: sportident orienteering bosco Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: Topic :: System :: Hardware :: Hardware Drivers Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+) Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.2 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1593252894.0 sireader-1.1.3/sireader.egg-info/SOURCES.txt0000664000000000000000000000033400000000000020427 0ustar00rootroot00000000000000COPYING MANIFEST.in README.rst setup.cfg setup.py sireader.py sireader.egg-info/PKG-INFO sireader.egg-info/SOURCES.txt sireader.egg-info/dependency_links.txt sireader.egg-info/requires.txt sireader.egg-info/top_level.txt././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1593252894.0 sireader-1.1.3/sireader.egg-info/dependency_links.txt0000664000000000000000000000000100000000000022611 0ustar00rootroot00000000000000 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1593252894.0 sireader-1.1.3/sireader.egg-info/requires.txt0000664000000000000000000000001500000000000021137 0ustar00rootroot00000000000000pyserial six ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1593252894.0 sireader-1.1.3/sireader.egg-info/top_level.txt0000664000000000000000000000001100000000000021265 0ustar00rootroot00000000000000sireader ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1593250705.0 sireader-1.1.3/sireader.py0000664000000000000000000013350600000000000015433 0ustar00rootroot00000000000000#/usr/bin/env python # # Copyright (C) 2008-2014 Gaudenz Steinlin # 2014 Simon Harston # # 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 . """ sireader.py - Classes to read out si card data from BSM-7/8 stations. """ from __future__ import print_function from six import int2byte, byte2int, iterbytes, PY3 if PY3: # Make byte2int on Python 3.x compatible with # the fact that indexing into a byte variable # already returns an integer. With this byte2int(b[0]) # works on 2.x and 3.x def byte2int(x): try: return x[0] except TypeError: return x from serial import Serial from serial.serialutil import SerialException from datetime import datetime, timedelta, time from binascii import hexlify import os, re class SIReader(object): """Base protocol functions and constants to interact with SI Stations. This class has a lot of Constants defined that are not (yet) used. This is mainly for documentation purpose as most of this is not documented by SportIdent.""" CRC_POLYNOM = 0x8005 CRC_BITF = 0x8000 # Protocol characters STX = b'\x02' ETX = b'\x03' ACK = b'\x06' # when sent to BSx3..6 with a card inserted, causes beep until SI-card taken out NAK = b'\x15' DLE = b'\x10' WAKEUP = b'\xFF' # Basic protocol commands, currently unused BC_SET_CARDNO = b'\x30' BC_GET_SI5 = b'\x31' # read out SI-card 5 data BC_TRANS_REC = b'\x33' # autosend timestamp (online control) in very old stations (BSF3) BC_SI5_WRITE = b'\x43' # write SI-card 5 data page: 02 43 (page: 0x30 to 0x37) (16 bytes) 03 BC_SI5_DET = b'\x46' # SI-card 5 inserted (46 49) or removed (46 4F) BC_TRANS_REC2 = b'\x53' # autosend timestamp (online control) BC_TRANS_TIME = b'\x54' # autosend timestamp (lightbeam trigger) BC_GET_SI6 = b'\x61' # read out SI-card 6 data (and in compatibility mode: model SI-card 8/9/10/11/SIAC/pCard/tCard as SI-card 6) BC_SI6_WRITEPAGE = b'\x62'# write SI-card 6 data page: 02 62 (block: 0x00 to 0x07) (page: 0x00 to 0x07) (16 bytes) 03 BC_SI6_READWORD = b'\x63'# read SI-card 6 data word: 02 63 (block: 0x00 to 0x07) (page: 0x00 to 0x07) (word: 0x00 to 0x03) 03 BC_SI6_WRITEWORD = b'\x64'# write SI-card 6 data word: 02 64 (block: 0x00 to 0x07) (page: 0x00 to 0x07) (word: 0x00 to 0x03) (4 bytes) 03 BC_SI6_DET = b'\x66' # SI-card 6 inserted BC_SET_MS = b'\x70' # \x4D="M"aster, \x53="S"lave BC_GET_MS = b'\x71' BC_SET_SYS_VAL = b'\x72' BC_GET_SYS_VAL = b'\x73' BC_GET_BACKUP = b'\x74' # Note: response carries b'\xC4'! BC_ERASE_BACKUP = b'\x75' BC_SET_TIME = b'\x76' BC_GET_TIME = b'\x77' BC_OFF = b'\x78' BC_RESET = b'\x79' BC_GET_BACKUP2 = b'\x7A' # (for extended start and extended finish only) Note: response carries b'\xCA'! BC_SET_BAUD = b'\x7E' # \x00=4800 baud, \x01=38400 baud # Extended protocol commands C_GET_BACKUP = b'\x81' C_SET_SYS_VAL = b'\x82' C_GET_SYS_VAL = b'\x83' C_SRR_WRITE = b'\xA2' # ShortRangeRadio - SysData write C_SRR_READ = b'\xA3' # ShortRangeRadio - SysData read C_SRR_QUERY = b'\xA6' # ShortRangeRadio - network device query C_SRR_PING = b'\xA7' # ShortRangeRadio - heartbeat from linked devices, every 50 seconds C_SRR_ADHOC = b'\xA8' # ShortRangeRadio - ad-hoc message, f.ex. from SI-ActiveCard C_GET_SI5 = b'\xB1' # read out SI-card 5 data C_SI5_WRITE = b'\xC3' # write SI-card 5 data page: 02 C3 11 (page: 0x00 to 0x07) (16 bytes) (CRC) 03 C_TRANS_REC = b'\xD3' # autosend timestamp (online control) C_CLEAR_CARD = b'\xE0' # found on SI-dev-forum: 02 E0 00 E0 00 03 (http://www.sportident.com/index.php?option=com_kunena&view=topic&catid=8&id=56#59) C_GET_SI6 = b'\xE1' # read out SI-card 6 data block C_SI5_DET = b'\xE5' # SI-card 5 inserted C_SI6_DET = b'\xE6' # SI-card 6 inserted C_SI_REM = b'\xE7' # SI-card removed C_SI9_DET = b'\xE8' # SI-card 8/9/10/11/p/t inserted C_SI9_WRITE = b'\xEA' # write data page (double-word) C_GET_SI9 = b'\xEF' # read out SI-card 8/9/10/11/p/t data block C_SET_MS = b'\xF0' # \x4D="M"aster, \x53="S"lave C_GET_MS = b'\xF1' C_ERASE_BACKUP = b'\xF5' C_SET_TIME = b'\xF6' C_GET_TIME = b'\xF7' C_OFF = b'\xF8' C_BEEP = b'\xF9' # 02 F9 01 (number of beeps) (CRC16) 03 C_SET_BAUD = b'\xFE' # \x00=4800 baud, \x01=38400 baud # Protocol Parameters P_MS_DIRECT = b'\x4D' # "M"aster P_MS_INDIRECT = b'\x53' # "S"lave P_SI6_CB = b'\x08' # CardBlocks (see also O_SI6_CB) # offsets in system data # Thanks to Simon Harston for most of this information # currently only O_MODE, O_STATION_CODE and O_PROTO are used O_OLD_SERIAL = b'\x00' # 2 bytes - only up to BSx6, numbers < 65.536 O_OLD_CPU_ID = b'\x02' # 2 bytes - only up to BSx6, numbers < 65.536 O_SERIAL_NO = b'\x00' # 4 bytes - only after BSx7, numbers > 70.000 # (if byte 0x00 > 0, better use OLD offsets) O_SRR_CFG = b'\x04' # 1 byte - SRR-dongle configuration, bit mask value: # xxxxxx1xb Auto send SIAC data # xxxxx1xxb Sync time via radio O_FIRMWARE = b'\x05' # 3 bytes O_BUILD_DATE = b'\x08' # 3 bytes - YYMMDD O_MODEL_ID = b'\x0B' # 2 bytes: # 6F21: SIMSRR1-AP (ShortRangeRadio AccessPoint = SRR-dongle) # 8003: BSF3 (serial numbers > 1.000) # 8004: BSF4 (serial numbers > 10.000) # 8084: BSM4-RS232 # 8086: BSM6-RS232 / BSM6-USB # 8115: BSF5 (serial numbers > 50.000) # 8117 / 8118: BSF7 / BSF8 (serial no. 70.000...70.521, 72.002...72.009) # 8146: BSF6 (serial numbers > 30.000) # 8187 / 8188: BS7-SI-Master / BS8-SI-Master # 8197: BSF7 (serial numbers > 71.000, apart from 72.002...72.009) # 8198: BSF8 (serial numbers > 80.000) # 9197 / 9198: BSM7-RS232, BSM7-USB / BSM8-USB, BSM8-SRR # 9199: unknown # 9597: BS7-S (Sprinter) # 9D9A: BS11-BL (SIAC / Air+) # B197 / B198: BS7-P / BS8-P (Printer) # B897: BS7-GSM # CD9B: BS11-BS-red / BS11-BS-blue (SIAC / Air+) O_MEM_SIZE = b'\x0D' # 1 byte - in KB O_BAT_DATE = b'\x15' # 3 bytes - YYMMDD O_BAT_CAP = b'\x19' # 2 bytes - battery capacity in mAh (as multiples of 14.0625?!) O_BACKUP_PTR = b'\x1C' # 4 bytes - at positions 1C,1D,21,22 O_SI6_CB = b'\x33' # 1 byte - bitfield defining which SI Card 6 blocks to read: # \x00=\xC1=read block0,6,7; \x08=\xFF=read all 8 blocks O_SRR_CHANNEL = b'\x34' # 1 byte - SRR-dongle frequency band: 0x00="red", 0x01="blue" O_MEM_OVERFLOW = b'\x3D' # 1 byte - memory overflow if != 0x00 O_PROGRAM = b'\x70' # 1 byte - station program: xx0xxxxxb competition, xx1xxxxxb training O_MODE = b'\x71' # 1 byte - see SI station modes below O_STATION_CODE = b'\x72' # 1 byte O_FEEDBACK = b'\x73' # 1 byte - feedback on punch (and other unknown bits), bit mask value: # xxxxxxx1b optical feedback # xxxxx1xxb audible feedback O_PROTO = b'\x74' # 1 byte - protocol configuration, bit mask value: # xxxxxxx1b extended protocol # xxxxxx1xb auto send out # xxxxx1xxb handshake (only valid for card readout) # xxx1xxxxb access with password only # 1xxxxxxxb read out SI-card after punch (only for punch modes; # depends on bit 2: auto send out or handshake) O_WAKEUP_DATE = b'\x75' # 3 bytes - YYMMDD O_WAKEUP_TIME = b'\x78' # 3 bytes - 1 byte day (see below), 2 bytes seconds after midnight/midday O_SLEEP_TIME = b'\x7B' # 3 bytes - 1 byte day (see below), 2 bytes seconds after midnight/midday # xxxxxxx0b - seconds relative to midnight/midday: 0 = am, 1 = pm # xxxx000xb - day of week: 000 = Sunday, 110 = Saturday # xx00xxxxb - week counter 0..3, relative to programming date # SI station modes M_SIAC_SPECIAL = 0x01 # SI Air+ special register set (ON, OFF, Radio_ReadOut, etc.) M_CONTROL = 0x02 M_START = 0x03 M_FINISH = 0x04 M_READOUT = 0x05 M_CLEAR_OLD = 0x06 # without start-number (not used anymore) M_CLEAR = 0x07 # with start-number = standard M_CHECK = 0x0A M_PRINTOUT = 0x0B # BS7-P Printer-station (Note: also used by SRR-Receiver-module) M_START_TRIG = 0x0C # BS7-S (Sprinter) with external trigger M_FINISH_TRIG = 0x0D # BS7-S (Sprinter) with external trigger M_BC_CONTROL = 0x12 # SI Air+ / SIAC Beacon mode M_BC_START = 0x13 # SI Air+ / SIAC Beacon mode M_BC_FINISH = 0x14 # SI Air+ / SIAC Beacon mode M_BC_READOUT = 0x15 # SI Air+ / SIAC Beacon mode SUPPORTED_MODES = (M_CONTROL, M_START, M_FINISH, M_READOUT, M_CLEAR, M_CHECK) # Weekday encoding (only for reference, currently unused) D_SUNDAY = 0b000 D_MONDAY = 0b001 D_TUESDAY = 0b010 D_WEDNESDAY = 0b011 D_THURSDAY = 0b100 D_FRIDAY = 0b101 D_SATURDAY = 0b110 D_UNKNOWN = 0b111 # in D3-message from SIAC-beacon where no weekday-info is transmitted # Backup memory record length REC_LEN = 8 # Only in extended protocol, otherwise 6! # General card data structure values TIME_RESET = b'\xEE\xEE' # SI Card data structures CARD = {'SI5':{'CN2': 6, # card number byte 2 'CN1': 4, # card number byte 1 'CN0': 5, # card number byte 0 'STD': None,# start time day 'ST' : 19, # start time 'FTD': None,# finish time day 'FT' : 21, # finish time 'CTD': None,# check time day 'CT' : 25, # check time 'LTD': None,# clear time day 'LT' : None,# clear time 'RC' : 23, # punch counter 'P1' : 32, # first punch 'PL' : 3, # punch data length in bytes 'PM' : 30, # punch maximum (punches 31-36 have no time) 'CN' : 0, # control number offset in punch record 'PTD': None,# punchtime day byte offset in punch record 'PTH': 1, # punchtime high byte offset in punch record 'PTL': 2, # punchtime low byte offset in punch record }, 'SI6':{'CN2': 11, 'CN1': 12, 'CN0': 13, 'STD': 24, 'ST' : 26, 'FTD': 20, 'FT' : 22, 'CTD': 28, 'CT' : 30, 'LTD': 32, 'LT' : 34, 'RC' : 18, 'P1' : 128, 'PL' : 4, 'PM' : 64, 'PTD': 0, # Day of week byte, SI6 and newer 'CN' : 1, 'PTH': 2, 'PTL': 3, }, 'SI8':{'CN2': 25, 'CN1': 26, 'CN0': 27, 'STD': 12, 'ST' : 14, 'FTD': 16, 'FT' : 18, 'CTD': 8, 'CT' : 10, 'LTD': None, 'LT' : None, 'RC' : 22, 'P1' : 136, 'PL' : 4, 'PM' : 50, 'PTD': 0, 'CN' : 1, 'PTH': 2, 'PTL': 3, 'BC' : 2, # number of blocks on card (only relevant for SI8 and above = those read with C_GET_SI9) }, 'SI9':{'CN2': 25, 'CN1': 26, 'CN0': 27, 'STD': 12, 'ST' : 14, 'FTD': 16, 'FT' : 18, 'CTD': 8, 'CT' : 10, 'LTD': None, 'LT' : None, 'RC' : 22, 'P1' : 56, 'PL' : 4, 'PM' : 50, 'PTD': 0, # Day of week byte, SI6 and newer 'CN' : 1, 'PTH': 2, 'PTL': 3, 'BC' : 2, }, 'SI10':{'CN2': 25, # Same data structure for SI11 'CN1': 26, 'CN0': 27, 'STD': 12, 'ST' : 14, 'FTD': 16, 'FT' : 18, 'CTD': 8, 'CT' : 10, 'LTD': None, 'LT' : None, 'RC' : 22, 'P1' : 128, # would be 512 if all blocks were read, but blocks 1-3 are skipped on readout 'PL' : 4, 'PM' : 64, 'PTD': 0, # Day of week byte, SI6 and newer 'CN' : 1, 'PTH': 2, 'PTL': 3, 'BC' : 8, }, } # punch trigger in control mode data structure T_OFFSET = 8 T_CN = 0 T_TIME = 5 # backup memory in control mode BC_CN = 3 BC_TIME = 8 def __init__(self, port = None, debug = False, logfile = None): """Initializes communication with si station at port. @param port: Serial device for the connection if port is None it scans all available ports and connects to the first reader found """ self._serial = None self._debug = debug self._proto_config = None if logfile is not None: self._logfile = open(logfile, 'ab') else: self._logfile = None errors = '' if port is not None: self._connect_reader(port) return else: scan_ports = [ os.path.join('/dev', f) for f in os.listdir('/dev') if re.match('ttyS.*|ttyUSB.*', f) ] if len(scan_ports) == 0: errors = 'no serial ports found' for port in scan_ports: try: self._connect_reader(port) return except (SIReaderException, SIReaderTimeout) as msg: errors = '%sport: %s: %s\n' % (errors, port, msg) pass raise SIReaderException('No SI Reader found. Possible reasons: %s' % errors) def set_extended_protocol(self, extended = True): """Configure extended protocol mode of si station. @param extended: Set exetended protocol if True, basic protocol if False. """ config = self.proto_config.copy() config['ext_proto'] = extended self._set_proto_config(config) self.beep() def set_autosend(self, autosend = True): """Set si station into autosend mode. @param autosend: Set autosend mode if True, unset otherwise. """ config = self.proto_config.copy() config['auto_send'] = autosend config['handshake'] = not autosend self._set_proto_config(config) self.beep() def set_operating_mode(self, mode): """Set si station operating mode. @param mode: operating mode, supported modes: M_CONTROL, M_START, M_FINISH, M_READOUT, M_CLEAR, M_CHECK """ if not mode in SIReader.SUPPORTED_MODES: raise SIReaderException("Unsupported mode '%i'!" % mode) try: self._send_command(SIReader.C_SET_SYS_VAL, SIReader.O_MODE + int2byte(mode)) finally: self._update_proto_config() self.beep() def set_station_code(self, code): """Set si station control code. @param code: control code (1-1023) """ if code < 1 or code > 1023: raise SIReaderException("Invalid control code: '%i'! Supported code range: 1-1023." % code) # lower byte of control code code_low = int2byte(code & 0xFF) # high byte of control code, only first 2 bits are used, the rest is set to 1 code_high = int2byte((code >> 2) | 0b00111111) try: self._send_command(SIReader.C_SET_SYS_VAL, SIReader.O_STATION_CODE + code_low + code_high) finally: self._update_proto_config() self.beep() def get_time(self): """Read out stations internal time. @return: datetime """ bintime = self._send_command(SIReader.C_GET_TIME, b'')[1] year = byte2int(bintime[0]) month = byte2int(bintime[1]) day = byte2int(bintime[2]) am_pm = byte2int(bintime[3]) & 0b1 second = SIReader._to_int(bintime[4:6]) hour = am_pm * 12 + second // 3600 second %= 3600 minute = second // 60 second %= 60 ms = int(round(byte2int(bintime[6]) / 256.0 * 1000000)) self.beep() try: return datetime(year, month, day, hour, minute, second, ms) except ValueError: # return None if the time reported by the station is impossible return None def set_time(self, time): """Set si station internal time. @param time: time as a python datetime object. """ bintime = (SIReader._to_str(int(time.strftime('%y')), 1) + SIReader._to_str(time.month, 1) + SIReader._to_str(time.day, 1) + SIReader._to_str(((time.isoweekday() % 7) << 1) + time.hour//12, 1) + SIReader._to_str((time.hour % 12)*3600 + time.minute*60 + time.second, 2) + SIReader._to_str(int(round(time.microsecond / 1000000.0 * 256)), 1) ) self._send_command(SIReader.C_SET_TIME, bintime) self.beep() def beep(self, count = 1): """Beep and blink control station. This even works if now sicard is inserted into the station. @param count: Count of beeps """ self._send_command(SIReader.C_BEEP, int2byte(count)) def poweroff(self): """Switch off the control station and disconnect.""" self._send_command(SIReader.C_OFF, b'') self.disconnect() def disconnect(self): """Close the serial port an disconnect from the station.""" self._serial.close() def reconnect(self): """Close the serial port and reopen again.""" self.disconnect() self._connect_reader(self._serial.port) def _connect_reader(self, port): """Connect to SI Reader. @param port: serial port """ try: self._serial = Serial(port, baudrate = 38400, timeout = 5) except (SerialException, OSError): raise SIReaderException("Could not open port '%s'" % port) # flush possibly available input try: self._serial.flushInput() except (SerialException, OSError): # This happens if the serial port is not ready for # whatever reason (eg. there is no real device behind this device node). raise SIReaderException("Could not flush port '%s'" % port) self.station_code = None try: # try at 38400 baud, extended protocol self._send_command(SIReader.C_SET_MS, SIReader.P_MS_DIRECT) except (SIReaderException, SIReaderTimeout): try: self._serial.baudrate = 4800 except (SerialException, OSError) as msg: raise SIReaderException('Could not set port speed to 4800: %s' % msg) try: self._send_command(SIReader.C_SET_MS, SIReader.P_MS_DIRECT) except SIReaderException as msg: raise SIReaderException('This module only works with BSM7/8 stations: %s' % msg) self.port = port self.baudrate = self._serial.baudrate self._update_proto_config() def _update_proto_config(self): # Read protocol configuration ret = self._send_command(SIReader.C_GET_SYS_VAL, SIReader.O_PROTO+b'\x01') config_byte = byte2int(ret[1][1]) self.proto_config = {} self.proto_config['ext_proto'] = config_byte & (1 << 0) != 0 self.proto_config['auto_send'] = config_byte & (1 << 1) != 0 self.proto_config['handshake'] = config_byte & (1 << 2) != 0 self.proto_config['pw_access'] = config_byte & (1 << 4) != 0 self.proto_config['punch_read'] = config_byte & (1 << 7) != 0 # Read operating mode ret = self._send_command(SIReader.C_GET_SYS_VAL, SIReader.O_MODE+b'\x01') self.proto_config['mode'] = byte2int(ret[1][1]) return self.proto_config def _set_proto_config(self, config): try: config_byte = int2byte((config['ext_proto'] << 0) | (config['auto_send'] << 1) | (config['handshake'] << 2) | (config['pw_access'] << 4) | (config['punch_read'] << 7)) self._send_command(SIReader.C_SET_SYS_VAL, SIReader.O_PROTO + config_byte) finally: self._update_proto_config() def __del__(self): if self._serial is not None: self._serial.close() @staticmethod def _to_int(s): """Computes the integer value of a raw byte string.""" value = 0 for offset, c in enumerate(iterbytes(s[::-1])): value += c << offset*8 return value @staticmethod def _to_str(i, len): """ @param i: Integer to convert into str @param len: Length of the return value. If i does not fit OverflowError is raised. @return: string representation of i (MSB first) """ if PY3: return i.to_bytes(len, 'big') if i >> len*8 != 0: raise OverflowError('%i too big to convert to %i bytes' % (i, len)) string = '' for offset in range(len-1, -1, -1): string += int2byte((i >> offset*8) & 0xFF) return string @staticmethod def _crc(s): """Compute the crc checksum of value. This implementation is a reimplementation of the Java function in the SI Programmers manual examples.""" def twochars(s): """generator that split a string into parts of two chars""" if len(s) == 0: # immediately stop on empty string return # add 0 to the string and make it even length if len(s)%2 == 0: s += b'\x00\x00' else: s += b'\x00' for i in range(0, len(s), 2): yield s[i:i+2] if len(s) < 1: # return value for 1 or no data byte is 0 return b'\x00\x00' crc = SIReader._to_int(s[0:2]) for c in twochars(s[2:]): val = SIReader._to_int(c) for j in range(16): if (crc & SIReader.CRC_BITF) != 0: crc <<= 1 if (val & SIReader.CRC_BITF) != 0: crc += 1 # rotate carry crc ^= SIReader.CRC_POLYNOM else: crc <<= 1 if (val & SIReader.CRC_BITF) != 0: crc += 1 # rotate carry val <<= 1 # truncate to 16 bit and convert to char crc &= 0xFFFF return int2byte(crc >> 8) + int2byte(crc & 0xFF) @staticmethod def _crc_check(s, crc): return SIReader._crc(s) == crc @staticmethod def _decode_cardnr(number): """Decodes a 4 byte cardnr to an int. SI-Card numbering is a bit odd: SI-Card 5: - byte 0: always 0 (not stored on the card) - byte 1: card series (stored on the card as CNS) - byte 2,3: card number - printed: 100'000*CNS + card number - nr range: 1-65'000 + 200'001-265'000 + 300'001-365'000 + 400'001-465'000 SI-Card 6/6*/8/9/10/11/pCard/tCard/fCard/SIAC1: - byte 0: card series (SI6:00, SI9:01, SI8:02, pCard:04, tCard:06, fCard:0E, SI10+SI11+SIAC1:0F) - byte 1-3: card number - printed: only card number - nr range: - SI6: 500'000-999'999 + 2'003'000-2'003'400 (WM2003) + 16'711'680-16'777'215 (SI6*) - SI9: 1'000'000-1'999'999, SI8: 2'000'000-2'999'999 - pCard: 4'000'000-4'999'999, tCard: 6'000'000-6'999'999 - SI10: 7'000'000-7'999'999, SIAC1: 8'000'000-8'999'999 - SI11: 9'000'000-9'999'999, fCard: 14'000'000-14'999'999 The card nr ranges guarantee that no ambigous values are possible (500'000 = 0x07A120 > 0x04FFFF = 465'535 = highest technically possible value on a SI5) """ if number[0:1] != b'\x00': raise SIReaderException('Unknown card series') nr = SIReader._to_int(number[1:4]) if nr < 500000: # SI5 card ret = SIReader._to_int(number[2:4]) if byte2int(number[1]) < 2: # Card series 0 and 1 do not have the 0/1 printed on the card return ret else: return byte2int(number[1])*100000 + ret else: # SI6/8/9 return nr @staticmethod def _decode_time(raw_time, raw_ptd = None, reftime = None): """Decodes a raw time value read from an si card into a datetime object. The returned time is the nearest time matching the data before reftime.""" if raw_time == SIReader.TIME_RESET: return None if reftime is None: # add two hours as a safety marging for cases where the # machine time runs a bit behind the stations time. reftime = datetime.now() + timedelta(hours=2) # get 12h punchtime punchtime = timedelta(seconds = SIReader._to_int(raw_time)) # Documentation of the PTD byte from SportIdent # bit 0 - am/pm # bit 3...1 - day of week, 000 = Sunday, 110 = Saturday # bit 5...4 - week counter 0...3, relative # bit 7...6 - control station code number high # (...511) # week counter is not used! if raw_ptd is not None: ptd = byte2int(raw_ptd) # get info about AM(0) or PM(1) # and adjust punchtime in case of PM if (ptd & 0b00000001) == 0b1: punchtime = punchtime + timedelta(hours=12) # extract day of week and convert to Mon = 0, Tue = 1 ... as # datetime.weekday has Mon = 0, Sun = 6 the modulo operation # takes care of underflows (Sun = -1) dow = (((ptd & 0b00001110) >> 1) - 1) % 7 # subtract a whole week if the dow week is the same but the punchtime # is later on the same day if (reftime.weekday() == dow and punchtime > timedelta(hours=reftime.hour, minutes=reftime.minute, seconds=reftime.second)): reftime -= timedelta(days=7) else: # adjust reftime according to weekday information reftime -= timedelta(days=(reftime.weekday()-dow) % 7) ref_day = reftime.replace(hour=0, minute=0, second=0, microsecond=0, tzinfo=None) return ref_day + punchtime # No PTD byte available, we have to rely on guessing the closest 12h time ref_day = reftime.replace(hour=0, minute=0, second=0, microsecond=0, tzinfo=None) ref_hour = reftime - ref_day t_noon = timedelta(hours=12) if ref_hour < t_noon: # reference time is before noon if punchtime < ref_hour: # t is between 00:00 and t_ref return ref_day + punchtime else: # t is afternoon the day before return ref_day - t_noon + punchtime else: # reference is after noon if punchtime < ref_hour - t_noon: # t is between noon and t_ref return ref_day + t_noon + punchtime else: # t is in the late morning return ref_day + punchtime @staticmethod def _append_punch(list, station, timedata, ptd, reftime): time = SIReader._decode_time(timedata, ptd, reftime) if time is not None: list.append((station, time)) @staticmethod def _decode_carddata(data, card_type, reftime = None): """Decodes a data record read from an SI Card.""" ret = {} card = SIReader.CARD[card_type] # the slicing of data is necessary for Python 3 to get a bytes object instead # of an int ret['card_number'] = SIReader._decode_cardnr(b'\x00' + data[card['CN2']:card['CN2']+1] + data[card['CN1']:card['CN1']+1] + data[card['CN0']:card['CN0']+1]) ret['start'] = SIReader._decode_time(data[card['ST']:card['ST']+2], data[card['STD']] if card['STD'] else None, reftime) ret['finish'] = SIReader._decode_time(data[card['FT']:card['FT']+2], data[card['FTD']] if card['FTD'] is not None else None, reftime) ret['check'] = SIReader._decode_time(data[card['CT']:card['CT']+2], data[card['CTD']] if card['CTD'] is not None else None, reftime) if card['LT'] is not None: ret['clear'] = SIReader._decode_time(data[card['LT']:card['LT']+2], data[card['LTD']] if card['LTD'] is not None else None, reftime) else: ret['clear'] = None # SI 5 and 9 cards don't store the clear time punch_count = byte2int(data[card['RC']:card['RC']+1]) if card_type == 'SI5': # RC is the index of the next punch on SI5 punch_count -= 1 if punch_count > card['PM']: punch_count = card['PM'] ret['punches'] = [] p = 0 i = card['P1'] while p < punch_count: if card_type == 'SI5' and i % 16 == 0: # first byte of each block is reserved for punches 31-36 i += 1 ptd = data[i + card['PTD']] if card['PTD'] is not None else None cn = byte2int(data[i + card['CN']]) pt = data[i + card['PTH']:i + card['PTL']+1] SIReader._append_punch(ret['punches'], cn, pt, ptd, reftime) i += card['PL'] p += 1 return ret def _send_command(self, command, parameters): try: if self._serial.inWaiting() != 0: raise SIReaderException('Input buffer must be empty before sending command. Currently %s bytes in the input buffer.' % self._serial.inWaiting()) command_string = command + int2byte(len(parameters)) + parameters crc = SIReader._crc(command_string) cmd = SIReader.STX + command_string + crc + SIReader.ETX if self._debug: print("==>> command '%s', parameters %s, crc %s" % (hexlify(command).decode('ascii'), ' '.join([hexlify(int2byte(c)).decode('ascii') for c in parameters]), hexlify(crc).decode('ascii'), )) self._serial.write(cmd) except (SerialException, OSError) as msg: raise SIReaderException('Could not send command: %s' % msg) if self._logfile: self._logfile.write('s %s %s\n' % (datetime.now(), cmd)) self._logfile.flush() os.fsync(self._logfile) return self._read_command() def _read_command(self, timeout = None): try: if timeout != None: old_timeout = self._serial.timeout self._serial.timeout = timeout char = self._serial.read() if timeout != None: self._serial.timeout = old_timeout if char == b'': raise SIReaderTimeout('No data available') elif char == SIReader.NAK: raise SIReaderException('Invalid command or parameter.') elif char != SIReader.STX: self._serial.flushInput() raise SIReaderException('Invalid start byte %s' % hex(byte2int(char))) # Read command, length, data, crc, ETX cmd = self._serial.read() length = self._serial.read() station = self._serial.read(2) self.station_code = SIReader._to_int(station) data = self._serial.read(byte2int(length)-2) crc = self._serial.read(2) etx = self._serial.read() if self._debug: print("<<== command '%s', len %i, station %s, data %s, crc %s, etx %s" % (hexlify(cmd).decode('ascii'), byte2int(length), hexlify(station).decode('ascii'), ' '.join([hexlify(int2byte(c)).decode('ascii') for c in data]), hexlify(crc).decode('ascii'), hexlify(etx).decode('ascii'), )) if etx != SIReader.ETX: raise SIReaderException('No ETX byte received.') if not SIReader._crc_check(cmd + length + station + data, crc): raise SIReaderException('CRC check failed') if self._logfile: self._logfile.write('r %s %s\n' % (datetime.now(), char + cmd + length + station + data + crc + etx)) self._logfile.flush() os.fsync(self._logfile) except (SerialException, OSError) as msg: raise SIReaderException('Error reading command: %s' % msg) return (cmd, data) class SIReaderReadout(SIReader): """Class for 'classic' SI card readout. Reads out the whole card. If you don't know about other readout modes (control mode) you probably want this class.""" def __init__(self, *args, **kwargs): super(type(self), self).__init__(*args, **kwargs) self.sicard = None self.cardtype = None def poll_sicard(self): """Polls for an SI-Card inserted or removed into the SI Station. Returns true on state changes and false otherwise. If other commands are received an Exception is raised.""" if not self.proto_config['ext_proto']: raise SIReaderException('This command only supports stations in "Extended Protocol" ' 'mode. Switch mode first') if not self.proto_config['mode'] == SIReader.M_READOUT: raise SIReaderException("Station must be in 'Read SI cards' operating mode! Change operating mode first.") if self._serial.inWaiting() == 0: return False oldcard = self.sicard while self._serial.inWaiting() > 0: # _read_command does the actual parsing of the command # if it's an insert or remove event try: self._read_command(timeout = 0) except SIReaderCardChanged: pass return not oldcard == self.sicard def read_sicard(self, reftime=None): """Reads out the SI Card currently inserted into the station. The card must be detected with poll_sicard before.""" if not self.proto_config['ext_proto']: raise SIReaderException('This command only supports stations in "Extended Protocol" ' 'mode. Switch mode first') if not self.proto_config['mode'] == SIReader.M_READOUT: raise SIReaderException("Station must be in 'Read SI cards' operating mode! Change operating mode first.") if self.cardtype == 'SI5': raw_data = self._send_command(SIReader.C_GET_SI5, b'')[1] elif self.cardtype == 'SI6': raw_data = self._send_command(SIReader.C_GET_SI6, SIReader.P_SI6_CB)[1][1:] raw_data += self._read_command()[1][1:] raw_data += self._read_command()[1][1:] elif self.cardtype in ('SI8', 'SI9'): raw_data = b'' for b in range(SIReader.CARD[self.cardtype]['BC']): raw_data += self._send_command(SIReader.C_GET_SI9, int2byte(b))[1][1:] elif self.cardtype == 'SI10': # Reading out SI10 cards block by block proved to be unreliable and slow # Thus reading with C_GET_SI9 and block number 8 = P_SI6_CB like SI6 # cards raw_data = self._send_command(SIReader.C_GET_SI9, SIReader.P_SI6_CB)[1][1:] raw_data += self._read_command()[1][1:] raw_data += self._read_command()[1][1:] raw_data += self._read_command()[1][1:] raw_data += self._read_command()[1][1:] else: raise SIReaderException('No card in the device.') return SIReader._decode_carddata(raw_data, self.cardtype, reftime) def ack_sicard(self): """Sends an ACK signal to the SI Station. After receiving an ACK signal the station blinks and beeps to signal correct card readout.""" try: self._serial.write(SIReader.ACK) except (SerialException, OSError) as msg: raise SIReaderException('Could not send ACK: %s' % msg) def _read_command(self, timeout=None): """Reads commands from the station. As a station in readout mode can send a card inserted or card removed event at any time we have to intercept these events here.""" cmd, data = super(type(self), self)._read_command(timeout) # check if a card was inserted or removed if cmd == SIReader.C_SI_REM: self.sicard = None self.cardtype = None raise SIReaderCardChanged("SI-Card removed during command.") elif cmd == SIReader.C_SI5_DET: self.sicard = self._decode_cardnr(data) self.cardtype = 'SI5' raise SIReaderCardChanged("SI-Card inserted during command.") elif cmd == SIReader.C_SI6_DET: self.sicard = self._to_int(data) self.cardtype = 'SI6' raise SIReaderCardChanged("SI-Card inserted during command.") elif cmd == SIReader.C_SI9_DET: # SI 9 sends corrupt first byte (insignificant) self.sicard = self._to_int(data[1:]) if self.sicard >= 2000000 and self.sicard <= 2999999: self.cardtype = 'SI8' elif self.sicard >= 1000000 and self.sicard <= 1999999: self.cardtype = 'SI9' elif self.sicard >= 7000000 and self.sicard <= 9999999: self.cardtype = 'SI10' else: raise SIReaderException('Unknown cardtype!') raise SIReaderCardChanged("SI-Card inserted during command.") return (cmd, data) class SIReaderControl(SIReader): """Class for reading an SI Station configured as control in autosend mode.""" def __init__(self, *args, **kwargs): super(type(self), self).__init__(*args, **kwargs) self._next_offset = None def poll_punch(self): """Polls for new punches. @return: list of (cardnr, punchtime) tuples, empty list if no new punches are available """ if not self.proto_config['ext_proto']: raise SIReaderException('This command only supports stations in "Extended Protocol" ' 'mode. Switch mode first') if not self.proto_config['auto_send']: raise SIReaderException('This command only supports stations in "Autosend" ' 'mode. Switch mode first') punches = [] while True: try: c = self._read_command(timeout = 0) except SIReaderTimeout: break if c[0] == SIReader.C_TRANS_REC: cur_offset = SIReader._to_int(c[1][SIReader.T_OFFSET:SIReader.T_OFFSET+3]) if self._next_offset is not None: while self._next_offset < cur_offset: # recover lost punches punches.append(self._read_punch(self._next_offset)) self._next_offset += SIReader.REC_LEN self._next_offset = cur_offset + SIReader.REC_LEN punches.append( (self._decode_cardnr(c[1][SIReader.T_CN:SIReader.T_CN+4]), self._decode_time(c[1][SIReader.T_TIME:SIReader.T_TIME+2])) ) else: raise SIReaderException('Unexpected command %s received' % hex(byte2int(c[0]))) return punches def _read_punch(self, offset): """Reads a punch from the SI Stations backup memory. @param offset: Position in the backup memory to read @warning: Only supports firmwares 5.55+ older firmwares have an incompatible record format! """ c = self._send_command(SIReader.C_GET_BACKUP, SIReader._to_str(offset, 3)+int2byte(SIReader.REC_LEN)) return (self._decode_cardnr(b'\x00'+c[1][SIReader.BC_CN:SIReader.BC_CN+3]), self._decode_time(c[1][SIReader.BC_TIME:SIReader.BC_TIME+2])) class SIReaderException(Exception): pass class SIReaderTimeout(Exception): pass class SIReaderCardChanged(Exception): pass