Start Adding Voice Telemetry

WARNING - NOT USEABLE YET
This commit is contained in:
Cort Buffington 2019-02-22 16:27:58 -06:00
parent 2af755f504
commit 44823405f0
5 changed files with 572 additions and 1 deletions

162
app_template.py Executable file
View File

@ -0,0 +1,162 @@
#!/usr/bin/env python
#
###############################################################################
# Copyright (C) 2016-2018 Cortney T. Buffington, N0MJS <n0mjs@me.com>
#
# 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
###############################################################################
'''
This application, in conjuction with it's rule file (rules.py) will
work like a "conference bridge". This is similar to what most hams think of as a
reflector. You define conference bridges and any system joined to that conference
bridge will both receive traffic from, and send traffic to any other system
joined to the same conference bridge. It does not provide end-to-end connectivity
as each end system must individually be joined to a conference bridge (a name
you create in the configuraiton file) to pass traffic.
This program currently only works with group voice calls.
'''
# Python modules we need
import sys
from bitarray import bitarray
from time import time
from importlib import import_module
# Twisted is pretty important, so I keep it separate
from twisted.internet.protocol import Factory, Protocol
from twisted.protocols.basic import NetstringReceiver
from twisted.internet import reactor, task
# Things we import from the main hblink module
from hblink import HBSYSTEM, OPENBRIDGE, systems, hblink_handler, reportFactory, REPORT_OPCODES, mk_aliases
from dmr_utils3.utils import bytes_3, int_id, get_alias
from dmr_utils3 import decode, bptc, const
import config
import log
from const import *
# Stuff for socket reporting
import pickle
# REMOVE LATER from datetime import datetime
# The module needs logging, but handlers, etc. are controlled by the parent
import logging
logger = logging.getLogger(__name__)
# Does anybody read this stuff? There's a PEP somewhere that says I should do this.
__author__ = 'Cortney T. Buffington, N0MJS'
__copyright__ = 'Copyright (c) 2016-2018 Cortney T. Buffington, N0MJS and the K0USY Group'
__credits__ = 'Colin Durbridge, G4EML, Steve Zingman, N4IRS; Mike Zingman, N4IRR; Jonathan Naylor, G4KLX; Hans Barthen, DL5DI; Torsten Shultze, DG1HT'
__license__ = 'GNU GPLv3'
__maintainer__ = 'Cort Buffington, N0MJS'
__email__ = 'n0mjs@me.com'
# Module gobal varaibles
class OBP(OPENBRIDGE):
def __init__(self, _name, _config, _report):
OPENBRIDGE.__init__(self, _name, _config, _report)
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data):
pass
class HBP(HBSYSTEM):
def __init__(self, _name, _config, _report):
HBSYSTEM.__init__(self, _name, _config, _report)
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data):
pass
#************************************************
# MAIN PROGRAM LOOP STARTS HERE
#************************************************
if __name__ == '__main__':
import argparse
import sys
import os
import signal
# Change the current directory to the location of the application
os.chdir(os.path.dirname(os.path.realpath(sys.argv[0])))
# CLI argument parser - handles picking up the config file from the command line, and sending a "help" message
parser = argparse.ArgumentParser()
parser.add_argument('-c', '--config', action='store', dest='CONFIG_FILE', help='/full/path/to/config.file (usually hblink.cfg)')
parser.add_argument('-l', '--logging', action='store', dest='LOG_LEVEL', help='Override config file logging level.')
cli_args = parser.parse_args()
# Ensure we have a path for the config file, if one wasn't specified, then use the default (top of file)
if not cli_args.CONFIG_FILE:
cli_args.CONFIG_FILE = os.path.dirname(os.path.abspath(__file__))+'/hblink.cfg'
# Call the external routine to build the configuration dictionary
CONFIG = config.build_config(cli_args.CONFIG_FILE)
# Start the system logger
if cli_args.LOG_LEVEL:
CONFIG['LOGGER']['LOG_LEVEL'] = cli_args.LOG_LEVEL
logger = log.config_logging(CONFIG['LOGGER'])
logger.info('\n\nCopyright (c) 2013, 2014, 2015, 2016, 2018\n\tThe Founding Members of the K0USY Group. All rights reserved.\n')
logger.debug('(GLOBAL) Logging system started, anything from here on gets logged')
# Set up the signal handler
def sig_handler(_signal, _frame):
logger.info('(GLOBAL) SHUTDOWN: CONFBRIDGE IS TERMINATING WITH SIGNAL %s', str(_signal))
hblink_handler(_signal, _frame)
logger.info('(GLOBAL) SHUTDOWN: ALL SYSTEM HANDLERS EXECUTED - STOPPING REACTOR')
reactor.stop()
# Set signal handers so that we can gracefully exit if need be
for sig in [signal.SIGINT, signal.SIGTERM]:
signal.signal(sig, sig_handler)
# Create the name-number mapping dictionaries
peer_ids, subscriber_ids, talkgroup_ids = mk_aliases(CONFIG)
# INITIALIZE THE REPORTING LOOP
if CONFIG['REPORTS']['REPORT']:
report_server = config_reports(CONFIG, bridgeReportFactory)
else:
report_server = None
logger.info('(REPORT) TCP Socket reporting not configured')
# HBlink instance creation
logger.info('(GLOBAL) HBlink \'bridge.py\' -- SYSTEM STARTING...')
for system in CONFIG['SYSTEMS']:
if CONFIG['SYSTEMS'][system]['ENABLED']:
if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE':
systems[system] = OBP(system, CONFIG, report_server)
else:
systems[system] = HBP(system, CONFIG, report_server)
reactor.listenUDP(CONFIG['SYSTEMS'][system]['PORT'], systems[system], interface=CONFIG['SYSTEMS'][system]['IP'])
logger.debug('(GLOBAL) %s instance created: %s, %s', CONFIG['SYSTEMS'][system]['MODE'], system, systems[system])
def loopingErrHandle(failure):
logger.error('(GLOBAL) STOPPING REACTOR TO AVOID MEMORY LEAK: Unhandled error in timed loop.\n %s', failure)
reactor.stop()
reactor.run()

