vcm: speed set through epv
This commit is contained in:
parent
582f72c24a
commit
4c551d60b0
26
src/vcm.c
26
src/vcm.c
|
|
@ -1,6 +1,7 @@
|
|||
#include "vcm.h"
|
||||
#include "facilities.h"
|
||||
|
||||
#include <it2s-gnss.h>
|
||||
#include <it2s-tender/epv.h>
|
||||
#include <it2s-tender/space.h>
|
||||
#include <it2s-tender/geodesy.h>
|
||||
|
|
@ -8,7 +9,6 @@
|
|||
#include <it2s-tender/packet.h>
|
||||
#include <it2s-asn/etsi-its-sdu/itss-networking/EIS_NetworkingRequest.h>
|
||||
#include <it2s-asn/etsi-its-sdu/itss-facilities/EIS_FacilitiesIndication.h>
|
||||
#include <it2s-asn/etsi-its-sdu/itss-management/EIS_ManagementRequest.h>
|
||||
#include <it2s-asn/etsi-its-v1/vcm/EI1_VCM.h>
|
||||
|
||||
#include <tgmath.h>
|
||||
|
|
@ -479,24 +479,12 @@ static int vcm_check_handle_request(EI1_VCM_t* vcm, mc_neighbour_s* neighbour) {
|
|||
);
|
||||
free(trj);
|
||||
|
||||
EIS_ManagementRequest_t* mreq = calloc(1, sizeof(EIS_ManagementRequest_t));
|
||||
mreq->present = EIS_ManagementRequest_PR_attributes;
|
||||
mreq->choice.attributes.present = EIS_ManagementRequestAttributes_PR_set;
|
||||
mreq->choice.attributes.choice.set.speed = calloc(1, sizeof(EIS_ManagementSpeedSet_t));
|
||||
EIS_ManagementSpeedSet_t* mgss = mreq->choice.attributes.choice.set.speed;
|
||||
mgss->rate = 5; /* km/h/s */
|
||||
mgss->temporary = true; /* go back to original speed after a while */
|
||||
mgss->type.present = EIS_ManagementSpeedSetType_PR_diff; /* differential change set */
|
||||
mgss->type.choice.diff = (dreq > dego) ? 10 : -10; /* % */
|
||||
asn_enc_rval_t enc = asn_encode_to_buffer(NULL, ATS_CANONICAL_OER, &asn_DEF_EIS_ManagementRequest, mreq, buf1, buf_len);
|
||||
if (enc.encoded == -1) {
|
||||
log_error("[vc] failed to encode MReq.speedSet (%s)", enc.failed_type->name);
|
||||
}
|
||||
itss_0send(coordination->mgmt_socket, buf1, enc.encoded);
|
||||
if (itss_0recv_rt(&coordination->mgmt_socket, buf2, buf_len, buf1, enc.encoded, 500) == -1) {
|
||||
log_error("[vc]-> MReq.speedSet ->[management] <TIMEOUT>");
|
||||
}
|
||||
ASN_STRUCT_FREE(asn_DEF_EIS_ManagementRequest, mreq);
|
||||
itss_space_lock();
|
||||
it2s_gnss_reqset_t reqset = {0};
|
||||
reqset.speed.value = epv.space.data.speed.value + (dreq > dego ? 360 : -360) ; /* +- 10 km/h */
|
||||
reqset.speed.present = 1;
|
||||
itss_space_set(&reqset);
|
||||
itss_space_unlock();
|
||||
|
||||
// Respond
|
||||
EI1_VCM_t* vcm_rep = NULL;
|
||||
|
|
|
|||
Loading…
Reference in New Issue