Tolling payment min period
This commit is contained in:
parent
eea1f89a55
commit
ddd0f012b7
|
|
@ -6,6 +6,13 @@
|
|||
typedef struct coordination {
|
||||
bool active;
|
||||
|
||||
|
||||
struct {
|
||||
bool intersecting;
|
||||
uint64_t t_negotiation;
|
||||
|
||||
} neighbours;
|
||||
|
||||
} coordination_s;
|
||||
|
||||
int dcm_check(void* fc, DCM_t* dcm);
|
||||
|
|
|
|||
|
|
@ -340,6 +340,8 @@ void *sa_service(void *fc) {
|
|||
lon = facilities->epv.space.longitude;
|
||||
it2s_tender_unlock_space(&facilities->epv);
|
||||
|
||||
uint64_t now = it2s_tender_get_clock(&facilities->epv);
|
||||
|
||||
pthread_mutex_lock(&bulletin->lock);
|
||||
for (int a = 0; a < bulletin->to_consume_len; ++a) {
|
||||
/* do some checks, e.g.
|
||||
|
|
@ -349,7 +351,7 @@ void *sa_service(void *fc) {
|
|||
// Tolling
|
||||
if (facilities->tolling.enabled &&
|
||||
bulletin->to_consume[a]->its_aid == 0 &&
|
||||
!bulletin->to_consume[a]->n_trigger &&
|
||||
now > bulletin->to_consume[a]->t_trigger + TOLLING_PAYMENT_MIN_PERIOD_MS &&
|
||||
facilities->station_type != 15) {
|
||||
|
||||
if (!tpm_is_inside_zone(facilities, (tolling_info_s*) bulletin->to_consume[a]->info.internal_p)) {
|
||||
|
|
@ -360,6 +362,7 @@ void *sa_service(void *fc) {
|
|||
case TOLLING_PROTOCOL_SIMPLE:
|
||||
tpm_pay(facilities, bulletin->to_consume[a]->certificate_id);
|
||||
++bulletin->to_consume[a]->n_trigger;
|
||||
bulletin->to_consume[a]->t_trigger = now;
|
||||
break;
|
||||
|
||||
case TOLLING_PROTOCOL_TLS:;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,8 @@ typedef struct announcement {
|
|||
uint64_t station_id;
|
||||
uint64_t timestamp;
|
||||
|
||||
uint32_t n_trigger;
|
||||
uint32_t n_trigger; /* number of times service was triggered */
|
||||
uint64_t t_trigger; /* last trigger timestamp */
|
||||
} announcement_t;
|
||||
|
||||
typedef struct bulletin {
|
||||
|
|
|
|||
Loading…
Reference in New Issue