2d8ac3c228a7fa71f0c0d75125b14d260611e28b
[apps/native/gear-racing-car.git] / inc / command.h
1 /*
2  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Flora License, Version 1.1 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://floralicense.org/license/
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17
18 /**
19  * @brief Types of commands used in communication.
20  */
21 typedef enum command_type {
22         COMMAND_TYPE_NONE, /** Command doesn't carry any information */
23         COMMAND_TYPE_DRIVE, /** Command carries information about steering included in data.steering. */
24         COMMAND_TYPE_CAMERA /** Command carries information about camera position in data.camera_position. */
25 } command_type_e;
26
27 /**
28  * @brief Structure with info about speed and direction that should be set.
29  */
30 typedef struct __command {
31         command_type_e type; /** Type of command. */
32         union {
33                 struct {
34                         int speed; /** Speed to be set from range [-10000, 10000]. */
35                         int direction; /** Direction to be set from range [-10000, 10000]. */
36                 } steering;
37                 struct {
38                         int camera_elevation; /** Elevation of camera to be set from range [-10000, 10000]. */
39                         int camera_azimuth; /** Azimuth of camera to be set from range [-10000, 10000]. */
40                 } camera_position;
41         } data;
42 } command_s;