diff --git a/src/denm.c b/src/denm.c index b5c1454..2093d3a 100644 --- a/src/denm.c +++ b/src/denm.c @@ -16,30 +16,30 @@ const cc_ssp_bm_t CC_SSP_BM_MAP[] = { - {"trafficCondition", 1, 0x800000}, - {"accident", 2, 0x400000}, - {"roadworks", 3, 0x200000}, - {"adverseWeatherCondition-Adhesion", 6, 0x100000}, - {"hazardousLocation-SurfaceCondition", 9, 0x080000}, - {"hazardousLocation-ObstacleOnTheRoad", 10, 0x040000}, - {"hazardousLocation-AnimalOnTheRoad", 11, 0x020000}, - {"humanPresenceOnTheRoad", 12, 0x010000}, - {"wrongWayDriving", 14, 0x008000}, - {"rescueAndRecoveryWorkInProgress", 15, 0x004000}, - {"adverseWeatherCondition-ExtremeWeatherCondition", 17, 0x002000}, - {"adverseWeatherCondition-Visibility", 18, 0x001000}, - {"adverseWeatherCondition-Precipitation", 19, 0x000800}, - {"slowVehicle", 26, 0x000400}, - {"dangerousEndOfQueue", 27, 0x000200}, - {"vehicleBreakdown", 91, 0x000100}, - {"postCrash", 92, 0x000080}, - {"humanProblem", 93, 0x000040}, - {"stationaryVehicle", 94, 0x000020}, - {"emergencyVehicleApproaching", 95, 0x000010}, - {"hazardousLocation-DangerousCurve", 96, 0x000008}, - {"collisionRisk", 97, 0x000004}, - {"signalViolation", 98, 0x000002}, - {"dangerousSituation", 99, 0x000001}, + {"trafficCondition", 1, 0x80000000}, + {"accident", 2, 0x40000000}, + {"roadworks", 3, 0x20000000}, + {"adverseWeatherCondition-Adhesion", 6, 0x10000000}, + {"hazardousLocation-SurfaceCondition", 9, 0x08000000}, + {"hazardousLocation-ObstacleOnTheRoad", 10, 0x04000000}, + {"hazardousLocation-AnimalOnTheRoad", 11, 0x02000000}, + {"humanPresenceOnTheRoad", 12, 0x01000000}, + {"wrongWayDriving", 14, 0x00800000}, + {"rescueAndRecoveryWorkInProgress", 15, 0x00400000}, + {"adverseWeatherCondition-ExtremeWeatherCondition", 17, 0x00200000}, + {"adverseWeatherCondition-Visibility", 18, 0x00100000}, + {"adverseWeatherCondition-Precipitation", 19, 0x00080000}, + {"slowVehicle", 26, 0x00040000}, + {"dangerousEndOfQueue", 27, 0x00020000}, + {"vehicleBreakdown", 91, 0x00010000}, + {"postCrash", 92, 0x00008000}, + {"humanProblem", 93, 0x00004000}, + {"stationaryVehicle", 94, 0x00002000}, + {"emergencyVehicleApproaching", 95, 0x00001000}, + {"hazardousLocation-DangerousCurve", 96, 0x00000800}, + {"collisionRisk", 97, 0x00000400}, + {"signalViolation", 98, 0x00000200}, + {"dangerousSituation", 99, 0x00000100}, }; static int permissions_check(int cause_code, uint8_t* permissions, uint8_t permissions_len) { @@ -52,6 +52,8 @@ static int permissions_check(int cause_code, uint8_t* permissions, uint8_t permi * 3-40 | Reserved */ + syslog_err("cause_CODE %d", cause_code); + if (permissions_len < 4) { syslog_debug("[facilities] [den] permissions length too small"); return 0; @@ -63,6 +65,11 @@ static int permissions_check(int cause_code, uint8_t* permissions, uint8_t permi for (int i = 0; i < 24; ++i) { if (cause_code == CC_SSP_BM_MAP[i].cause_code) { perm_val = CC_SSP_BM_MAP[i].bitmap_val; + perm_val = ((perm_val>>24) & 0xff) | + ((perm_val<<8) & 0xff0000) | + ((perm_val>>8) & 0xff00) | + ((perm_val<<24) & 0xff000000); + break; } } diff --git a/src/infrastructure.c b/src/infrastructure.c index da12f69..7288946 100644 --- a/src/infrastructure.c +++ b/src/infrastructure.c @@ -52,6 +52,8 @@ static int permissions_check(int diid, uint8_t* permissions, uint8_t permissions for (int i = 0; i < 13; ++i) { if (diid == DIID_SSP_BM_MAP[i].diid) { perm_val = DIID_SSP_BM_MAP[i].bitmap_val; + perm_val = (perm_val>>8) | (perm_val<<8); + break; } }