build: move the int/stream type mapping into a simdata module shared by the build script
This commit is contained in:
11
build.rs
11
build.rs
@@ -5,6 +5,11 @@ use std::fs::File;
|
||||
use image::GenericImageView;
|
||||
use csv::Reader;
|
||||
|
||||
#[path ="src/simdata.rs"]
|
||||
mod simdata;
|
||||
|
||||
use crate::simdata::StreamType;
|
||||
|
||||
fn main() {
|
||||
linker_be_nice();
|
||||
// make sure linkall.x is the last linker script (otherwise might cause problems with flip-link)
|
||||
@@ -205,17 +210,17 @@ fn write_sim_data() {
|
||||
let mut motion_output = File::open(motion_output).unwrap();
|
||||
let mut gps_output = File::open(gps_output).unwrap();
|
||||
let mut annotation_output = File::open(annotation_output).unwrap();
|
||||
rmp::encode::write_ext_meta(&mut unified_fd, motion_output.metadata().unwrap().len() as u32, 1).unwrap();
|
||||
rmp::encode::write_ext_meta(&mut unified_fd, motion_output.metadata().unwrap().len() as u32, StreamType::IMU.into()).unwrap();
|
||||
let mut buf = Vec::new();
|
||||
motion_output.read_to_end(&mut buf).unwrap();
|
||||
unified_fd.write_all(buf.as_slice()).unwrap();
|
||||
|
||||
rmp::encode::write_ext_meta(&mut unified_fd, gps_output.metadata().unwrap().len() as u32, 2).unwrap();
|
||||
rmp::encode::write_ext_meta(&mut unified_fd, gps_output.metadata().unwrap().len() as u32, StreamType::GPS.into()).unwrap();
|
||||
let mut buf = Vec::new();
|
||||
gps_output.read_to_end(&mut buf).unwrap();
|
||||
unified_fd.write_all(buf.as_slice()).unwrap();
|
||||
|
||||
rmp::encode::write_ext_meta(&mut unified_fd, annotation_output.metadata().unwrap().len() as u32, 3).unwrap();
|
||||
rmp::encode::write_ext_meta(&mut unified_fd, annotation_output.metadata().unwrap().len() as u32, StreamType::Annotations.into()).unwrap();
|
||||
let mut buf = Vec::new();
|
||||
annotation_output.read_to_end(&mut buf).unwrap();
|
||||
unified_fd.write_all(buf.as_slice()).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user