move to obsolete dir old code
[apps/low-level-can-service.git] / can-signals.h
1 /*
2  * Copyright (C) 2015, 2016 "IoT.bzh"
3  * Author "Romain Forlot" <romain.forlot@iot.bzh>
4  *
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
8  *
9  *   http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  */
17
18 #pragma once
19
20 #include "can-utils.h"
21
22 /** Public: Return the currently active CAN configuration. */
23 CanMessageSet* getActiveMessageSet();
24
25 /** Public: Retrive a list of all possible CAN configurations.
26  *  *
27  *   * Returns a pointer to an array of all configurations.
28  *    */
29 CanMessageSet* getMessageSets();
30
31 /** Public: Return the length of the array returned by getMessageSets() */
32 int getMessageSetCount();
33
34 /* Public: Return the number of CAN buses configured in the active
35  *  * configuration. This is limited to 2, as the hardware controller only has 2
36  *   * CAN channels.
37  *    */
38 int getCanBusCount();
39
40 /* Public: Return an array of all CAN messages to be processed in the active
41  *  * configuration.
42  *   */
43 CanMessageDefinition* getMessages();
44
45 /* Public: Return an array of all CAN signals to be processed in the active
46  * configuration.
47  */
48 CanSignal* getSignals();
49
50 /* Public: Return an array of all OpenXC CAN commands enabled in the active
51  *  * configuration that can write back to CAN with a custom handler.
52  *   *
53  *    * Commands not defined here are handled using a 1-1 mapping from the signals
54  *     * list.
55  *      */
56 CanCommand* getCommands();
57
58 /* Public: Return the length of the array returned by getCommandCount(). */
59 int getCommandCount();
60
61 /* Public: Return the length of the array returned by getSignals(). */
62 int getSignalCount();
63
64 /* Public: Return the length of the array returned by getMessages(). */
65 int getMessageCount();
66
67 /* Public: Return an array of the metadata for the 2 CAN buses you want to
68  *  * monitor. The size of this array is fixed at 2.
69  *   */
70 CanBus* getCanBuses();
71
72 /* Public: Decode CAN signals from raw CAN messages, translate from engineering
73  *  * units to something more human readable, and send the resulting value over USB
74  *   * as an OpenXC-style JSON message.
75  *    *
76  *     * This is the main workhorse function of the VI. Every time a new
77  *      * CAN message is received that matches one of the signals in the list returend
78  *       * by getSignals(), this function is called with the message ID and 64-bit data
79  *        * field.
80  *         *
81  *          * bus - The CAN bus this message was received on.
82  *           * message - The received CAN message.
83  *            */
84 void decodeCanMessage(openxc::pipeline::Pipeline* pipeline, CanBus* bus, CanMessage* message);