48 fwrite(×tamp_realtime,
sizeof(
struct time_stamp), 1, ambient_file);
49 fwrite(×tamp_monotonic,
sizeof(
struct time_stamp), 1, ambient_file);
55 int mutli_channel_read = -1;
81 strcpy(ambient_file_name, conf->
file_name);
85 char* file_ending = ambient_file_name;
86 while (strchr(file_ending, target) != NULL) {
87 file_ending = strchr(file_ending, target);
94 char ambient_file_ending[9] =
"-ambient";
95 strcat(ambient_file_ending, file_ending);
96 strcpy(file_ending, ambient_file_ending);
107 uint16_t channel_bin_count = 0;
141 memset(file_header->
channel, 0,
160 struct rl_conf* conf,
char* comment) {
163 if (comment == NULL) {
166 file_header->
comment = comment;
int available_sensors[AMBIENT_MAX_SENSOR_COUNT]
uint16_t data_size
Datum size in bytes (for voltage and current)
uint16_t header_length
Total size of the header in bytes.
struct time_stamp start_time
Start time of the measurement in UNIX time, UTC.
void ambient_set_file_name(struct rl_conf *conf)
#define SENSOR_REGISTRY_SIZE
Number of sensor registred.
#define AMBIENT_DATA_BLOCK_SIZE
void ambient_setup_lead_in(struct rl_file_lead_in *lead_in, struct rl_conf *conf)
char name[SENSOR_NAME_LENGTH]
#define MAX_PATH_LENGTH
Maximum path length in characters.
int32_t(* getValue)(int, int)
uint64_t sample_count
Total sample count.
void ambient_setup_header(struct rl_file_header *file_header, struct rl_conf *conf, char *comment)
uint16_t channel_bin_count
Binary channel count.
struct rl_ambient ambient
Ambient conf.
#define RL_FILE_MAGIC
File header magic number (ascii RLD)
uint16_t file_version
File version number.
rl_unit unit
Channel unit.
const struct rl_sensor sensor_registry[SENSOR_REGISTRY_SIZE]
void get_mac_addr(uint8_t mac_address[MAC_ADDRESS_LENGTH])
char file_name[MAX_PATH_LENGTH]
Data file name.
void create_time_stamp(struct time_stamp *timestamp_realtime, struct time_stamp *timestamp_monotonic)
#define NO_VALID_DATA
No additional range valid information available.
uint16_t channel_count
Analog channel count.
uint32_t comment_length
Comment length.
void ambient_store_data(FILE *ambient_file, struct time_stamp *timestamp_realtime, struct time_stamp *timestamp_monotonic, struct rl_conf *conf)
uint32_t magic
File magic constant.
uint32_t data_block_size
Size of the data blocks in the file in rows.
void ambient_setup_channels(struct rl_file_header *file_header, struct rl_conf *conf)
char name[RL_FILE_CHANNEL_NAME_LENGTH]
Channel name/description.
uint16_t sample_rate
Sampling rate of the measurement.
char file_name[MAX_PATH_LENGTH]
#define RL_FILE_VERSION
File format version of current implementation.
int32_t channel_scale
Channel scale (in power of ten, for voltage and current)
uint16_t valid_data_channel
Link to channel valid data (for low-range current channels)
uint32_t data_block_count
Number of data blocks stored in the file.
#define RL_FILE_COMMENT_ALIGNMENT_BYTES
Comment alignment in bytes.
#define AMBIENT_SAMPLING_RATE
uint8_t mac_address[MAC_ADDRESS_LENGTH]
Instrument ID (mac address)