Create system state entry in dataman - ATTN Anton

Create persistent system state id for data manager to store system state
that will persist across resets.
This commit is contained in:
Jean Cyr
2014-06-08 14:08:22 -04:00
parent 3e66d7e0c9
commit a6cf04a6ff
5 changed files with 136 additions and 13 deletions
+25 -1
View File
@@ -53,6 +53,7 @@ extern "C" {
DM_KEY_WAYPOINTS_OFFBOARD_0, /* Mission way point coordinates sent over mavlink */
DM_KEY_WAYPOINTS_OFFBOARD_1, /* (alernate between 0 and 1) */
DM_KEY_WAYPOINTS_ONBOARD, /* Mission way point coordinates generated onboard */
DM_KEY_SYSTEM_STATE, /* Persistent system state storage */
DM_KEY_NUM_KEYS /* Total number of item types defined */
} dm_item_t;
@@ -62,7 +63,8 @@ extern "C" {
DM_KEY_FENCE_POINTS_MAX = GEOFENCE_MAX_VERTICES,
DM_KEY_WAYPOINTS_OFFBOARD_0_MAX = NUM_MISSIONS_SUPPORTED,
DM_KEY_WAYPOINTS_OFFBOARD_1_MAX = NUM_MISSIONS_SUPPORTED,
DM_KEY_WAYPOINTS_ONBOARD_MAX = NUM_MISSIONS_SUPPORTED
DM_KEY_WAYPOINTS_ONBOARD_MAX = NUM_MISSIONS_SUPPORTED,
DM_KEY_SYSTEM_STATE_MAX = 1
};
/** Data persistence levels */
@@ -101,6 +103,18 @@ extern "C" {
size_t buflen /* Length in bytes of data to retrieve */
);
/** Lock all items of this type */
__EXPORT void
dm_lock(
dm_item_t item /* The item type to clear */
);
/** Unlock all items of this type */
__EXPORT void
dm_unlock(
dm_item_t item /* The item type to clear */
);
/** Erase all items of this type */
__EXPORT int
dm_clear(
@@ -113,6 +127,16 @@ extern "C" {
dm_reset_reason restart_type /* The last reset type */
);
/* NOTE: The following structure defines the persistent system state data stored in the single
entry DM_KEY_SYSTEM_STATE_KEY item type. It contains global system state information that
needs to survive restarts. This definition is application specific so it doesn't really belong
in this header, but till I find it a better home here it is */
typedef struct {
char current_offboard_waypoint_id; /* the index of the active offboard waypoint data */
/* (DM_KEY_WAYPOINTS_OFFBOARD_n) or -1 for none */
} persistent_system_state_t;
#ifdef __cplusplus
}
#endif