1#![allow(
2 clippy::collapsible_if,
3 clippy::derivable_impls,
4 clippy::field_reassign_with_default,
5 clippy::type_complexity
6)]
7
8pub mod device_support;
9pub mod records;
10pub mod snl;
11
12pub use device_support::time_of_day::{SecPastEpochDeviceSupport, TimeOfDayStringDeviceSupport};
13pub use records::epid::EpidRecord;
14pub use records::throttle::ThrottleRecord;
15pub use records::timestamp::TimestampRecord;
16
17pub const STD_DB_DIR: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/db");
19
20pub fn epid_record_factory() -> (&'static str, epics_base_rs::server::RecordFactory) {
22 ("epid", Box::new(|| Box::new(EpidRecord::default())))
23}
24
25pub fn throttle_record_factory() -> (&'static str, epics_base_rs::server::RecordFactory) {
27 ("throttle", Box::new(|| Box::new(ThrottleRecord::default())))
28}
29
30pub fn timestamp_record_factory() -> (&'static str, epics_base_rs::server::RecordFactory) {
32 (
33 "timestamp",
34 Box::new(|| Box::new(TimestampRecord::default())),
35 )
36}
37
38pub fn std_record_factories() -> Vec<(&'static str, epics_base_rs::server::RecordFactory)> {
40 vec![
41 epid_record_factory(),
42 throttle_record_factory(),
43 timestamp_record_factory(),
44 ]
45}
46
47pub fn register_std_record_types() {
50 for (name, factory) in std_record_factories() {
51 epics_base_rs::server::db_loader::register_record_type(name, factory);
52 }
53}
54
55pub fn sec_past_epoch_device_factory() -> (&'static str, epics_base_rs::server::DeviceSupportFactory)
58{
59 (
60 "Sec Past Epoch",
61 Box::new(|| Box::new(SecPastEpochDeviceSupport::new())),
62 )
63}
64
65pub fn time_of_day_device_factory() -> (&'static str, epics_base_rs::server::DeviceSupportFactory) {
68 (
69 "Time of Day",
70 Box::new(|| Box::new(TimeOfDayStringDeviceSupport::new())),
71 )
72}
73
74pub fn std_device_supports() -> Vec<(&'static str, epics_base_rs::server::DeviceSupportFactory)> {
84 vec![
85 sec_past_epoch_device_factory(),
86 time_of_day_device_factory(),
87 ]
88}