Internal Api

internal classes and methods. Documentation for maintainers.

Warning

This section of the documentation is incomplete

CarController Module

File: carcontroller.py

This module provides a convenience class CarController to transfer the input data from the dongle to other users.

class oxigenlib.carcontroller.CarController(*, car_reset: bool, car_controller_link: bool, car_in_pit_lane: bool, id: ~typing.Annotated[int, ~annotated_types.Ge(ge=0), ~annotated_types.Le(le=20)] = <factory>, last_lap_time_s: ~typing.Annotated[float, ~annotated_types.Ge(ge=0)] = <factory>, lap_count: ~typing.Annotated[int, ~annotated_types.Ge(ge=0)] = <factory>, power_mean_value: ~typing.Annotated[float, ~annotated_types.Ge(ge=0)] = <factory>, car_on_track: bool, car_firmware: str, controller_firmware: str, controller_batt_low: bool, track_call_check: bool, lap_time_info: bool, arrow_up_btn: bool, arrow_down_btn: bool, round_btn: bool, timestamp_msg_cs: ~typing.Annotated[int, ~annotated_types.Ge(ge=0)] = <factory>)

Container class for the data package returned by the dongle that represents car-controller pair

Parameters:
  • car_reset (bool) – flag reminder if a car has recently been reset

  • car_controller_link (bool) – link to car available

  • car_in_pit_lane (bool) – flag if car is in the pitlane

  • id (int) – identification number of the car

  • last_lap_time_s (float) – keep the last lap time in seconds

  • lap_count (int) – numbers of laps recorded by the car

  • power_mean_value (float) – position of trigger or average value of pwm signal. It depends on the configuration parameter of the system

  • car_on_track (bool) – flag reporting if the car is or not on the track

  • car_firmware (str) – firmware value of car chip

  • controller_firmware (str) – firmware value of the controller

  • controller_batt_low (bool) – flag reporting low battery status

  • track_call_check (bool) – flag reporting if controller reported track call

  • lap_time_info (bool) – flag reporting if lap time includes a ‘short lap’

  • arrow_up_btn (bool) – up button pressed on controller

  • arrow_down_btn (bool) – down button pressed on controller

  • round_btn (bool) – up button pressed on controller

  • timestamp_msg_cs (int) – timestamp of the transmitted message in centiseconds. Value already aligned with the dongle timer according formula _race timer (last lap)_ of the official oxigen documentation

oxigenlib.carcontroller.create_new_player(car_id: int) CarController

Support function to generate an empty CarController class for a new player with a known id. Useful to generate a starting CarController while filling the racers list at the registration fase

Parameters:

car_id (int) – Number of the car to add to the system

Returns:

content of dongle transmission converted in easy format into class CarController

Return type:

CarController

oxigenlib.carcontroller.decode_dongle_pkg(data: DongleRxData) CarController

Convert dongle package into readable an structured CarController class

Parameters:

data (DongleRxData) – class containing the received bytes from the dongle

Returns:

content of dongle transmission converted in easy format into class CarController

Return type:

CarController

Constants Module

File: constants.py

collection of important values for the oxigen protocol

Racer Module

File: racers.py

Maintain and update the list of players. This module exposes an instance of class Racers as oxigen_racers.

oxigenlib.racers.get_player_data(car_id: int) CarController | None

Retrieve all data available for a plyer/car.

Parameters:

car_id (int) – Number of the car to which the limitation applies

Returns:

None if no data is available or a CarController instance

Dongle Module

File: dongle.py

class and instance to communicate with the dongle

class oxigenlib.dongle.Dongle
check_data_waiting() None
connect(port: str) None
read() None
send(bytes_data: bytes) None