Developer World
Spresense SDK Library v3.2.0-ebc0364
sensor_command.h
Go to the documentation of this file.
1/****************************************************************************
2 * modules/include/sensing/logical_sensor/sensor_command.h
3 *
4 * Copyright 2018 Sony Semiconductor Solutions Corporation
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 * 3. Neither the name of Sony Semiconductor Solutions Corporation nor
17 * the names of its contributors may be used to endorse or promote
18 * products derived from this software without specific prior written
19 * permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *
34 ****************************************************************************/
35
36#ifndef __INCLUDE_SENSING_SENSOR_COMMAND_H
37#define __INCLUDE_SENSING_SENSOR_COMMAND_H
38
44/****************************************************************************
45 * Included Files
46 ****************************************************************************/
47
48#include <stdint.h>
49
55
56#ifdef __cplusplus
57extern "C" {
58#endif /* __cplusplus */
59
60/****************************************************************************
61 * Public Types
62 ****************************************************************************/
63
68typedef enum
69{
76
77/*--------------------------------------------------------------------------*/
82typedef enum
83{
92
93/*--------------------------------------------------------------------------*/
98typedef enum
99{
107
108/*--------------------------------------------------------------------------*/
113typedef enum {
119
120/*--------------------------------------------------------------------------*/
125typedef struct
126{
127 uint8_t context_id;
128 uint8_t event_type;
132 uint8_t sensor_type;
136 uint8_t reserved;
138
139/****************************************************************************
140 * Inline Functions
141 ****************************************************************************/
142
143inline bool is_async_msg(uint32_t data)
144{
145 return ((data & 0x80000000) != 0) ? true : false;
146}
147
148inline uint8_t get_async_msgtype(uint32_t param)
149{
150 return static_cast<uint8_t>((param & 0x0000FF00) >> 8);
151}
152
153inline uint8_t get_async_msgparam(uint32_t param)
154{
155 return static_cast<uint8_t>(param & 0x000000FF);
156}
157
158inline uint32_t make_async_msg(uint8_t type, uint8_t param)
159{
160 return (type << 8) | param;
161}
162
163#ifdef __cplusplus
164};
165#endif
166
171#endif /* __INCLUDE_SENSING_SENSOR_COMMAND_H */
SensorEventType
codes of command events.
Definition: sensor_command.h:69
SensorExecResult
results.
Definition: sensor_command.h:113
SensorType
codes of command logical sensor types.
Definition: sensor_command.h:99
SensorProcessMode
codes of command logical sensor modes.
Definition: sensor_command.h:83
@ InitEvent
Definition: sensor_command.h:71
@ FlushEvent
Definition: sensor_command.h:73
@ InvalidSensorEvent
Definition: sensor_command.h:70
@ SensorEventTypeNum
Definition: sensor_command.h:74
@ ExecEvent
Definition: sensor_command.h:72
@ SensorError
Definition: sensor_command.h:115
@ SensorOK
Definition: sensor_command.h:114
@ SensorResultData
Definition: sensor_command.h:117
@ SensorWarning
Definition: sensor_command.h:116
@ StepCounter
Definition: sensor_command.h:101
@ InvalidSensorType
Definition: sensor_command.h:100
@ TransportationModeLite
Definition: sensor_command.h:105
@ TransportationMode
Definition: sensor_command.h:104
@ Compass
Definition: sensor_command.h:103
@ ArmGesture
Definition: sensor_command.h:102
@ GestureProcMode
Definition: sensor_command.h:87
@ TramProcMode
Definition: sensor_command.h:89
@ CompassProcMode
Definition: sensor_command.h:88
@ CommonMode
Definition: sensor_command.h:85
@ StepCounterMode
Definition: sensor_command.h:86
@ TramliteProcMode
Definition: sensor_command.h:90
@ InvalidSensorProcessMode
Definition: sensor_command.h:84
the header of sensor commands.
Definition: sensor_command.h:126
uint8_t sensor_type
Definition: sensor_command.h:132
uint8_t event_type
Definition: sensor_command.h:128