dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
uavobjectmanager.c File Reference

Object manager library. This library holds a collection of all objects. It can be used by all modules/libraries to find an object reference. More...

#include "openpilot.h"
#include <utlist.h>
#include "pios_struct_helper.h"
#include "pios_heap.h"
#include "pios_mutex.h"
#include "pios_queue.h"
#include "pios_thread.h"
#include "misc_math.h"

Go to the source code of this file.

Data Structures

struct  ObjectEventEntry
 
struct  ObjectEventEntryThrottled
 
struct  UAVOBase
 
struct  UAVOBase::UAVOInfo
 
struct  UAVOInfo
 
struct  UAVOMeta
 
struct  UAVOData
 
struct  UAVOSingle
 
struct  UAVOMultiInst
 
struct  UAVOMulti
 

Macros

#define SET_BITS(var, shift, value, mask)   var = (var & ~(mask << shift)) | (value << shift);
 
#define MetaNumBytes   sizeof(UAVObjMetadata)
 
#define MetaBaseObjectPtr(obj)   ((struct UAVOData *)((obj)-offsetof(struct UAVOData, metaObj)))
 
#define MetaObjectPtr(obj)   (&((obj)->metaObj.base))
 
#define MetaDataPtr(obj)   ((UAVObjMetadata*)&((obj)->instance0))
 
#define LinkedMetaDataPtr(obj)   ((UAVObjMetadata*)&((obj)->metaObj.instance0))
 
#define MetaObjectId(id)   ((id)+1)
 
#define ObjSingleInstanceDataOffset(obj)   ((void*)(&(( (struct UAVOSingle*)obj )->instance0)))
 
#define InstanceDataOffset(inst)   ((void*)&(( (struct UAVOMultiInst*)inst )->instance))
 
#define InstanceData(instance)   (void*)instance
 
#define UAVO_CB_STACK_SIZE   512
 
#define INSTANCE_COPY_ALL   0xffffffff
 
#define invokeCallback   realInvokeCallback
 

Typedefs

typedef void * InstanceHandle
 

Functions

struct UAVOBase __attribute__ ((packed))
 
static int32_t sendEvent (struct UAVOBase *obj, uint16_t instId, UAVObjEventType event, void *obj_data, int len)
 
static InstanceHandle createInstance (struct UAVOData *obj, uint16_t instId)
 
static InstanceHandle getInstance (struct UAVOData *obj, uint16_t instId)
 
static int32_t connectObj (UAVObjHandle obj_handle, struct pios_queue *queue, UAVObjEventCallback cb, void *cbCtx, uint8_t eventMask, uint16_t interval)
 
static int32_t disconnectObj (UAVObjHandle obj_handle, struct pios_queue *queue, UAVObjEventCallback cb, void *cbCtx)
 
int32_t UAVObjInitialize ()
 
void UAVObjGetStats (UAVObjStats *statsOut)
 
void UAVObjClearStats ()
 
static void UAVObjInitMetaData (struct UAVOMeta *obj_meta)
 
static struct UAVODataUAVObjAllocSingle (uint32_t num_bytes)
 
static struct UAVODataUAVObjAllocMulti (uint32_t num_bytes)
 
UAVObjHandle UAVObjRegister (uint32_t id, int32_t isSingleInstance, int32_t isSettings, uint32_t num_bytes, UAVObjInitializeCallback initCb)
 
UAVObjHandle UAVObjGetByID (uint32_t id)
 
uint32_t UAVObjGetID (UAVObjHandle obj_handle)
 
uint32_t UAVObjGetNumBytes (UAVObjHandle obj)
 
UAVObjHandle UAVObjGetLinkedObj (UAVObjHandle obj_handle)
 
uint16_t UAVObjGetNumInstances (UAVObjHandle obj_handle)
 
uint16_t UAVObjCreateInstance (UAVObjHandle obj_handle, UAVObjInitializeCallback initCb)
 