View File

@ -19,7 +19,7 @@
############################################################################### ###############################################################################
''' '''
This program does very little on it's own. It is intended to be used as a module This program does very little on its own. It is intended to be used as a module
to build applications on top of the HomeBrew Repeater Protocol. By itself, it to build applications on top of the HomeBrew Repeater Protocol. By itself, it
will only act as a peer or master for the systems specified in its configuration will only act as a peer or master for the systems specified in its configuration
file (usually hblink.cfg). It is ALWAYS best practice to ensure that this program file (usually hblink.cfg). It is ALWAYS best practice to ensure that this program

84
mk_voice.py Normal file
View File

@ -0,0 +1,84 @@
from bitarray import bitarray
from dmr_utils3 import bptc, golay, qr
from dmr_utils3.utils import bytes_3, bytes_4
from dmr_utils3.const import EMB, SLOT_TYPE, BS_VOICE_SYNC, BS_DATA_SYNC, LC_OPT
from random import randint
from voice_lib import words
# Precalculated "dmrbits" (DMRD packet byte 15) -- just (slot << 7 | this value) and you're good to go!
HEADBITS = 0b00100001
BURSTBITS = [0b00010000,0b00000001,0b00000010,0b00000011,0b00000100,0b00000101]
TERMBITS = 0b00100010
# Need a bitstring of 4-bytes of zero for burst F
NULL_EMB_LC = bitarray(endian='big')
NULL_EMB_LC.frombytes(b'\x00\x00\x00\x00')
# This is where HBP encodes RSSI, it will need to be null
TAIL = b'\x00\x00'
# WARNING this funciton uses yeild to return a generator that will pass the next HBP packet for a phrase
# each time that it is called. Do NOT try to use it like a normal function.
def pkt_gen(_rf_src, _dst_id, _peer, _slot, _phrase):
# Calculate all of the static components up-front
STREAM_ID = bytes_4(randint(0x00, 0xFFFFFFFF))
SDP = _rf_src + _dst_id + _peer
LC = LC_OPT + _dst_id + _rf_src
HEAD_LC = bptc.encode_header_lc(LC)
HEAD_LC = [HEAD_LC[:98], HEAD_LC[-98:]]
TERM_LC = bptc.encode_terminator_lc(LC)
TERM_LC = [TERM_LC[:98], TERM_LC[-98:]]
EMB_LC = bptc.encode_emblc(LC)
EMBED = []
EMBED.append( BS_VOICE_SYNC )
EMBED.append(EMB['BURST_B'][:8] + EMB_LC[1] + EMB['BURST_B'][-8:])
EMBED.append(EMB['BURST_C'][:8] + EMB_LC[2] + EMB['BURST_C'][-8:])
EMBED.append(EMB['BURST_D'][:8] + EMB_LC[3] + EMB['BURST_D'][-8:])
EMBED.append(EMB['BURST_E'][:8] + EMB_LC[4] + EMB['BURST_E'][-8:])
EMBED.append(EMB['BURST_F'][:8] + NULL_EMB_LC + EMB['BURST_F'][-8:])
#initialize the HBP calls stream sequence to 0
SEQ = 0
# Send the Call Stream
# Send 3 Voice Header Frames
for i in range(3):
pkt = b'DMRD' + bytes([SEQ]) + SDP + bytes([_slot << 7 | HEADBITS]) + STREAM_ID + (HEAD_LC[0] + SLOT_TYPE['VOICE_LC_HEAD'][:10] + BS_DATA_SYNC + SLOT_TYPE['VOICE_LC_HEAD'][-10:] + HEAD_LC[1]).tobytes() + TAIL
SEQ = (SEQ + 1) % 0x100
yield pkt
# Send each burst, six bursts per Superframe rotating through with the proper EMBED value per burst A-F
for word in _phrase:
for burst in range(0, len(word)):
pkt = b'DMRD' + bytes([SEQ]) + SDP + bytes([_slot << 7 | BURSTBITS[burst % 6]]) + STREAM_ID + (word[burst + 0][0] + EMBED[burst % 6] + word[burst + 0][1]).tobytes() + TAIL
SEQ = (SEQ + 1) % 0x100
yield pkt
# Send a single Voice Terminator Frame
pkt = b'DMRD' + bytes([SEQ]) + SDP + bytes([_slot << 7 | TERMBITS]) + STREAM_ID + (TERM_LC[0] + SLOT_TYPE['VOICE_LC_TERM'][:10] + BS_DATA_SYNC + SLOT_TYPE['VOICE_LC_TERM'][-10:] + TERM_LC[1]).tobytes() + TAIL
SEQ = (SEQ + 1) % 0x100
yield pkt
# Return False to indicate we're done.
return False
if __name__ == '__main__':
from time import time
speech = pkt_gen(bytes_3(3120101), bytes_3(3120), bytes_4(312000), 0, [words['all_circuits'], words['all_circuits']])
while True:
try:
pkt = next(speech)
except StopIteration:
break
print(len(pkt), pkt[4], pkt)

