Added new class in command.h file
[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_DRIVE_AND_CAMERA /** Command carries information about both camera position and steering in data.steering_and_camera. */
28 } command_type_e;
29
30 /**
31  * @brief Structure with info about speed and direction that should be set.
32  */
33 typedef struct __command {
34         command_type_e type; /** Type of command. */
35         union {
36                 struct {
37                         int speed; /** Speed to be set from range [-10000, 10000]. */
38                         int direction; /** Direction to be set from range [-10000, 10000]. */
39                 } steering;
40                 struct {
41                         int camera_elevation; /** Elevation of camera to be set from range [-10000, 10000]. */
42                         int camera_azimuth; /** Azimuth of camera to be set from range [-10000, 10000]. */
43                 } camera_position;
44                 struct {
45                         int speed; /** Speed to be set from range [-10000, 10000]. */
46                         int direction; /** Direction to be set from range [-10000, 10000]. */
47                         int camera_elevation; /** Elevation of camera to be set from range [-10000, 10000]. */
48                         int camera_azimuth; /** Azimuth of camera to be set from range [-10000, 10000]. */
49                 } steering_and_camera;
50         } data;
51 } command_s;
52
53 #endif //COMMAND_H_