2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
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
8 * http://floralicense.org/license/
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.
17 #ifndef __CAR_APP_MESSAGE_H__
18 #define __CAR_APP_MESSAGE_H__
20 typedef enum __message_cmd_e {
21 MESSAGE_CMD_HELLO, /* to use keep alive, if needed */
22 MESSAGE_CMD_CALIBRATION,
24 MESSAGE_CMD_BYE, /* to notify explicitly closing connection */
27 typedef struct __message_type_s message_s;
29 int message_new(message_cmd_e cmd, int servo, int speed, message_s *new_msg);
30 void message_reset_seq_num(void);
32 /* To encapsulate message struction,
33 * we need to discuss about it.
34 * which one is better, hiding its members or direct accessing its members?
36 int message_get_seq_num(message_s *msg, unsigned long long int *seq_num);
37 int message_get_cmd(message_s *msg, message_cmd_e *cmd);
38 int message_get_servo_value(message_s *msg, int *speed);
39 int message_get_servo_value(message_s *msg, int *servo);
41 #endif /* __CAR_APP_MESSAGE_H__ */