2efffeb4ad70d5bd779fa60d790532c790596389
[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 #ifndef COMMAND_H_
18 #define COMMAND_H_
19
20 /**
21  * @brief Types of commands used in communication.
22  */
23 typedef enum command_type {
24         COMMAND_TYPE_NONE, /** Command doesn't carry any information */
25         COMMAND_TYPE_DRIVE, /** Command carries information about steering included in data.steering. */
26         COMMAND_TYPE_CAMERA /** Command carries information about camera position in data.camera_position. */
27 } command_type_e;
28
29 /**
30  * @brief Structure with info about speed and direction that should be set.
31  */
32 typedef struct __command {
33         command_type_e type; /** Type of command. */
34         union {
35                 struct {
36                         int speed; /** Speed to be set from range [-10000, 10000]. */
37                         int direction; /** Direction to be set from range [-10000, 10000]. */
38                 } steering;
39                 struct {
40                         int camera_elevation; /** Elevation of camera to be set from range [-10000, 10000]. */
41                         int camera_azimuth; /** Azimuth of camera to be set from range [-10000, 10000]. */
42                 } camera_position;
43         } data;
44 } command_s;
45
46 #endif //COMMAND_H_