Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
msalinoh committed Dec 12, 2024
1 parent 7cab88b commit 54a5aab
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 68 deletions.
50 changes: 25 additions & 25 deletions packages/ceti-tag-data-capture/config/tag-info.yaml
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
id: '2.3-X'
hostname: 'wt-XXXXXXXX'
audio:
id: "2.3-X"
hostname: "wt-XXXXXXXX"
audio:
channel_count: 3
channels:
channels:
- id: 1
gain: 18.0 # dB
hydrophone:
brand: 'Piezo Hannas'
model: 'spherical 10cm'
hydrophone:
brand: "Piezo Hannas"
model: "spherical 10cm"
id: PH091
placement: {x: 0.0, y: -8.0, z: 0.0} # cm
placement: { x: 0.0, y: -8.0, z: 0.0 } # cm
- id: 2
gain: 18.0 # dB
hydrophone:
brand: 'Piezo Hannas'
model: 'spherical 10cm'
brand: "Piezo Hannas"
model: "spherical 10cm"
id: PH091
placement: {x: -6.0, y: -8.0, z: 0.0} # cm
placement: { x: -6.0, y: -8.0, z: 0.0 } # cm
- id: 3
gain: 18.0 # dB
gain: 18.0 # dB
hydrophone:
brand: 'Piezo Hannas'
model: 'spherical 10cm'
brand: "Piezo Hannas"
model: "spherical 10cm"
id: PH091
placement: {x: 0.0, y: 0.0, z: 0.0} # cm
placement: { x: 0.0, y: 0.0, z: 0.0 } # cm
sensors:
- type: pressure
brand: 'Keller'
brand: "Keller"
model: 4ld
sample_rate: 1 # sps
- type: 'ambient light'
brand: 'LightOn'
- type: "ambient light"
brand: "LightOn"
model: LTR-329ALS-01
sample_rate: 1 #Hz
resolution: 16 #bit
- type: battery
brand: 'Analog Devices'
model: 'MAX17320'
brand: "Analog Devices"
model: "MAX17320"
sample_rate: 1 #Hz
- type: imu
brand: 'CEVA'
model: 'BNO086'
orientation: {x: bow, y: starboard, z: up}
brand: "CEVA"
model: "BNO086"
orientation: { x: bow, y: starboard, z: up }
sample_rates:
quat: 20 #Hz
accel: 50 #Hz
Expand All @@ -51,5 +51,5 @@ sensors:
sample_rate: 1000 #Hz
resolution: 24 #bit
- type: gps
brand: 'uBlox'
model: 'NEO-M9N-00B'
brand: "uBlox"
model: "NEO-M9N-00B"
86 changes: 43 additions & 43 deletions packages/ceti-tag-data-capture/src/cetiTagApp/utils/meta.c
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
#include "meta.h"

#include <errno.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>

#define META_FILE_PATH "/opt/ceti-tag-data-capture/config/tag-info.yaml"

int meta_log(uint64_t timestamp){
int fd_dst, fd_src;
char buf[4096];
int nread;
char meta_file_path[256];

snprintf(meta_file_path, 255, "/data/data_tag_info_%lu.yaml", timestamp);

fd_src = open(META_FILE_PATH, O_RDONLY);
if (fd_src < 0) {
return -1;
}

fd_dst = open(meta_file_path, O_WRONLY | O_CREAT | O_EXCL, 0666);
if (fd_dst < 0) {
int e = errno;
close(fd_src);
errno = e;
return -1;
}

nread = read(fd_src, buf, sizeof(buf));
while (nread > 0) {
char *out_ptr = buf;

int nwritten = write(fd_dst, out_ptr, nread);
if (nwritten >= 0) {
nread -= nwritten;
out_ptr += nwritten;
} else if (errno != EINTR) {
int e = errno;
close(fd_src);
close(fd_dst);
errno = e;
return -1;
int meta_log(uint64_t timestamp) {
int fd_dst, fd_src;
char buf[4096];
int nread;
char meta_file_path[256];

snprintf(meta_file_path, 255, "/data/data_tag_info_%lu.yaml", timestamp);

fd_src = open(META_FILE_PATH, O_RDONLY);
if (fd_src < 0) {
return -1;
}

if (nread == 0) {
nread = read(fd_src, buf, sizeof(buf));

fd_dst = open(meta_file_path, O_WRONLY | O_CREAT | O_EXCL, 0666);
if (fd_dst < 0) {
int e = errno;
close(fd_src);
errno = e;
return -1;
}
}

close(fd_src);
close(fd_dst);
return 0;
nread = read(fd_src, buf, sizeof(buf));
while (nread > 0) {
char *out_ptr = buf;

int nwritten = write(fd_dst, out_ptr, nread);
if (nwritten >= 0) {
nread -= nwritten;
out_ptr += nwritten;
} else if (errno != EINTR) {
int e = errno;
close(fd_src);
close(fd_dst);
errno = e;
return -1;
}

if (nread == 0) {
nread = read(fd_src, buf, sizeof(buf));
}
}

close(fd_src);
close(fd_dst);
return 0;
}

0 comments on commit 54a5aab

Please sign in to comment.