blob: fc6ea2bd536f9c5d62f282719eef0336cfb8aad9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
/**************************************************************************
* @licence app begin@
*
* SPDX-License-Identifier: MPL-2.0
*
* \ingroup SensorsService
* \author Helmut Schmidt <Helmut.3.Schmidt@continental-corporation.com>
*
* \copyright Copyright (C) 2013, XS Embedded GmbH
*
* \license
* This Source Code Form is subject to the terms of the
* Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
* this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* @licence end@
**************************************************************************/
#include "globals.h"
#include "vehicle-data.h"
#include "sns-meta-data.h"
static pthread_mutex_t mutexCb = PTHREAD_MUTEX_INITIALIZER; //protects the callbacks
static pthread_mutex_t mutexData = PTHREAD_MUTEX_INITIALIZER; //protects the data
TVehicleDataConfiguration gVehicleDataConfiguration = {0};
bool iVehicleDataInit()
{
pthread_mutex_lock(&mutexData);
//example vehicle data configuration
gVehicleDataConfiguration.vehicleType = SNS_CAR;
gVehicleDataConfiguration.drivenAxles = SNS_AXLE_FRONT;
gVehicleDataConfiguration.trackWidth = 1.52;
gVehicleDataConfiguration.wheelBase = 2.31;
gVehicleDataConfiguration.validityBits =
VEHICLESTATUS_VEHICLETYPE_VALID |
VEHICLESTATUS_DRIVENAXLES_VALID |
VEHICLESTATUS_TRACKWIDTH_VALID |
VEHICLESTATUS_WHELLBASE_VALID;
pthread_mutex_unlock(&mutexData);
return true;
}
bool iVehicleDataDestroy()
{
return true;
}
bool snsVehicleDataGetConfiguration(TVehicleDataConfiguration* vehicleDataConfiguration)
{
bool retval = false;
if(vehicleDataConfiguration)
{
pthread_mutex_lock(&mutexData);
*vehicleDataConfiguration = gVehicleDataConfiguration;
pthread_mutex_unlock(&mutexData);
retval = true;
}
return retval;
}
|