Statistics
| Branch: | Tag: | Revision:

mongoose / examples / PIC32 / mqtt_client / firmware / src / app.h @ eaef5bd1

History | View | Annotate | Download (2.55 KB)

1
/*
2
 * Copyright (c) 2016 Cesanta Software Limited
3
 * All rights reserved
4
 */
5

    
6
#ifndef _APP_H
7
#define _APP_H
8

    
9
#include <stdint.h>
10
#include <stdbool.h>
11
#include <stddef.h>
12
#include <stdlib.h>
13
#include "system_config.h"
14
#include "system_definitions.h"
15
#include "simplelink.h"
16

    
17
#ifdef __cplusplus
18

    
19
extern "C" {
20

    
21
#endif
22
/* Application states
23

24
  Summary:
25
    Application states enumeration
26

27
  Description:
28
    This enumeration defines the valid application states.  These states
29
    determine the behavior of the application at various times.
30
*/
31

    
32
typedef enum {
33
  APP_STATE_INIT = 0,
34
  APP_STATE_SERVICE_TASKS,
35
  APP_STATE_CONNECT_BROKER,
36
  APP_STATE_DONE
37
} APP_STATES;
38

    
39
// *****************************************************************************
40
/* Application Data
41

42
  Summary:
43
    Holds application data
44

45
  Description:
46
    This structure holds the application's data.
47

48
  Remarks:
49
    Application strings and buffers are be defined outside this structure.
50
 */
51

    
52
typedef struct {
53
  /* The application's current state */
54
  APP_STATES state;
55
} APP_DATA;
56

    
57
/*******************************************************************************
58
  Function:
59
    void APP_Initialize ( void )
60

61
  Summary:
62
     MPLAB Harmony application initialization routine.
63

64
  Description:
65
    This function initializes the Harmony application.  It places the
66
    application in its initial state and prepares it to run so that its
67
    APP_Tasks function can be called.
68

69
  Precondition:
70
    All other system initialization routines should be called before calling
71
    this routine (in "SYS_Initialize").
72

73
  Parameters:
74
    None.
75

76
  Returns:
77
    None.
78

79
  Example:
80
    <code>
81
    APP_Initialize();
82
    </code>
83

84
  Remarks:
85
    This routine must be called from the SYS_Initialize function.
86
*/
87

    
88
void APP_Initialize(void);
89

    
90
/*******************************************************************************
91
  Function:
92
    void APP_Tasks ( void )
93

94
  Summary:
95
    MPLAB Harmony Demo application tasks function
96

97
  Description:
98
    This routine is the Harmony Demo application's tasks function.  It
99
    defines the application's state machine and core logic.
100

101
  Precondition:
102
    The system and application initialization ("SYS_Initialize") should be
103
    called before calling this.
104

105
  Parameters:
106
    None.
107

108
  Returns:
109
    None.
110

111
  Example:
112
    <code>
113
    APP_Tasks();
114
    </code>
115

116
  Remarks:
117
    This routine must be called from SYS_Tasks() routine.
118
 */
119

    
120
void APP_Tasks(void);
121

    
122
#ifdef __cplusplus
123
}
124
#endif
125

    
126
#endif /* _APP_H */