forked from donaloconnor/automon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvehiclespeed.cpp
51 lines (41 loc) · 2.16 KB
/
vehiclespeed.cpp
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
#include "automon.h"
/*
==================================================================================================
| vehiclespeed.cpp |
| Part of the Automon application. |
| |
| Final Year Project - "An Embedded Automotive Monitoring Device" |
| |
| By Donal O' Connor for completion of B.Sc (Hons) Software Development and Computer Networking |
| Email: [email protected] |
| Website/Blog: http://automon.killarneyonline.eu |
| |
| Cork Institute of Technology, Cork, Ireland - http://www.cit.ie/ |
| |
| Copyright © 2009 Donal O'Connor <[email protected]> |
==================================================================================================
Implementation file of the "Vehicle Speed" Sensor object.
In here we set the Formula, Command, Units, Expected Bytes, Min and Max Values
*/
using namespace AutomonKernel;
VehicleSpeed::VehicleSpeed(QString command, QString englishMeaning)
{
m_command = command;
m_englishMeaning = englishMeaning;
}
VehicleSpeed::VehicleSpeed()
{
m_command = "010D";
m_englishMeaning = "Vehicle Speed";
setUnits(MPH);
setExpectedBytes(1);
setMin(0);
setMax(255);
}
double VehicleSpeed::convertResult()
{
/* This is the conversion formula. It basically returns the value from the bytes retrieved from the ECU */
QList<int> bytes = Automon::getBytes(*this);
double value = (bytes[2]);
return value;
}