mm_devices.h 1.4 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef __MM_DEVICES_H_
#define __MM_DEVICES_H_

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
#include "mm_controller/mm_api.h"
#include "mm_controller/mm_utils.h"

typedef struct
{
    uint32_t distance_mm;
} MarvelmindDevDistance;

typedef struct
{
    MarvelmindDeviceInfo info;
    MarvelmindDeviceVersion version;

    bool devConnected;
    MMDeviceType deviceType;

#if MM_LOCATIONS_VERSION == 1
    MarvelmindDeviceLocation pos;
#endif // MM_LOCATIONS_VERSION

#if MM_LOCATIONS_VERSION == 2
    MarvelmindDeviceLocation2 pos;
#endif // MM_LOCATIONS_VERSION

    MarvelmindDevDistance distances[MM_MAX_DEVICES_COUNT];
} MarvelmindDevice;

// Read Marvelmind devices list from modem
void marvelmindDevicesReadIfNeeded(); //Move to node

// Get device data structure
MarvelmindDevice *getMarvelmindDevice(uint8_t address);

#if MM_LOCATIONS_VERSION == 1
// Update device location
MarvelmindDevice *marvelmindUpdateLocation(uint8_t address, MarvelmindDeviceLocation *ppos);
#endif

#if MM_LOCATIONS_VERSION == 2
// Update device location
MarvelmindDevice *marvelmindUpdateLocation(uint8_t address, MarvelmindDeviceLocation2 *ppos);
#endif

// Update distance to device
MarvelmindDevice *marvelmindUpdateDistance(uint8_t addressRx, uint8_t addressTx, uint32_t d);

// Initialize structure of Marvelmind devices
void initMarvelmindDevicesList(); //move to node

#endif // __MARVELMIND_DEVICES_H_