179
play_ambe.py Executable file
View File

@ -0,0 +1,179 @@
#!/usr/bin/env python
#
###############################################################################
# Copyright (C) 2016-2018 Cortney T. Buffington, N0MJS <n0mjs@me.com>
#
# 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
###############################################################################
'''
This application, in conjuction with it's rule file (rules.py) will
work like a "conference bridge". This is similar to what most hams think of as a
reflector. You define conference bridges and any system joined to that conference
bridge will both receive traffic from, and send traffic to any other system
joined to the same conference bridge. It does not provide end-to-end connectivity
as each end system must individually be joined to a conference bridge (a name
you create in the configuraiton file) to pass traffic.
This program currently only works with group voice calls.
'''
# Python modules we need
import sys
from bitarray import bitarray
from time import time, sleep
from importlib import import_module
# Twisted is pretty important, so I keep it separate
from twisted.internet.protocol import Factory, Protocol
from twisted.protocols.basic import NetstringReceiver
from twisted.internet import reactor, task
# Things we import from the main hblink module
from hblink import HBSYSTEM, OPENBRIDGE, systems, hblink_handler, reportFactory, REPORT_OPCODES, mk_aliases
from dmr_utils3.utils import bytes_3, bytes_4, int_id, get_alias
from dmr_utils3 import decode, bptc, const
import config
import log
from const import *
from mk_voice import pkt_gen
from voice_lib import words
# Stuff for socket reporting
import pickle
# REMOVE LATER from datetime import datetime
# The module needs logging, but handlers, etc. are controlled by the parent
import logging
logger = logging.getLogger(__name__)
# Does anybody read this stuff? There's a PEP somewhere that says I should do this.
__author__ = 'Cortney T. Buffington, N0MJS'
__copyright__ = 'Copyright (c) 2016-2018 Cortney T. Buffington, N0MJS and the K0USY Group'
__credits__ = 'Colin Durbridge, G4EML, Steve Zingman, N4IRS; Mike Zingman, N4IRR; Jonathan Naylor, G4KLX; Hans Barthen, DL5DI; Torsten Shultze, DG1HT'
__license__ = 'GNU GPLv3'
__maintainer__ = 'Cort Buffington, N0MJS'
__email__ = 'n0mjs@me.com'
# Module gobal varaibles
class OBP(OPENBRIDGE):
def __init__(self, _name, _config, _report):
OPENBRIDGE.__init__(self, _name, _config, _report)
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data):
pass
class HBP(HBSYSTEM):
def __init__(self, _name, _config, _report):
HBSYSTEM.__init__(self, _name, _config, _report)
self.last_stream = b'\x00'
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data):
if (_frame_type == HBPF_DATA_SYNC) and (_dtype_vseq == HBPF_SLT_VTERM) and (_stream_id != self.last_stream):
print(int_id(_stream_id), int_id(self.last_stream))
self.last_stream = _stream_id
print('start speech')
speech = pkt_gen(bytes_3(312123), bytes_3(2), bytes_4(312123), 0, [words['all_circuits'], words['enabled'], words['3'], words['1'], words['2'], words['0']])
sleep(1)
while True:
try:
pkt = next(speech)
except StopIteration:
break
sleep(.058)
self.send_system(pkt)
print('end speech')
#************************************************
# MAIN PROGRAM LOOP STARTS HERE
#************************************************
if __name__ == '__main__':
import argparse
import sys
import os
import signal
# Change the current directory to the location of the application
os.chdir(os.path.dirname(os.path.realpath(sys.argv[0])))
# CLI argument parser - handles picking up the config file from the command line, and sending a "help" message
parser = argparse.ArgumentParser()
parser.add_argument('-c', '--config', action='store', dest='CONFIG_FILE', help='/full/path/to/config.file (usually hblink.cfg)')
parser.add_argument('-l', '--logging', action='store', dest='LOG_LEVEL', help='Override config file logging level.')
cli_args = parser.parse_args()
# Ensure we have a path for the config file, if one wasn't specified, then use the default (top of file)
if not cli_args.CONFIG_FILE:
cli_args.CONFIG_FILE = os.path.dirname(os.path.abspath(__file__))+'/hblink.cfg'
# Call the external routine to build the configuration dictionary
CONFIG = config.build_config(cli_args.CONFIG_FILE)
# Start the system logger
if cli_args.LOG_LEVEL:
CONFIG['LOGGER']['LOG_LEVEL'] = cli_args.LOG_LEVEL
logger = log.config_logging(CONFIG['LOGGER'])
logger.info('\n\nCopyright (c) 2013, 2014, 2015, 2016, 2018\n\tThe Founding Members of the K0USY Group. All rights reserved.\n')
logger.debug('(GLOBAL) Logging system started, anything from here on gets logged')
# Set up the signal handler
def sig_handler(_signal, _frame):
logger.info('(GLOBAL) SHUTDOWN: CONFBRIDGE IS TERMINATING WITH SIGNAL %s', str(_signal))
hblink_handler(_signal, _frame)
logger.info('(GLOBAL) SHUTDOWN: ALL SYSTEM HANDLERS EXECUTED - STOPPING REACTOR')
reactor.stop()
# Set signal handers so that we can gracefully exit if need be
for sig in [signal.SIGINT, signal.SIGTERM]:
signal.signal(sig, sig_handler)
# Create the name-number mapping dictionaries
peer_ids, subscriber_ids, talkgroup_ids = mk_aliases(CONFIG)
# INITIALIZE THE REPORTING LOOP
if CONFIG['REPORTS']['REPORT']:
report_server = config_reports(CONFIG, bridgeReportFactory)
else:
report_server = None
logger.info('(REPORT) TCP Socket reporting not configured')
# HBlink instance creation
logger.info('(GLOBAL) HBlink \'bridge.py\' -- SYSTEM STARTING...')
for system in CONFIG['SYSTEMS']:
if CONFIG['SYSTEMS'][system]['ENABLED']:
if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE':
systems[system] = OBP(system, CONFIG, report_server)
else:
systems[system] = HBP(system, CONFIG, report_server)
reactor.listenUDP(CONFIG['SYSTEMS'][system]['PORT'], systems[system], interface=CONFIG['SYSTEMS'][system]['IP'])
logger.debug('(GLOBAL) %s instance created: %s, %s', CONFIG['SYSTEMS'][system]['MODE'], system, systems[system])
def loopingErrHandle(failure):
logger.error('(GLOBAL) STOPPING REACTOR TO AVOID MEMORY LEAK: Unhandled error in timed loop.\n %s', failure)
reactor.stop()
reactor.run()

