Exemple #1
0
def AddMessage():
    if 'message_id' in request.args:
        temp_message_id = request.args['message_id']
        for message in messages:
            if message.message_id == temp_message_id:
                return "message_id is uniqe and already in use"
    else:
        temp_message_id = None
    if 'session_id' in request.args:
        temp_session_id = request.args['session_id']
        for message in messages:
            if message.session_id == temp_session_id:
                return "session_id is uniqe and already in use"
    else:
        temp_session_id = None
    if 'application_id' in request.args:
        temp_application_id = request.args['application_id']
    else:
        temp_application_id = None
    if 'participants' in request.args:
        temp_participants = request.args['participants']
    else:
        temp_participants = None
    if 'content' in request.args:
        temp_content = request.args['content']
    else:
        temp_content = None
    create_row_data = Message(str(temp_application_id), str(temp_session_id),
                              str(temp_message_id), str(temp_content),
                              str(temp_participants))
    messages.append(create_row_data)
    for message in messages:
        if message.message_id == str(temp_message_id):
            return json.dumps(message.__dict__)
Exemple #2
0
def insertMessages(m, mDict, mList):
    u = m[0]
    a = m[1]
    p = m[2]
    mObject = Message(u, a, p)
    mDict[len(mList)] = mObject
    mList.append(mObject)
    return mDict, mList
Exemple #3
0
	def __init__(self, receiverID, senderID, priority, timeOut, device, data, unit):
		Message.__init__(self, receiverID, senderID, priority, timeOut, device)
		self.data = data
		self.unit = unit
Exemple #4
0
	def __init__(self, receiverID, senderID, priority, timeOut, device, command, value):
		Message.__init__(self, receiverID, senderID, priority, timeOut, device)
		self.command = command
		self.value = value