radio::upload
This commit is contained in:
parent
cd74a703c1
commit
863f14b0c2
11
src/lib.rs
11
src/lib.rs
@ -7,9 +7,6 @@ mod radio;
|
||||
const COPYRIGHT: &'static str = "Copyright (C) 2018 Serge Vakulenko KK6ABQ";
|
||||
const VERSION: Option<&'static str> = option_env!("VERSION");
|
||||
|
||||
extern {
|
||||
fn radio_upload(cont_flag: c_int);
|
||||
}
|
||||
|
||||
fn print_usage() {
|
||||
let version = VERSION.unwrap_or("-----");
|
||||
@ -91,13 +88,11 @@ pub extern "C" fn rust_main(_argc: c_int, _argv: *const *const c_char) -> c_int
|
||||
if matches.free.len() != 1 {
|
||||
print_usage();
|
||||
}
|
||||
unsafe {
|
||||
let device = radio::connect();
|
||||
radio::read_image(&matches.free[0]);
|
||||
radio::print_version(device);
|
||||
radio_upload(0);
|
||||
radio::upload(device, 0);
|
||||
radio::disconnect();
|
||||
}
|
||||
} else if config_flag {
|
||||
let conf_args = matches.free.len();
|
||||
if !(conf_args == 1 || conf_args == 2) {
|
||||
@ -119,16 +114,14 @@ pub extern "C" fn rust_main(_argc: c_int, _argv: *const *const c_char) -> c_int
|
||||
radio::save_image("device.img");
|
||||
} else {
|
||||
// Update device from text config file.
|
||||
unsafe {
|
||||
let device = radio::connect();
|
||||
radio::download(device);
|
||||
radio::print_version(device);
|
||||
radio::save_image("device.img");
|
||||
radio::parse_config(&config_filename);
|
||||
radio::verify_config();
|
||||
radio_upload(1);
|
||||
radio::upload(device, 1);
|
||||
radio::disconnect();
|
||||
}
|
||||
}
|
||||
} else if verify_flag {
|
||||
if matches.free.len() != 1 {
|
||||
|
@ -9,6 +9,7 @@ extern {
|
||||
fn radio_connect() -> *const RadioDeviceT;
|
||||
fn radio_disconnect();
|
||||
fn radio_download(device: *const RadioDeviceT);
|
||||
fn radio_upload(cont_flag: c_int);
|
||||
fn radio_list_c();
|
||||
fn radio_verify_config();
|
||||
fn radio_print_version(device: *const RadioDeviceT, stdout: *const libc::FILE);
|
||||
@ -37,6 +38,12 @@ pub fn download(device: *const RadioDeviceT) {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn upload(_device: *const RadioDeviceT, cont_flag: c_int) {
|
||||
unsafe {
|
||||
radio_upload(cont_flag)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn list() {
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user