Exemplo n.º 1
0
    def ProcessMessage(self, recieved_message):
		Log.Parse_Message_To_Collection(recieved_message)
		SetLastHeardFrom(recieved_message.Return_Origin_ID())
		if(recieved_message.Return_Payload()[:2:] == "HC"):
Exemplo n.º 2
0
    def PingSystem(self, destination_id):
        toSend = Message('car123', 'mls', 'destination_id', '100', 'Status Update')
		Log.Parse_Message_To_Collection(toSend)
Exemplo n.º 3
0
	Purpose: To test the Logging class to ensure that a message can come in, and the
                 message will be stored in the correct collections.
'''

#Import the message and log class
from Message import Message
from logging import Log

#Create several messages to test with

message01 = [
    Message("CAR12345", "mls", "clc", 100, "SUR:HC"),
    Message("CAR12345", "brk", "mls", 100, "HC1: NOT SLOWING DOWN"),
    Message("CAR12345", "clc", "mls", 100, "HC3: TEMP 50F HUMIDITY 6%"),
    Message("CAR12345", "brk", "lis", 100, "SUR: BRK LT ON"),
    Message("CAR12345", "ccs", "dts", 100, "SUR: DR 23%")
]

logging = Log()

#Drop all of the previous collections to ensure new features of logging are working
logging.bobby_drop_tables()

#Go through all messages
for i in message01:
    logging.Parse_Message_To_Collection(i)  #Puts message at index i in MongoDB

logging.RetrieveAll()

print("Success")