2 * Copyright (C) 2015, 2016 "IoT.bzh"
3 * Author "Romain Forlot" <romain.forlot@iot.bzh>
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
19 * Interface between the daemon and the binding
21 static const struct afb_binding_interface *interface;
24 * the type of position expected
26 * here, this type is the selection of protocol
31 type_DEFAULT = type_CAN,
35 #define type_size sizeof(enum type)-2
40 static const char * const type_NAMES[type_size] = {
45 /* CAN variable initialization */
46 struct canfd_frame canfd_frame;
52 struct sockaddr_can txAddress;
56 * each generated event
58 typedef struct _event event;
60 event *next; /* link for the next event */
61 const char *name; /* name of the event */
62 struct afb_event afb_event; /* the event for the binder */
63 openxc_CanMessage can_message; /* value for the can_message */
67 * each can event, will browse by the id
69 typedef struct _can_event can_event;
71 can_event *next; /* Link to the next other can message */
72 event *events; /* events for the can message */
73 uint32_t id; /* id of the event for unsubscribe */
74 enum type type; /* the type of data expected */
77 can_event *can_events_list;
79 // Initialize default can_handler values
80 static struct can_handler can_handler = {
83 .is_fdmode_on = false,
86 /* Redefining openxc_CanMessage_init_default for C */
87 #ifdef openxc_CanMessage_init_default
88 #undef openxc_CanMessage_init_default
90 openxc_CanMessage openxc_CanMessage_init_default = {.has_bus = false, .bus = 0, .has_id = false, .id = 0, .has_data = false, .data = {0, {0}}, .has_frame_format = false, .frame_format = (openxc_CanMessage_FrameFormat)0};