Skip to content

Layered Model

grant_____ edited this page Jan 30, 2020 · 11 revisions

Layered Model

To conceptualize the disaster radio firmware, we created a layered model based largely on the OSI model used in teaching classical computer networking.

Layer 1 - Layer 2 - Layer 3 - Layer 4
raw data -> packet -> datagram -> message
raw data <- packet <- datagram <- message

Layer 1

LoRa (or simulated LoRa) physical layer, This is interfaced by the LoRa transceiver developed by Semtech, which handles the physical modulation and encoding of radio waves. In our code, we interface with the transceiver through the arduino-LoRa library, which is further abstracted by Layer1_LoRa (which exists mostly to allow the Layer 2 code to be tested in our simulator) Layer 1 receives raw data from the LoRa transceiver and sends packets to Layer2 to be interpreted,

    char incoming[PACKET_LENGTH];
    int incomingLength = 0;
    while (LoRa.available()) { 
        incoming[incomingLength] = (char)LoRa.read(); 
        incomingLength++;
    }
    LL2.packetReceived(incoming, incomingLength);
}

Layer 1 receives packets from Layer2 and sends raw data to the LoRa transceiver, Like so

    if(LoRa.beginPacket()){
        for( int i = 0 ; i < len ; i++){
            LoRa.write(data[i]);
        }
        LoRa.endPacket(1);
        LoRa.receive();
    }

Layer 2

The routing layer. This is the LoRaLayer2 code which creates an ad-hoc packet switching network of nodes. Detailed information on the packet structure and routing protocol used by this layer can be found in the Protocol documentation https://github.com/sudomesh/disaster-radio/wiki/Protocol

Layer 2 receives packets from Layer 1, interprets the header, and either forwards the packet by sending the packet back down to Layer 1 or it sends the packet to Layer 3 to be consumed by a service/application.

Layer 2 receives datagrams from Layer 3 along with information at about the destination address, appends a header to the front, creating a packet, and sends that packet to Layer 1.

Layer 3

The transport layer. This has some similarities to UDP. It made up of what we have typically referred to as the "firmware." That is, an arduino sketch that joins any number of clients/services and allows them to communicate, e.g. it allows a telnet session to transmit data over the LoRa message

Message id - a global counter of datagrams sent by the node, used for simple error checking Destination port - the client for which the datagram is intended (what if there should be multiple intended clients?) Unlike UDP there is no need for a source port since there is no concept of servers and clients in a disaster radio network, only peers. We have no planned support for TCP-like connections.

Layer 3 receives datagrams from Layer 2, interprets datagram header, determines if a certain client is the intended recipent using the destination port, and sends the datagram to Layer 4

Layer 3 receives messages from Layer 4 along with information about the destination address and port, using this creates a datagram that is sent to Layer 2

Layer 4

The application layer. Can be anything from a Serial console to a WebSocket application to a BLE-connected Android application. Takes

Clone this wiki locally