DAT290 / kod / Motion_alarm / MotionAlarm_messages.h
MotionAlarm_messages.h
Raw
#pragma once
#include <stdint.h>

// AuxType
typedef enum {
    MOTION_ALARM,
    DOOR_ALARM
} AuxType;


// Sensor
typedef enum {
    DISTANCE,
    VIBRATION
} SensorType;

typedef struct {
    SensorType sensorType : 1;
    uint8_t sensorId : 7;
} Sensor;



// Activate / deactivate alarm
typedef struct {
    Sensor sensor; // 0xff for all
} AuxActivateRequest;

typedef struct {
    Sensor sensor; // 0xff for all
} AuxDeactivateRequest;


// AuxConfig
typedef struct {
    Sensor sensor; // 0xff for all
    uint16_t sensitivity;
    uint16_t calibration;
} AuxConfigRequest;


// AuxInfo
typedef struct {
    Sensor sensor;
} AuxInfoRequest;

typedef struct {
    uint16_t sensitivity;
    uint16_t calibration;
    uint16_t currentValue;
} AuxInfoResponse;