bool UAVObjIsSingleInstance (UAVObjHandle obj_handle)
 
bool UAVObjIsMetaobject (UAVObjHandle obj_handle)
 
bool UAVObjIsSettings (UAVObjHandle obj_handle)
 
int32_t UAVObjUnpack (UAVObjHandle obj_handle, uint16_t instId, const uint8_t *dataIn)
 
int32_t UAVObjPack (UAVObjHandle obj_handle, uint16_t instId, uint8_t *dataOut)
 
int32_t UAVObjSave (UAVObjHandle obj_handle, uint16_t instId)
 
int32_t UAVObjLoad (UAVObjHandle obj_handle, uint16_t instId)
 
int32_t UAVObjDeleteById (uint32_t obj_id, uint16_t inst_id)
 
int32_t UAVObjSaveSettings ()
 
int32_t UAVObjLoadSettings ()
 
int32_t UAVObjDeleteSettings ()
 
int32_t UAVObjSaveMetaobjects ()
 
int32_t UAVObjLoadMetaobjects ()
 
int32_t UAVObjDeleteMetaobjects ()
 
int32_t UAVObjSetData (UAVObjHandle obj_handle, const void *dataIn)
 
int32_t UAVObjSetDataField (UAVObjHandle obj_handle, const void *dataIn, uint32_t offset, uint32_t size)
 
int32_t UAVObjGetData (UAVObjHandle obj_handle, void *dataOut)
 
int32_t UAVObjGetDataField (UAVObjHandle obj_handle, void *dataOut, uint32_t offset, uint32_t size)
 
int32_t UAVObjSetInstanceData (UAVObjHandle obj_handle, uint16_t instId, const void *dataIn)
 
int32_t UAVObjSetInstanceDataField (UAVObjHandle obj_handle, uint16_t instId, const void *dataIn, uint32_t offset, uint32_t size)
 
int32_t UAVObjGetInstanceData (UAVObjHandle obj_handle, uint16_t instId, void *dataOut)
 
int32_t UAVObjGetInstanceDataField (UAVObjHandle obj_handle, uint16_t instId, void *dataOut, uint32_t offset, uint32_t size)
 
int32_t UAVObjSetMetadata (UAVObjHandle obj_handle, const UAVObjMetadata *dataIn)
 
int32_t UAVObjGetMetadata (UAVObjHandle obj_handle, UAVObjMetadata *dataOut)
 
UAVObjAccessType UAVObjGetAccess (const UAVObjMetadata *metadata)
 
void UAVObjSetAccess (UAVObjMetadata *metadata, UAVObjAccessType mode)
 
UAVObjAccessType UAVObjGetGcsAccess (const UAVObjMetadata *metadata)
 
void UAVObjSetGcsAccess (UAVObjMetadata *metadata, UAVObjAccessType mode)
 
uint8_t UAVObjGetTelemetryAcked (const UAVObjMetadata *metadata)
 
void UAVObjSetTelemetryAcked (UAVObjMetadata *metadata, uint8_t val)
 
uint8_t UAVObjGetGcsTelemetryAcked (const UAVObjMetadata *metadata)
 
void UAVObjSetGcsTelemetryAcked (UAVObjMetadata *metadata, uint8_t val)
 
UAVObjUpdateMode UAVObjGetTelemetryUpdateMode (const UAVObjMetadata *metadata)
 
void UAVObjSetTelemetryUpdateMode (UAVObjMetadata *metadata, UAVObjUpdateMode val)
 
UAVObjUpdateMode UAVObjGetGcsTelemetryUpdateMode (const UAVObjMetadata *metadata)
 
void UAVObjSetGcsTelemetryUpdateMode (UAVObjMetadata *metadata, UAVObjUpdateMode val)
 
int8_t UAVObjReadOnly (UAVObjHandle obj_handle)
 
int32_t UAVObjConnectQueueThrottled (UAVObjHandle obj_handle, struct pios_queue *queue, uint8_t eventMask, uint16_t interval)
 
