#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Go to the source code of this file.
|
#define | UPDATE(item_) ((item_)->updateable->update(item_)) |
|
#define | STATUS(item_) ((item_).updateable.status(&item_.updateable)) |
|
#define | ENABLE(item_) ((item_).updateable.enable(&item_.updateable)) |
|
#define | DISABLE(item_) ((item_).updateable.disable(&item_.updateable)) |
|
#define | MAX_NAME_LENGTH 32 |
|
#define | DISABLED 0 |
|
#define | ENABLED 1 |
|
◆ DISABLE
#define DISABLE |
( |
|
item_ | ) |
((item_).updateable.disable(&item_.updateable)) |
◆ DISABLED
◆ ENABLE
#define ENABLE |
( |
|
item_ | ) |
((item_).updateable.enable(&item_.updateable)) |
◆ ENABLED
◆ MAX_NAME_LENGTH
#define MAX_NAME_LENGTH 32 |
◆ STATUS
#define STATUS |
( |
|
item_ | ) |
((item_).updateable.status(&item_.updateable)) |
◆ UPDATE
#define UPDATE |
( |
|
item_ | ) |
((item_)->updateable->update(item_)) |
◆ Updateable
◆ type
◆ defaultDisable()
◆ defaultEnable()
◆ defaultStatus()
◆ defaultUpdate()
void defaultUpdate |
( |
void * |
self | ) |
|
Default update function for Updateable objects.
- Parameters
-
self | Pointer to the object to update. |
Definition at line 16 of file Updateable.c.
16 {
17 printf("Warning: Calling default Sensor Update Function.\n");
18}
◆ initUpdateable()
void initUpdateable |
( |
Updateable * |
updateable, |
|
|
const char * |
name, |
|
|
int |
hz |
|
) |
| |
Definition at line 6 of file Updateable.c.
6 {
14}
int defaultEnable(struct Updateable *self)
Default enable function for Updateable objects.
int defaultDisable(struct Updateable *self)
Default disable function for Updateable objects.
void defaultUpdate(void *self)
Default update function for Updateable objects.
int defaultStatus(struct Updateable *self)
Default status function for Updateable objects.
void(* update)(void *self)
int(* disable)(struct Updateable *self)
int(* status)(struct Updateable *self)
char name[MAX_NAME_LENGTH]
int(* enable)(struct Updateable *self)
◆ writeDataToFileImplementation()
int writeDataToFileImplementation |
( |
const char * |
filename, |
|
|
void * |
self |
|
) |
| |
Write data to a file.
- Parameters
-
filename | Name of the file to write to. |
self | Pointer to the object whose data is to be written. |
- Returns
- SUCCESS if the data was written, FAILURE otherwise.
Definition at line 34 of file Updateable.c.
34 {
35 FILE* file = fopen(filename, "w");
36 if (!file) {
37 perror("Failed to open file");
39 }
40
41 printf("Writing data to file %s\n", filename);
42
43 fclose(file);
45}