Skip to content

Commit

Permalink
Merge pull request #46 from Lihis/45-fix-new-fine-types
Browse files Browse the repository at this point in the history
Fix #45, new fine types from SDK v1.12
  • Loading branch information
Lihis authored Jul 13, 2020
2 parents 8eadfcf + d7e4841 commit 6ab9dac
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 16 deletions.
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,16 @@ Valid `Types` are:
2 = AvoidSleeping
3 = WrongWay
4 = SpeedingCamera
5 = Speeding
6 = NoLights
7 = RedSignal
8 = Sleeping
9 = AvoidWeighing
10 = IllegalTrailer
11 = Generic = 11
5 = NoLights
6 = RedSignal
7 = Speeding
8 = AvoidWeighing
9 = IllegalTrailer
10 = AvoidInspection
11 = IllegalBorderCrossing
12 = HardShoulderViolation
13 = DamagedVehicleUsage
14 = Generic
```

If API receives fine with type `Unknown` then create an issue (if does not
Expand Down
17 changes: 10 additions & 7 deletions plugin/include/jobplugin/PluginDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,16 @@ enum class Fine {
AvoidSleeping = 2,
WrongWay = 3,
SpeedingCamera = 4,
Speeding = 5,
NoLights = 6,
RedSignal = 7,
Sleeping = 8,
AvoidWeighing = 9,
IllegalTrailer = 10,
Generic = 11
NoLights = 5,
RedSignal = 6,
Speeding = 7,
AvoidWeighing = 8,
IllegalTrailer = 9,
AvoidInspection = 10,
IllegalBorderCrossing = 11,
HardShoulderViolation = 12,
DamagedVehicleUsage = 13,
Generic = 14
};
MSGPACK_ADD_ENUM(Fine);

Expand Down
8 changes: 8 additions & 0 deletions plugin/src/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,14 @@ Fine Logger::string_to_fine(const std::string &str) {
ret = Fine::AvoidWeighing;
} else if (str == "illegal_trailer") {
ret = Fine::IllegalTrailer;
} else if (str == "avoid_inspection") {
ret = Fine::AvoidInspection;
} else if (str == "illegal_border_crossing") {
ret = Fine::IllegalBorderCrossing;
} else if (str == "hard_shoulder_violation") {
ret = Fine::HardShoulderViolation;
} else if (str == "damaged_vehicle_usage") {
ret = Fine::DamagedVehicleUsage;
} else if (str == "generic") {
ret = Fine::Generic;
}
Expand Down
2 changes: 1 addition & 1 deletion plugin/src/Logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class Logger {
* @param str
* @return Fine - Fine type
*/
Fine string_to_fine(const std::string &str);
static Fine string_to_fine(const std::string &str);

/**
* Websocket server mainloop
Expand Down

0 comments on commit 6ab9dac

Please sign in to comment.