int32_t UAVObjConnectQueue (UAVObjHandle obj_handle, struct pios_queue *queue, uint8_t eventMask)
 
int32_t UAVObjDisconnectQueue (UAVObjHandle obj_handle, struct pios_queue *queue)
 
void UAVObjCbSetFlag (const UAVObjEvent *objEv, void *ctx, void *obj, int len)
 
void UAVObjCbCopyData (const UAVObjEvent *objEv, void *ctx, void *obj, int len)
 
int32_t UAVObjConnectCallbackThrottled (UAVObjHandle obj_handle, UAVObjEventCallback cb, void *cbCtx, uint8_t eventMask, uint16_t interval)
 
int32_t UAVObjConnectCallback (UAVObjHandle obj_handle, UAVObjEventCallback cb, void *cbCtx, uint8_t eventMask)
 
int32_t UAVObjDisconnectCallback (UAVObjHandle obj_handle, UAVObjEventCallback cb, void *cbCtx)
 
void UAVObjUpdated (UAVObjHandle obj_handle)
 
void UAVObjInstanceUpdated (UAVObjHandle obj_handle, uint16_t instId)
 
void UAVObjIterate (void(*iterator)(UAVObjHandle obj))
 
static void __attribute__ ((used))
 
static int32_t pumpOneEvent (UAVObjEvent *msg, void *obj_data, int len)
 
int32_t getEventMask (UAVObjHandle obj_handle, struct pios_queue *queue)
 
uint8_t UAVObjCount ()
 
uint32_t UAVObjIDByIndex (uint8_t index)
 
void UAVObjUnblockThrottle (struct ObjectEventEntryThrottled *throttled)
 
void UAVObjRegisterNewInstanceCB (new_uavo_instance_cb_t callback)
 

Variables

uintptr_t pios_uavo_settings_fs_id
 
struct ObjectEventEntrynext_event
 
struct UAVOInfo flags
 
struct UAVOBase base
 
UAVObjMetadata instance0
 
uint32_t id
 
struct UAVOMeta metaObj
 
struct UAVODatanext
 
uint16_t instance_size
 
struct UAVOData uavo
 
uint8_t instance []
 
uint16_t num_instances
 
static struct UAVODatauavo_list
 
static struct ObjectEventEntryevents_unused
 
static struct ObjectEventEntryevents_unused_throttled
 
static struct
pios_recursive_mutex
mutex
 
static const UAVObjMetadata defMetadata
 
static UAVObjStats stats
 
static new_uavo_instance_cb_t newUavObjInstanceCB
 
static void * cb_stack
 

Detailed Description

Object manager library. This library holds a collection of all objects. It can be used by all modules/libraries to find an object reference.

Author
The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
Tau Labs, http://taulabs.org, Copyright (C) 2012-2014
dRonin, http://dronin.org Copyright (C) 2015-2016
See Also
The GNU Public License (GPL) Version 3

Definition in file uavobjectmanager.c.

Variable Documentation

struct UAVOBase base

Definition at line 61 of file uavobjectmanager.c.

struct UAVOInfo flags
uint32_t id

Definition at line 62 of file uavobjectmanager.c.

uint8_t instance[]

Definition at line 62 of file uavobjectmanager.c.

struct UAVOMultiInst instance0

Definition at line 62 of file uavobjectmanager.c.

uint16_t instance_size

Definition at line 69 of file uavobjectmanager.c.

struct UAVOMeta metaObj

Definition at line 67 of file uavobjectmanager.c.

struct UAVOMultiInst * next

Definition at line 68 of file uavobjectmanager.c.

struct ObjectEventEntry* next_event

Definition at line 62 of file uavobjectmanager.c.

uint16_t num_instances

Definition at line 63 of file uavobjectmanager.c.

struct UAVOData uavo

Definition at line 61 of file uavobjectmanager.c.