|
|
|
@ -5,8 +5,15 @@ from RFM69_POCSAGregisters import *
|
|
|
|
|
import datetime
|
|
|
|
|
import time
|
|
|
|
|
from ConfigParser import SafeConfigParser
|
|
|
|
|
import pika
|
|
|
|
|
|
|
|
|
|
config = SafeConfigParser()
|
|
|
|
|
config.read('config.ini')
|
|
|
|
|
config.add_section('main')
|
|
|
|
|
config.set('main', 'amqpURI', 'amqp://user:pw@host:port')
|
|
|
|
|
|
|
|
|
|
with open('config.ini', 'w') as f:
|
|
|
|
|
config.write(f)
|
|
|
|
|
|
|
|
|
|
rfmModule = RFM69_POCSAG.RFM69_POCSAG(RF69_433MHZ, pocsagBaudRate=1200, isRFM69HW = True)
|
|
|
|
|
#rfmModule.shutdown()
|
|
|
|
@ -29,6 +36,29 @@ def my_random_string(string_length=10):
|
|
|
|
|
random = random.replace("-","") # Remove the UUID '-'.
|
|
|
|
|
return random[0:string_length] # Return the random string.
|
|
|
|
|
|
|
|
|
|
def msgCallback(ch, method, properties, body):
|
|
|
|
|
print(" [x] Received %r" % body)
|
|
|
|
|
|
|
|
|
|
while True:
|
|
|
|
|
try:
|
|
|
|
|
connection = pika.BlockingConnection(pika.ConnectionParameters( config.get('main', 'amqpURI') ))
|
|
|
|
|
channel = connection.channel()
|
|
|
|
|
queue = channel.queue_declare(queue='input')
|
|
|
|
|
queue_ttl60 = channel.queue_declare(queue='input_ttl60')
|
|
|
|
|
channel.basic_consume(queue='input',
|
|
|
|
|
auto_ack=True,
|
|
|
|
|
on_message_callback=msgCallback)
|
|
|
|
|
channel.basic_consume(queue='input_ttl60',
|
|
|
|
|
auto_ack=True,
|
|
|
|
|
on_message_callback=msgCallback)
|
|
|
|
|
print(' [*] Waiting for messages. To exit press CTRL+C')
|
|
|
|
|
channel.start_consuming()
|
|
|
|
|
|
|
|
|
|
except Exception:
|
|
|
|
|
time.sleep(.5)
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from pocsag import encodeTXBatch
|
|
|
|
|
msgs = []
|
|
|
|
|
"""
|
|
|
|
|