PCM efforts
This commit is contained in:
parent
1ee84d7456
commit
7558d0c0d2
36
src/pcm.c
36
src/pcm.c
|
|
@ -132,6 +132,7 @@ static int pcm_check_handle_request(facilities_t* facilities, PCM_t* pcm, mc_nei
|
||||||
mvc->negotiation->choice.reply.acceptedTrajectoriesIds.list.array = malloc(1*sizeof(void*));
|
mvc->negotiation->choice.reply.acceptedTrajectoriesIds.list.array = malloc(1*sizeof(void*));
|
||||||
mvc->negotiation->choice.reply.acceptedTrajectoriesIds.list.array[0] = malloc(sizeof(long));
|
mvc->negotiation->choice.reply.acceptedTrajectoriesIds.list.array[0] = malloc(sizeof(long));
|
||||||
*mvc->negotiation->choice.reply.acceptedTrajectoriesIds.list.array[0] = pt->id;
|
*mvc->negotiation->choice.reply.acceptedTrajectoriesIds.list.array[0] = pt->id;
|
||||||
|
mvc->negotiation->choice.reply.requesterId = pcm->header.stationID;
|
||||||
|
|
||||||
asn_enc_rval_t enc = uper_encode_to_buffer(&asn_DEF_PCM, NULL, pcm_rep, buf, buf_len);
|
asn_enc_rval_t enc = uper_encode_to_buffer(&asn_DEF_PCM, NULL, pcm_rep, buf, buf_len);
|
||||||
if (enc.encoded == -1) {
|
if (enc.encoded == -1) {
|
||||||
|
|
@ -171,7 +172,7 @@ static int pcm_check_handle_request(facilities_t* facilities, PCM_t* pcm, mc_nei
|
||||||
fi = calloc(1, sizeof(FacilitiesIndication_t));
|
fi = calloc(1, sizeof(FacilitiesIndication_t));
|
||||||
fi->present = FacilitiesIndication_PR_message;
|
fi->present = FacilitiesIndication_PR_message;
|
||||||
fi->choice.message.id = bpr->id;
|
fi->choice.message.id = bpr->id;
|
||||||
fi->choice.message.itsMessageType = 43;
|
fi->choice.message.itsMessageType = 2043;
|
||||||
fi->choice.message.data.size = bpr->data.size;
|
fi->choice.message.data.size = bpr->data.size;
|
||||||
fi->choice.message.data.buf = malloc(bpr->data.size);
|
fi->choice.message.data.buf = malloc(bpr->data.size);
|
||||||
memcpy(fi->choice.message.data.buf, bpr->data.buf, bpr->data.size);
|
memcpy(fi->choice.message.data.buf, bpr->data.buf, bpr->data.size);
|
||||||
|
|
@ -329,6 +330,7 @@ static int pcm_check_intersection_detected(facilities_t* facilities, PCM_t* pcm,
|
||||||
mvc->negotiation->choice.request.desiredTrajectories.list.array = malloc(1*sizeof(void*));
|
mvc->negotiation->choice.request.desiredTrajectories.list.array = malloc(1*sizeof(void*));
|
||||||
mvc->negotiation->choice.request.desiredTrajectories.list.array[0] = calloc(1,sizeof(ProposedTrajectory_t));
|
mvc->negotiation->choice.request.desiredTrajectories.list.array[0] = calloc(1,sizeof(ProposedTrajectory_t));
|
||||||
ProposedTrajectory_t* pt = mvc->negotiation->choice.request.desiredTrajectories.list.array[0];
|
ProposedTrajectory_t* pt = mvc->negotiation->choice.request.desiredTrajectories.list.array[0];
|
||||||
|
mvc->negotiation->choice.request.requesterId = pcm->header.stationID;
|
||||||
|
|
||||||
pt->trajectory.list.count = trajectoryA_len;
|
pt->trajectory.list.count = trajectoryA_len;
|
||||||
pt->trajectory.list.size = sizeof(void*) * trajectoryA_len;
|
pt->trajectory.list.size = sizeof(void*) * trajectoryA_len;
|
||||||
|
|
@ -382,7 +384,7 @@ static int pcm_check_intersection_detected(facilities_t* facilities, PCM_t* pcm,
|
||||||
fi = calloc(1, sizeof(FacilitiesIndication_t));
|
fi = calloc(1, sizeof(FacilitiesIndication_t));
|
||||||
fi->present = FacilitiesIndication_PR_message;
|
fi->present = FacilitiesIndication_PR_message;
|
||||||
fi->choice.message.id = bpr->id;
|
fi->choice.message.id = bpr->id;
|
||||||
fi->choice.message.itsMessageType = 43;
|
fi->choice.message.itsMessageType = 2043;
|
||||||
fi->choice.message.data.size = bpr->data.size;
|
fi->choice.message.data.size = bpr->data.size;
|
||||||
fi->choice.message.data.buf = malloc(bpr->data.size);
|
fi->choice.message.data.buf = malloc(bpr->data.size);
|
||||||
memcpy(fi->choice.message.data.buf, bpr->data.buf, bpr->data.size);
|
memcpy(fi->choice.message.data.buf, bpr->data.buf, bpr->data.size);
|
||||||
|
|
@ -394,7 +396,6 @@ static int pcm_check_intersection_detected(facilities_t* facilities, PCM_t* pcm,
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
syslog_debug("QUEUE SEND to APP");
|
|
||||||
it2s_tender_queue_send(facilities->tx_queue, buf, enc.encoded+1, ITSS_APPLICATIONS, bpr->id, "FI.message");
|
it2s_tender_queue_send(facilities->tx_queue, buf, enc.encoded+1, ITSS_APPLICATIONS, bpr->id, "FI.message");
|
||||||
|
|
||||||
if (facilities->logging.recorder) {
|
if (facilities->logging.recorder) {
|
||||||
|
|
@ -631,25 +632,25 @@ void* pc_service(void* fc) {
|
||||||
tr->present = TransportRequest_PR_packet;
|
tr->present = TransportRequest_PR_packet;
|
||||||
tr->choice.packet.present = TransportPacketRequest_PR_btp;
|
tr->choice.packet.present = TransportPacketRequest_PR_btp;
|
||||||
BTPPacketRequest_t* bpr = &tr->choice.packet.choice.btp;
|
BTPPacketRequest_t* bpr = &tr->choice.packet.choice.btp;
|
||||||
|
|
||||||
bpr->btpType = BTPType_btpB;
|
bpr->btpType = BTPType_btpB;
|
||||||
|
|
||||||
bpr->gn.destinationAddress.buf = malloc(6);
|
bpr->gn.destinationAddress.buf = malloc(6);
|
||||||
for (int i = 0; i < 6; ++i) {
|
for (int i = 0; i < 6; ++i) {
|
||||||
bpr->gn.destinationAddress.buf[i] = 0xff;
|
bpr->gn.destinationAddress.buf[i] = 0xff;
|
||||||
}
|
}
|
||||||
bpr->gn.destinationAddress.size = 6;
|
bpr->gn.destinationAddress.size = 6;
|
||||||
|
|
||||||
bpr->gn.packetTransportType = PacketTransportType_shb;
|
bpr->gn.packetTransportType = PacketTransportType_shb;
|
||||||
|
|
||||||
bpr->destinationPort = 2043;
|
bpr->destinationPort = 2043;
|
||||||
|
|
||||||
bpr->gn.trafficClass = 2;
|
bpr->gn.trafficClass = 2;
|
||||||
|
|
||||||
bpr->data.buf = malloc(512);
|
bpr->data.buf = malloc(512);
|
||||||
|
|
||||||
uint8_t tr_oer[1024];
|
FacilitiesIndication_t* fi = calloc(1, sizeof(FacilitiesIndication_t));
|
||||||
tr_oer[0] = 4;
|
fi = calloc(1, sizeof(FacilitiesIndication_t));
|
||||||
|
fi->present = FacilitiesIndication_PR_message;
|
||||||
|
fi->choice.message.itsMessageType = 2043;
|
||||||
|
fi->choice.message.data.buf = malloc(512);
|
||||||
|
|
||||||
|
uint8_t buf[1024];
|
||||||
|
buf[0] = 4;
|
||||||
|
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
|
|
@ -666,13 +667,22 @@ void* pc_service(void* fc) {
|
||||||
|
|
||||||
bpr->id = rand() + 1;
|
bpr->id = rand() + 1;
|
||||||
|
|
||||||
asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_TransportRequest, NULL, tr, tr_oer+1, 1023);
|
asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_TransportRequest, NULL, tr, buf+1, 1023);
|
||||||
if (enc.encoded == -1) {
|
if (enc.encoded == -1) {
|
||||||
syslog_err("[facilities] encoding TR for PCM failed");
|
syslog_err("[facilities] encoding TR for PCM failed");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
it2s_tender_queue_send(facilities->tx_queue, buf, enc.encoded+1, ITSS_TRANSPORT, bpr->id, "TR.packet.btp");
|
||||||
|
|
||||||
it2s_tender_queue_send(facilities->tx_queue, tr_oer, enc.encoded+1, ITSS_TRANSPORT, bpr->id, "TR.packet.btp");
|
fi->choice.message.id = bpr->id;
|
||||||
|
fi->choice.message.data.size = bpr->data.size;
|
||||||
|
memcpy(fi->choice.message.data.buf, bpr->data.buf, bpr->data.size);
|
||||||
|
enc = asn_encode_to_buffer(NULL, ATS_CANONICAL_OER, &asn_DEF_FacilitiesIndication, fi, buf+1, 1023);
|
||||||
|
if (enc.encoded == -1) {
|
||||||
|
syslog_err("[facilities] encoding FI for PCM failed");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
it2s_tender_queue_send(facilities->tx_queue, buf, enc.encoded+1, ITSS_APPLICATIONS, bpr->id, "FI.message");
|
||||||
|
|
||||||
if (facilities->logging.recorder) {
|
if (facilities->logging.recorder) {
|
||||||
uint16_t buffer_len = 2048;
|
uint16_t buffer_len = 2048;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue