12.3. The cable and the frame

The two lowest layers of the stack are the easiest to take for granted on the camera, because everything they do happens inside the chip and the camera handles them without any Python code being involved. They are still worth a brief tour, because they explain what “local network” means and where the boundary to the rest of the infrastructure starts.

12.3.1. The physical layer

The bottom layer is the actual signalling – the wires, optical fibres, or radio waves that carry bits between two devices. Ethernet over twisted-pair cables encodes each bit as a voltage transition at a fixed rate. Wi-Fi modulates the same bits onto a radio carrier in the 2.4 GHz or 5 GHz band. Both produce a stream of binary digits between two pieces of hardware; both are the kind of detail the camera’s silicon handles without software having to think about it.

From a Python script’s perspective the physical layer is “the link is up” or “the link is down”. The network module reports that state through its isconnected() method on the Wi-Fi interface and through the link status on a wired Ethernet interface. Beyond that, everything else this layer does is hidden.

12.3.3. What the camera exposes

The camera has a MAC address for each network interface it has – a Wi-Fi one if the cam has wireless support, an Ethernet one if the board has the corresponding port. The network module gives access to it through network_interface.config("mac") on whichever interface object the application is using, when it needs to read the address. Some applications need to, for instance to register the device with a fleet management system. Otherwise, this is the only knob the link layer turns over to Python.

Everything else – framing, the actual MAC traffic on the wire or the air, the negotiation between the camera and the access point about which channel and rate to use – happens entirely inside the wireless or Ethernet hardware. The next page covers the one place a Python script does have a say in the link layer: telling the camera which network to join.