Some cleanup
This commit is contained in:
@@ -5,6 +5,7 @@ use err::thiserror;
|
||||
use err::ThisError;
|
||||
use log::*;
|
||||
use netpod::ScalarType;
|
||||
use netpod::SeriesKind;
|
||||
use netpod::Shape;
|
||||
use netpod::TsNano;
|
||||
use scywr::iteminsertqueue::DataValue;
|
||||
@@ -21,6 +22,21 @@ use taskrun::tokio::net::UdpSocket;
|
||||
pub enum Error {
|
||||
Io(#[from] std::io::Error),
|
||||
SeriesWriter(#[from] serieswriter::writer::Error),
|
||||
ChannelSend,
|
||||
ChannelRecv,
|
||||
ChannelLookup(#[from] dbpg::seriesbychannel::Error),
|
||||
}
|
||||
|
||||
impl<T> From<async_channel::SendError<T>> for Error {
|
||||
fn from(_value: async_channel::SendError<T>) -> Self {
|
||||
Self::ChannelSend
|
||||
}
|
||||
}
|
||||
|
||||
impl From<async_channel::RecvError> for Error {
|
||||
fn from(_value: async_channel::RecvError) -> Self {
|
||||
Self::ChannelRecv
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn listen_beacons(
|
||||
@@ -32,7 +48,19 @@ pub async fn listen_beacons(
|
||||
let channel = "epics-ca-beacons".to_string();
|
||||
let scalar_type = ScalarType::U64;
|
||||
let shape = Shape::Scalar;
|
||||
// let mut writer = SeriesWriter::establish(worker_tx, backend, channel, scalar_type, shape, stnow).await?;
|
||||
let (tx, rx) = async_channel::bounded(1);
|
||||
let qu = ChannelInfoQuery {
|
||||
backend,
|
||||
channel,
|
||||
kind: SeriesKind::ChannelData,
|
||||
scalar_type,
|
||||
shape,
|
||||
tx: Box::pin(tx),
|
||||
};
|
||||
worker_tx.send(qu).await?;
|
||||
let chinfo = rx.recv().await??;
|
||||
// TODO
|
||||
// let mut writer = SeriesWriter::new(chinfo.series.to_series());
|
||||
// let mut deque = VecDeque::new();
|
||||
let sock = UdpSocket::bind("0.0.0.0:5065").await?;
|
||||
sock.set_broadcast(true).unwrap();
|
||||
|
||||
@@ -29,8 +29,7 @@ pub struct EnumFetch {
|
||||
impl EnumFetch {
|
||||
pub fn new(created_state: CreatedState, conn: &mut CaConn) -> Self {
|
||||
if created_state.cssid.id() == 4705698279895902114 {}
|
||||
let name = created_state.name();
|
||||
// info!("EnumFetch::new name {name}");
|
||||
// info!("EnumFetch::new name {}", created_state.name());
|
||||
let dbr_ctrl_enum = 31;
|
||||
let ioid = conn.ioid_next();
|
||||
let ty = crate::ca::proto::CaMsgTy::ReadNotify(ReadNotify {
|
||||
@@ -54,10 +53,7 @@ impl ConnFuture for EnumFetch {
|
||||
fn camsg(mut self: Pin<&mut Self>, camsg: CaMsg, conn: &mut CaConn) -> Result<(), Error> {
|
||||
let tsnow = Instant::now();
|
||||
let crst = &mut self.created_state;
|
||||
|
||||
let name = crst.name();
|
||||
// info!("EnumFetch::poll {name}");
|
||||
|
||||
// info!("EnumFetch::poll name {}", crst.name());
|
||||
match camsg.ty {
|
||||
crate::ca::proto::CaMsgTy::ReadNotifyRes(msg2) => match msg2.value.meta {
|
||||
super::proto::CaMetaValue::CaMetaVariants(meta) => {
|
||||
|
||||
@@ -4,7 +4,6 @@ use err::ThisError;
|
||||
use futures_util::Stream;
|
||||
use log::*;
|
||||
use netpod::timeunits::*;
|
||||
use netpod::TsNano;
|
||||
use slidebuf::SlideBuf;
|
||||
use stats::CaProtoStats;
|
||||
use std::collections::VecDeque;
|
||||
@@ -986,7 +985,7 @@ impl CaMsg {
|
||||
if varcnt > 16 {
|
||||
return Err(Error::BadCaCount);
|
||||
}
|
||||
let s = String::from_utf8_lossy(&payload[6..6 + 26 * 16]);
|
||||
// let s = String::from_utf8_lossy(&payload[6..6 + 26 * 16]);
|
||||
let mut variants = Vec::new();
|
||||
for i in 0..varcnt {
|
||||
let p = (6 + 26 * i) as usize;
|
||||
|
||||
Reference in New Issue
Block a user