146
voice_lib.py Normal file
View File

@ -0,0 +1,146 @@
from bitarray import bitarray
words = {
'all_circuits': [
[bitarray('001011000001010000100010001001011111101010110000110001100010011001011000001010010000000100000111010000111101'), bitarray('100101001000101100110100111010010101011010110100001001100010000001111001101000010010000101110010111000101011')],
[bitarray('000010010000010101100110000100000010111101001010001111000010001100111011001111010110010000100100110101000111'), bitarray('001000001000100101100010010100100010001111010110011111000110001100100111000110100100110111100011001010011000')],
[bitarray('111111110010101010101001111000111010110110011010011000001001110011011101001110000011001101111010100001111111'), bitarray('010101101001110001010011011000111111000011000011011100000011011001011011100111110010111001100001000000111111')],
[bitarray('001010110011001000100111010100101001100101101010101000100101110110000001010111110001111001000110000000101110'), bitarray('000010110010010111110111111100101110001010100010101101000101000010100111000101001101111000001011010000000011')],
[bitarray('010011010001100000101011110101010011011001101000011100101010001100110110000010100111111001101000101000000010'), bitarray('011011111110101000011001100000000111000011101001010110101000010101111000101110101010001101100001100111010000')],
[bitarray('011111010010011100111010111110010110101001101100100010110000011000101011000111000100001001011000000100111111'), bitarray('000010010011100011001101101101101111000110000101101001000110001000111000111010101111001011111111111000000000')],
[bitarray('010111101111010000000011000001101100111111000101011011001011101001100010001010111010000100000001011100111010'), bitarray('011110001000001110000010111101001111000011111100110100100110011001111100110100101100011100110001101000111111')],
[bitarray('010010011010101100000110011100101011010100000111001101001110100001110101001111001111101000100101001101110110'), bitarray('000110000010000010011011111011101001111100110000000100000000000001000110011110101011100011010001110111100111')],
[bitarray('111001100001010000001010100000000101001011011111000111111111011110001001010110111100000101111001101101001001'), bitarray('011000101100011110011101100100110111000011110001101001111001001001111100111110101010101100101111001011000000')],
[bitarray('011011010000111000010110001000101100101001101011111110111110010000100111010010110110000101100011001100101001'), bitarray('111001100010011101110111100100111110000010000001001100000111001001011001101001001011101100010011111111000001')],
[bitarray('011110110101001101000000010100001011101000010001001101010010101100111010010110010111100001000101101001000111'), bitarray('111011000111011011010010010011001110010110110000111001101010000111110011101001100010011010000010101110101101')],
[bitarray('011010011101000101101000101001111000000101101010010111011001110001010001000010110101100000011011100101111011'), bitarray('000110111010011111001001010111001011011010100010101100001000011110111111110100000111101100010101010100100111')],
[bitarray('001110101010000100000001000000011111011110111011011111000111100100011011010110101101001001000111001101011101'), bitarray('001110000011100011000100110111000111011111001001110100000010010001001010010010101111010101111000011011111011')],
[bitarray('001011101111111001000100011000001101000111100010110101001110000101000110011011101001101101100001011000010100'), bitarray('010010001111110111101001101101110110000010011110110001100010010000010000110011100010101011000011110000011000')],
[bitarray('010110011011111100001101010011000111110001001011000101011011011001011000000010111111010101001000011101111101'), bitarray('111111111011010100001110001101011000010011001101011100110011011101011101100010110000001111001100100000000010')],
[bitarray('001010011100101100100000000001001111101011100110010101000111010010100011011011111001110001000011001001011111'), bitarray('110000100100101001000101111111100011010011001010110001000011011101101100100101100111110000000110101110010001')],
[bitarray('010011111111100001100111110101011100111100100111110010011111101100011100110100100111000101100100100001001010'), bitarray('011011111010000010001011010111000100110001000001000001101111001010101011000011110111000011001011001100101111')],
[bitarray('111101100010001101101100011010011111011010000110000110011011010101011000111100110010010001101000000111011100'), bitarray('010000001110011111011101111010010111100001100000110001101100101000000110100111011100101000011100111011101111')],
[bitarray('101001000000100001101110111000101111000001110100110011000011100101011010110101100101111000001010111001110010'), bitarray('110110000100001101011000100000100100101001000111101101010100111000110000111101100000001010011000101010110111')],
[bitarray('111100100010111001101111111011110110000010101100010000011000011100100100110000100011110001101111110111010100'), bitarray('001010001110010000011011011101000100110100110000111101001110111111010110001010001110010000011010001100010111')],
[bitarray('101000100110111100101001110110110110010010000110110001011101000111011001101100010100111100001000110111110110'), bitarray('011011100101111000011101000111011001101101110110100100101100111111110001010001001111110100011000100100100011')],
[bitarray('100001110100101011110100010100010001011000110100100000010100001100010111101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')]
],
'0': [
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('000110011010000101000001001001011010110001000001101010011000001000010110001010101000001000100011000100111011'), bitarray('000010011011001111010000100100001011010111001000110100100001010000011101011010001110001001011101001111101010')],
[bitarray('000011001010101101111101010101011010011001001101010111001010011100011011000011101100110101001101001111111111'), bitarray('010101110001100010000111110110011010100100100101001100001110011010110110100110001110100000100011110010001110')],
[bitarray('101000100011010100101101011100100010101111100100000000001110010101001001110101010110000001001110001101110000'), bitarray('111101110100110000001110100000001101110100110110101000001010010010100000101101000110110011101011110110110111')],
[bitarray('111001100111111001000000101011000111000011001100111011011001100111110001111001100000100001100010101001110001'), bitarray('000111100111011011010101001100100001111101110010100001000010111101000100001111000000010111000001000101100100')],
[bitarray('111000100001110101010101111100000101010000001000010010010101100110101111111001000100111101101001110100100010'), bitarray('000100111000110101000000000100011011100001100010111000001101100001110100011101110000010000010100011110010111')],
[bitarray('101101110100101111110100001001000110010100000110100101110000010001110110111111111010110011100000010100100010'), bitarray('010010010101110100110110011100001101101011001010101001000000001000000000000001000100010000001000000010000000')]
],
'1': [
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('001111101011000100000101011101000110111010111110010100001011011000100110000111001000110000000110000010100001'), bitarray('011011001111100111000111001101011000000011101000111000100011111101100100001011000110000100010011101101000011')],
[bitarray('011011001010100100100011010101110111110001000000011110010101010101011011111100010001000000100000000001100011'), bitarray('001010101101100011110000111010000001111000100010001100100001001001010100011010101000101011010001101010110111')],
[bitarray('111000100001001001100011001001010100111001010001010010001111000011001101101100010110000101100010100111000111'), bitarray('000011011000111100000100011100000101101101010010111000000111101011100010011010100101011011001010101001101011')],
[bitarray('100100000000100100100001100011010011010001001110001110011000001010110111110001100100110001100000100110100001'), bitarray('001111101001110110001100100110000101100101000101101100101101111110110111011001101000100001011110111001110011')],
[bitarray('111100010001110001101110110111110110000011001100010000001100010001000110110100111101010001101011100010000000'), bitarray('000001100000100000001001111000010111010011001100111110100110011100110101011101010011110110010000110001110000')],
[bitarray('110011101011111011100000011100000000011010100111111100010110011101001101110010001001100011000101011101100010'), bitarray('011000111100100101100010101111000101110010011000100011000100011101100010011000111100100101100010101011000101')],
[bitarray('110010011000100011000100011101100010011000111100100101100010101011000101101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')]
],
'2': [
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('110000000100010000000111110101100001000011101100110101111000111100111111100000100000100000001000101001000000'), bitarray('001110101010000000010101110101101110100100100011100101101010111000010010101101010010100100111111010001100101')],
[bitarray('110000100001111001001101100111000110000110111110010100011100000001010011100000100110110000001010101110110110'), bitarray('011111010100110100001000001011011110101100011000010000001101110010100110010000111110010000011101111110001111')],
[bitarray('101000100010011101001000110110000111000000000011000110010000001001011011111100010101010111010101011101000100'), bitarray('011100010001100010011011100010110010110110011000100011000100011101100010011000111101101001000010101011110100')],
[bitarray('111110011010100011100100011101000010010000011100100001100010111011110100110110011000100011000100011101100010'), bitarray('011000101101100001100010100011110110101011001010101001000000001000000000000001000100010000001000000010000000')]
],
'3': [
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('010010100001100001000010001101011011001000111110001111000001000111100011010011101110011001000010011100101110'), bitarray('000101101010111011000011011101101111000111011100111101100110011000001100001010100110101000011000000101110010')],
[bitarray('010010101010100100100101011001111111011100100101010000101101101100100110010010101000100000100110010101011100'), bitarray('010100110111010000111110111100110011101101010100011100100010000001000101101110000101101011011010111111111010')],
[bitarray('101000100000010100000000111100100100110101001101101100010100011110101010101000000011011100000010111100010101'), bitarray('110101001100101100000001000110011010100101100101101100100111111000000101001011011011110011100110011110101010')],
[bitarray('100000000110111000111111010001110111001011011001011010011001100110000111111100000001110101011001010001010110'), bitarray('001010100001110010011110110000011110100000100111111100011100011001000101001011001011010010011100101111100110')],
[bitarray('111100010010111101001001000101110110000110000111100011011000100100001110100100101001010000101110111011110000'), bitarray('000001101111010100011100110111011010111001010010101001001010101011110110011000100110000000011101111110011110')],
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')]
],
'4': [
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('001111001110110001100001110011011110000111111111011111011001101000001110010011001010111000000110111111111100'), bitarray('011110010000100110001110101111010010100000010010001000001101000001101001001100001010000111000111001110101111')],
[bitarray('111000110110000101001001011001111001010001000000101010000100001100000011101100100110010100101101001111001101'), bitarray('011000000100110010001011101001011001110000010010000001001010010111110111110010100100001000000101110000000110')],
[bitarray('101001110011100101001010011010001100011000001110000001000110011100000011100001010000110001101000000011000101'), bitarray('101011100010001110011001011010110000111101110110111000001110011011100000111110101100110011011001001000101001')],
[bitarray('101000110011100101101111010011000000101000101110001011011100110000011011100100110000101101101110010011000010'), bitarray('101000001100010011111010111000011011101100010100110001101110000000000011110100100000100111000101010010011100')],
[bitarray('111100100101101001101111110100000110010010000011100000010000101011100010101001010011110000001101101000110010'), bitarray('010101110011000001010101011011000000101011001010101001000000001000000000000001000100010000001000000010000000')]
],
'5': [
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('000110011110101101100001011101001101000100011001100100001011111010011010001011101000100101101110000101011111'), bitarray('010101111111000011111000001100011000100100000011001100101100001000001101011101111011010011110101010011001011')],
[bitarray('101000000000000000101101000000011100010000011101001111000110001110101011100001110001010000000111111100101000'), bitarray('010100111111101111011011110110000111111001000111011101000001111100001001011001110101011011001111100100011010')],
[bitarray('111100110111010001011000011101010010101010111010100101111001000010000110100000010100110101111111010000000000'), bitarray('101001110101111011000101000011111001100100000000101001101011100000000101110000010111100100011001010001000111')],
[bitarray('101000110000101100001011100000010110001111101010010000010000110001001011101100000100110001101011111011110011'), bitarray('111000011100000100010011111010110100101100110100101101101000111110101011011010100110011011111000101100000011')],
[bitarray('110101110010110111100011001100001111011000101101110010110101101000110100110100111010110110100011011000100101'), bitarray('100001000101110011010100100111001000011100010011101111110000011110000111000001001000100011011000101010001110')],
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')]
],
'6': [
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('111000010110100001101000010011100011000111101011011111110101000111001110110000110101010111100111010100010101'), bitarray('001101100101110011011110111111110110101100010000010001111011111110100010000101000000001110110010010000011100')],
[bitarray('100101110110100000101101111011100100001101001000100101111010101100110100111111001000011010100100110100111101'), bitarray('111110101111011111111011001110110100001011110011100110001010101101111110101001100010111010001111011001101111')],
[bitarray('110101011001100010000111000100110000101011101100100011000110010000100110100111111000010010100101001101010001'), bitarray('101110100000010110100100100000001101100010110001001110000111001101010100000011111110101001010001001101111000')],
[bitarray('111101001010101010100100010100100111100010101100110111110010011000110110100100011110111111000111001101000011'), bitarray('110100101111011010000001110101110010111011110011111010100101010000110001011011001011101011101001100111101011')],
[bitarray('101110110111100111000101001001010111010000001000010110111010011010011010111110010011101110100000000000110011'), bitarray('001000100101110010111111011100110100111010101010101011100111011101100110000100111100110101010000101010010000')],
[bitarray('110001010011010011011001011000100101010001000110000101011010000000010000001100010101011011101000111000100100'), bitarray('000001100010101001010100001010100100110011001000111111000010011101000100010111110001110000100100011000001001')],
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')]
],
'7': [
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('010010110001100100000010000100111111101010100000111011011001111010001000010110111100000100000100001101101100'), bitarray('101100001111000010001011011111001101011111011000111101100000010001101111111001010111100000000110111110100010')],
[bitarray('000110011010110001011000011101001101011110100101000110111000101111000000100101010011000101111001011001000001'), bitarray('000111000111100101010110011110101011111101010101000000011101001001110011000010001100001100000000010001000011')],
[bitarray('110100000000001100100000001101000000000010011111100011010011110011000011100000110101000101100101001101100111'), bitarray('001111100111011010010000100000011011111000100001001000000011000101010000010110001011111011010011110111000011')],
[bitarray('110001010101111001100010101010000000001011011101111110001110101010110010100101000010110000000100100010100011'), bitarray('000010100110010111101011101001101111110101010110110101100000101011010010001011011001111010011101100110100111')],
[bitarray('101101010010111100100111100111000110001110110100001010011100101101111011100100110011101000100000100110000110'), bitarray('011000101110010110011000011011110011100001010111100000001110111010110101010100101100110001001100101000010100')],
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')]
],
'8': [
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('110000011010100110100000001001001110000010011000100100001000110100111111101000110100101011101100101101101001'), bitarray('111111001100011110100011111011001101101011100011001111000010011001101110011100010000010011010101010101011010')],
[bitarray('110011110101011110000101000101100101100011010100100000101111001101110111110010010101000111100010011101000101'), bitarray('000110010110010101000011001111000101101111010011011110000010011101000010001100010001100001110011100011000111')],
[bitarray('111110101011100011100100010101000100010000101101100101010000100010100001101110101101101010000011010100100110'), bitarray('001001000101010100010101100000001101101011001010101001000000001000000000000001000100010000001000000010000000')]
],
'9': [
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('010010001110100101111111001101110010011110111100001000011101000110010111010110111100100001001110011101010101'), bitarray('000010101110010000011010001111000101110000100001001000100011000000100100010010001100101011000000101111110001')],
[bitarray('111100110010001100000010000000000101011110111101101111010000111111100011110000100011001000000011000001100001'), bitarray('001011101100100011000110110111000110110100110000001101000011011001110110111001100101000010001001010111011011')],
[bitarray('110100010010000000000011001001110011000011101100100011000000110111000011100100110100000101100101001101100110'), bitarray('001011100110010010010010100000001011100001000111011000101000010111110110111001010000101100010110001000100011')],
[bitarray('100101110101010100001101100100010101110001101010011111010011101000101110101000110001000100001001100110011001'), bitarray('000001010101110000010011110010010010111000110000111101001101111011000111001011001001000001001001011001000100')],
[bitarray('110001010001100001101001100011110100000100010110010100001101101110011111111000110101010011100111010100100111'), bitarray('000100000100100010011000100110010101110110001000100111000100011101000100010000111101101000110101100010110011')],
[bitarray('111110101010101111000110011101000110011001011101110001100111100011010001101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')]
],
'disabled': [
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('001111000111111001000001001101111110111101100010011111001010011011101111000011110110111101100001000101011010'), bitarray('111100000010010011101000011111011100001111110101111100000011000101011100011011011100101010000011111110110011')],
[bitarray('000000100100010011111110010011100100011100001001001011100101101011101000010110111111101101011011100010110100'), bitarray('011111100001110010001110111011011110000011101001010000011011110001001101011011011110110010001111000000100101')],
[bitarray('010110111100001000111110010011101111100010001100001000100101111000110101000010101010000000010111111010011011'), bitarray('000110000101101001000001001100100001000111011010010100100100011100001101011101100000001010010111001111110101')],
[bitarray('010010001000101100000100010001001000011001100110001100011001101100010101000011101100100101100100011001010101'), bitarray('100100111111111011010101011110110001001111111000100101100010101101111110000010100111110010100010001111111111')],
[bitarray('100000100000011100000011111000000000110100001101100001100000001111111111110100110100011101000101111001110100'), bitarray('111001100110000000100111011101010001100001000001001000100110110001110001100010100111110001010111101100000001')],
[bitarray('110000100111011101100100110101100010110001000100000000000010011101010001111100110110010101100101111101000001'), bitarray('111101100110000100100011011100110001101001100101011001001011001110110101001111011000000100101101110100001011')],
[bitarray('100100110100000100101001111100010111111111010011001011110010010111000001110100110000110001001111101010010010'), bitarray('000010111010000101011100001101000001100101100111100111110101010001010111000001100000101000010101011101110110')],
[bitarray('101001110110101010000100000000110001100110001110000001111001110101011100100101100000011010111010101100011001'), bitarray('100010100000110101101001011111110010100110111001001011000000001100010111001011110000110110111100110010011111')],
[bitarray('110111111101011110100011010001010001000001110000001011101001000010001101110110101010101011100110011101000010'), bitarray('001101101001110101010001101111000001101011001010101001000000001000000000000001000100010000001000000010000000')]
],
'enabled': [
[bitarray('010011101100010000101011000011111110110001110110001001110101000111111001011010001100000001100011101111001101'), bitarray('001111101111000000110100010110011101010111011000111001100000000001001010110001100110110000100001110110100010')],
[bitarray('011010101011101100000111011001011010010101000101001000001101111001110101010010001000101000000111011101101001'), bitarray('011000010100001000001001110101000100110001000111001101000110001011100100100010000000111010000001001111010001')],
[bitarray('100000000010010100100000110000010011111001001100101000000101011111011101100101110100010100000011001101000011'), bitarray('101111010101101110001001100111111111111101010110001101000000101101110110101010011000011100000101101111111101')],
[bitarray('100001100111101100000111111000100000000010001011101011000111010110111111110000100000101100000100111001101101'), bitarray('010001001010111000000111001101110111101001000111100100000100110000000011000111111000101010000001011110011101')],
[bitarray('110100110000111000100101101001100100101010010010111011011001010110110011111100110100100101101000011011100000'), bitarray('001010011110000010110001000111011100110101100111110001001111011011100100000000000100011011010111110000100010')],
[bitarray('100000110100001001101101011110010011010000100010011100111111011010100011110101010110001111000011011100010111'), bitarray('011011101100111011011011010101011011000001001100101011101100001101111010111011111100010101100111001001110110')],
[bitarray('110101101110001110100111011001110010011011000000110100010011101010001000101101011011001100101001110010110010'), bitarray('010010000000010001111001001001100010101011001010101001000000001000000000000001000100010000001000000010000000')]
]
}