PX4 Firmware
PX4 Autopilot Software http://px4.io
subscriber_handler.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <uORB/uORB.h>
5 #include <uORB/topics/cpuload.h>
10 
11 namespace events
12 {
13 
14 /**
15  * @class SubscriberHandler
16  * Contains a list of uORB subscriptions and maintains their update state.
17  */
19 {
20 public:
21  void subscribe();
22  void unsubscribe();
23  void check_for_updates();
24 
26  int get_cpuload_sub() const { return _cpuload_sub; }
30 
31  /* update checking methods */
33  bool cpuload_updated() const { return _update_bitfield & (uint32_t)StatusMask::CpuLoad; }
37 
38 
39 private:
40  enum class StatusMask : uint32_t {
41  VehicleCommand = (0x01 << 0),
42  VehicleStatus = (0x01 << 1),
43  VehicleStatusFlags = (0x01 << 2),
44  BatteryStatus = (0x01 << 3),
45  CpuLoad = (0x01 << 4),
46  };
47 
49  int _cpuload_sub = -1;
53 
54  uint32_t _update_bitfield = 0;
55 };
56 
57 } /* events */
Contains a list of uORB subscriptions and maintains their update state.
API for the uORB lightweight object broker.
int get_vehicle_status_flags_sub() const
bool vehicle_status_flags_updated() const