Added numeration of incoming and outgoing messages. Also added ack field for messages going to device and added message Ack (that will be eventually send from device to gateway).