Yeah buddy
This commit is contained in:
parent
2ee1b68f4e
commit
0aa785b088
|
|
@ -35,7 +35,7 @@ static int transport_indication(facilities_t *facilities, uint8_t *msg, uint32_t
|
||||||
|
|
||||||
asn_dec_rval_t dec = oer_decode(NULL, &asn_DEF_BTPDataIndication, (void**) &bdi, msg, msg_len);
|
asn_dec_rval_t dec = oer_decode(NULL, &asn_DEF_BTPDataIndication, (void**) &bdi, msg, msg_len);
|
||||||
if (dec.code) {
|
if (dec.code) {
|
||||||
syslog_err("[facilities] [in] invalid BTPDataIndication received");
|
syslog_err("[facilities] <- invalid BDI received");
|
||||||
rv = 1;
|
rv = 1;
|
||||||
code = 1;
|
code = 1;
|
||||||
zmq_send(facilities->responder, &code, 1, 0);
|
zmq_send(facilities->responder, &code, 1, 0);
|
||||||
|
|
@ -43,7 +43,7 @@ static int transport_indication(facilities_t *facilities, uint8_t *msg, uint32_t
|
||||||
}
|
}
|
||||||
|
|
||||||
zmq_send(facilities->responder, &code, 1, 0);
|
zmq_send(facilities->responder, &code, 1, 0);
|
||||||
syslog_debug("[facilities] [in] received BTPDataIndication (%ldB)", bdi->data.size);
|
syslog_debug("[facilities] <- BDI (%ldB)", bdi->data.size);
|
||||||
|
|
||||||
// Parse message
|
// Parse message
|
||||||
asn_TYPE_descriptor_t *msg_descriptor;
|
asn_TYPE_descriptor_t *msg_descriptor;
|
||||||
|
|
@ -85,7 +85,7 @@ static int transport_indication(facilities_t *facilities, uint8_t *msg, uint32_t
|
||||||
uint8_t buffer[512];
|
uint8_t buffer[512];
|
||||||
buffer[0] = 4; // Facilities
|
buffer[0] = 4; // Facilities
|
||||||
asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_FacilitiesDataIndication, NULL, fdi, buffer+1, 511);
|
asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_FacilitiesDataIndication, NULL, fdi, buffer+1, 511);
|
||||||
syslog_debug("[facilities] [out] sending FacilitiesDataIndication to [app] (%ldB)", enc.encoded);
|
syslog_debug("[facilities] -> [app] FDI (%ldB)", enc.encoded);
|
||||||
zmq_send(facilities->app_socket, buffer, enc.encoded, 0);
|
zmq_send(facilities->app_socket, buffer, enc.encoded, 0);
|
||||||
zmq_recv(facilities->app_socket, &code, 1, 0);
|
zmq_recv(facilities->app_socket, &code, 1, 0);
|
||||||
|
|
||||||
|
|
@ -99,7 +99,7 @@ cleanup:
|
||||||
|
|
||||||
static void* handler(void *fc) {
|
static void* handler(void *fc) {
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
int code = 0;
|
uint8_t code = 0;
|
||||||
facilities_t *facilities = (facilities_t*) fc;
|
facilities_t *facilities = (facilities_t*) fc;
|
||||||
|
|
||||||
BTPDataRequest_t *bdr = calloc(1, sizeof(BTPDataRequest_t));
|
BTPDataRequest_t *bdr = calloc(1, sizeof(BTPDataRequest_t));
|
||||||
|
|
@ -121,7 +121,6 @@ static void* handler(void *fc) {
|
||||||
uint8_t bdr_oer[256];
|
uint8_t bdr_oer[256];
|
||||||
bdr_oer[0] = 4; // Facilities
|
bdr_oer[0] = 4; // Facilities
|
||||||
while (!facilities->exit) {
|
while (!facilities->exit) {
|
||||||
sleep(1);
|
|
||||||
rv = mk_cam(bdr->data.buf, (uint32_t *) &bdr->data.size);
|
rv = mk_cam(bdr->data.buf, (uint32_t *) &bdr->data.size);
|
||||||
if (rv) {
|
if (rv) {
|
||||||
syslog_err("[facilities] make cam failed (%d)", rv);
|
syslog_err("[facilities] make cam failed (%d)", rv);
|
||||||
|
|
@ -133,9 +132,10 @@ static void* handler(void *fc) {
|
||||||
syslog_err("[facilities] encoding BTPDataRequest for cam failed");
|
syslog_err("[facilities] encoding BTPDataRequest for cam failed");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
syslog_debug("[facilities] [out] sending BTPDataRequest to [transport] (%ldB)", enc.encoded);
|
syslog_debug("[facilities] -> [transport] BDR (%ldB)", enc.encoded);
|
||||||
zmq_send(facilities->transport_socket, bdr_oer, enc.encoded, 0);
|
zmq_send(facilities->transport_socket, bdr_oer, enc.encoded, 0);
|
||||||
zmq_recv(facilities->transport_socket, &code, 1, 0);
|
zmq_recv(facilities->transport_socket, &code, 1, 0);
|
||||||
|
sleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ASN_STRUCT_FREE(asn_DEF_BTPDataRequest, bdr);
|
ASN_STRUCT_FREE(asn_DEF_BTPDataRequest, bdr);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue