Merge remote-tracking branch 'refs/remotes/origin/master'
This commit is contained in:
commit
025c6308d2
|
|
@ -8,7 +8,7 @@ stages:
|
|||
|
||||
.dependencies:
|
||||
before_script:
|
||||
- pacman -Sy zeromq it2s-config-git it2s-asn-git it2s-tender-git it2s-gps-git --overwrite=* --noconfirm
|
||||
- pacman -Sy zeromq it2s-config-git it2s-asn-git it2s-tender-git it2s-gps-git it2s-obd-git --overwrite=* --noconfirm
|
||||
|
||||
build:
|
||||
stage: build
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ TARGET_LINK_LIBRARIES(it2s-itss-facilities
|
|||
-lit2s-asn-tpm
|
||||
-lit2s-tender
|
||||
-lm
|
||||
-lrt
|
||||
)
|
||||
|
||||
INSTALL(
|
||||
|
|
|
|||
21
src/cam.c
21
src/cam.c
|
|
@ -7,16 +7,20 @@
|
|||
#include <itss-management/ManagementRequest.h>
|
||||
#include <camv2/CAM.h>
|
||||
|
||||
#include <sys/mman.h>
|
||||
#include <stdint.h>
|
||||
#include <time.h>
|
||||
#include <zmq.h>
|
||||
#include <unistd.h>
|
||||
#include <syslog.h>
|
||||
#include <math.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <it2s-tender/space.h>
|
||||
#include <it2s-tender/time.h>
|
||||
|
||||
#include <it2s-obd/shmem.h>
|
||||
|
||||
#define syslog_info(msg, ...) syslog(LOG_INFO, msg, ##__VA_ARGS__)
|
||||
#define syslog_emerg(msg, ...) syslog(LOG_EMERG, "%s:%d [" msg "]", __func__, __LINE__, ##__VA_ARGS__)
|
||||
#define syslog_err(msg, ...) syslog(LOG_ERR, "%s:%d [" msg "]", __func__, __LINE__, ##__VA_ARGS__)
|
||||
|
|
@ -88,6 +92,17 @@ static int permissions_check(int cid, uint8_t* permissions, uint8_t permissions_
|
|||
|
||||
static int mk_cam(facilities_t* facilities, uint8_t *cam_oer, uint32_t *cam_len) {
|
||||
int rv = 0;
|
||||
int shm_fd, shm_valid = 0;
|
||||
|
||||
shm_fd = shm_open("it2s-bluetooth-decoded", O_RDONLY, 0666);
|
||||
if(shm_fd == -1)
|
||||
syslog_err("[facilities] failed to open CAN shared memory\n");
|
||||
|
||||
decoded_can_values_shm *shared_message = (decoded_can_values_shm *)mmap(0, sizeof(decoded_can_values_shm), PROT_READ, MAP_SHARED, shm_fd, 0);
|
||||
if(shared_message == MAP_FAILED)
|
||||
syslog_err("[facilities] failed to map CAN shared memory\n");
|
||||
else
|
||||
shm_valid = 1;
|
||||
|
||||
CAM_t *cam = calloc(1, sizeof(CAM_t));
|
||||
|
||||
|
|
@ -289,6 +304,12 @@ static int mk_cam(facilities_t* facilities, uint8_t *cam_oer, uint32_t *cam_len)
|
|||
goto cleanup;
|
||||
}
|
||||
*cam_len = (enc.encoded + 7) / 8;
|
||||
|
||||
if(shm_valid){
|
||||
munmap(shared_message, sizeof(can_values_shm));
|
||||
if(close(shm_fd) == -1)
|
||||
syslog_err("[facilities] failed to close CAN shared memory\n");
|
||||
}
|
||||
|
||||
cleanup:
|
||||
ASN_STRUCT_FREE(asn_DEF_CAM, cam);
|
||||
|
|
|
|||
Loading…
Reference in New Issue