Skip to content
Snippets Groups Projects
Commit 4284d88b authored by Jonathan Hanks's avatar Jonathan Hanks
Browse files

Fix for 332, standalone_edcu does not reflect all of its created values into EPICS.

Six channels are created by the EDCU.  Only three were sent to both EPICS and the data stream.
 * Update the standalone_edcu to export the UPTIME, GPS, and DATA_RATE_KB_PER_S values in EPICS as well.
 * Minor formatting changes as per clang-format run.

Closes #332
parent 3a2b4f72
No related branches found
No related tags found
2 merge requests!439RCG 5.0 release fro deb 10,!332Merging 4.2 into master
......@@ -19,6 +19,7 @@ of this distribution.
#include <array>
#include <iterator>
#include <numeric>
#include <limits>
#include <string>
#include <thread>
#include <utility>
......@@ -81,12 +82,6 @@ make_address( const char* str )
#else
using io_context_t = boost::asio::io_context;
inline io_context_t&
get_context( tcp::acceptor& acceptor )
{
return acceptor.get_executor( ).context( );
}
inline boost::asio::ip::address
make_address( const char* str )
{
......@@ -243,17 +238,17 @@ private:
*it = '\0';
return s;
}
std::string prefix_{};
std::string prefix_{ };
// use a vector instead of a std::string as
// c_str() returns something that should be
// temporary, these needs to always be available
// as const char* after they are intialized
std::vector< char > chan_conn_{};
std::vector< char > chan_noconn_{};
std::vector< char > chan_cnt_{};
std::vector< char > uptime_{};
std::vector< char > data_rate_{};
std::vector< char > gpstime_{};
std::vector< char > chan_conn_{ };
std::vector< char > chan_noconn_{ };
std::vector< char > chan_cnt_{ };
std::vector< char > uptime_{ };
std::vector< char > data_rate_{ };
std::vector< char > gpstime_{ };
};
// Function prototypes
......@@ -729,8 +724,7 @@ subscriptionHandler( struct event_handler_args args )
switch ( args.type )
{
case DBR_TIME_SHORT:
{
case DBR_TIME_SHORT: {
dbr_time_short* dbr = (dbr_time_short*)( args.dbr );
......@@ -745,8 +739,7 @@ subscriptionHandler( struct event_handler_args args )
}
}
break;
case DBR_TIME_LONG:
{
case DBR_TIME_LONG: {
dbr_time_long* dbr = (dbr_time_long*)( args.dbr );
edc_timestamped_data_t* edc_data =
( (edc_timestamped_data_t*)( args.usr ) );
......@@ -758,8 +751,7 @@ subscriptionHandler( struct event_handler_args args )
}
}
break;
case DBR_TIME_FLOAT:
{
case DBR_TIME_FLOAT: {
dbr_time_float* dbr = (dbr_time_float*)( args.dbr );
edc_timestamped_data_t* edc_data =
( (edc_timestamped_data_t*)( args.usr ) );
......@@ -771,8 +763,7 @@ subscriptionHandler( struct event_handler_args args )
}
}
break;
case DBR_TIME_DOUBLE:
{
case DBR_TIME_DOUBLE: {
dbr_time_double* dbr = (dbr_time_double*)( args.dbr );
edc_timestamped_data_t* edc_data =
( (edc_timestamped_data_t*)( args.usr ) );
......@@ -1084,29 +1075,25 @@ copyDaqData( char* daqData )
{
switch ( daqd_edcu1.channel_type[ ii ] )
{
case _16bit_integer:
{
case _16bit_integer: {
*reinterpret_cast< int16_t* >( daqData ) =
daqd_edcu1.channel_value[ ii ].data.data_int16;
daqData += sizeof( int16_t );
break;
}
case _32bit_integer:
{
case _32bit_integer: {
*reinterpret_cast< int32_t* >( daqData ) =
daqd_edcu1.channel_value[ ii ].data.data_int32;
daqData += sizeof( int32_t );
break;
}
case _32bit_float:
{
case _32bit_float: {
*reinterpret_cast< float* >( daqData ) =
daqd_edcu1.channel_value[ ii ].data.data_float32;
daqData += sizeof( float );
break;
}
case _64bit_double:
{
case _64bit_double: {
*reinterpret_cast< double* >( daqData ) =
daqd_edcu1.channel_value[ ii ].data.data_float64;
daqData += sizeof( double );
......@@ -1509,7 +1496,7 @@ get_diag_info_handler( boost::asio::deadline_timer& timer,
get_diag_info( queues, dest );
timer.expires_from_now( boost::posix_time::seconds( 1 ) );
timer.async_wait(
[&timer, &queues, &dest]( const boost::system::error_code& ) {
[ &timer, &queues, &dest ]( const boost::system::error_code& ) {
get_diag_info_handler( timer, queues, dest );
} );
}
......@@ -1528,7 +1515,7 @@ epics_timer_handler( boost::asio::deadline_timer& timer,
{
simple_pv_server_update( server );
timer.expires_from_now( boost::posix_time::milliseconds( 1000 / 8 ) );
timer.async_wait( [&timer, server]( const boost::system::error_code& ) {
timer.async_wait( [ &timer, server ]( const boost::system::error_code& ) {
epics_timer_handler( timer, server );
} );
}
......@@ -1629,7 +1616,7 @@ client_finalize( std::shared_ptr< diag_client_conn > conn )
conn->socket,
boost::asio::buffer( conn->buffer_stream.GetString( ),
conn->buffer_stream.GetSize( ) ),
[conn]( const boost::system::error_code& ec, std::size_t ) {} );
[ conn ]( const boost::system::error_code& ec, std::size_t ) {} );
}
void
......@@ -1654,7 +1641,7 @@ client_write( std::shared_ptr< diag_client_conn > conn )
conn->socket,
boost::asio::buffer( conn->buffer_stream.GetString( ),
conn->buffer_stream.GetSize( ) ),
[conn]( const boost::system::error_code& ec, std::size_t ) {
[ conn ]( const boost::system::error_code& ec, std::size_t ) {
if ( !ec )
{
client_write( conn );
......@@ -1695,7 +1682,7 @@ start_client_write( std::shared_ptr< diag_client_conn > conn )
conn->socket,
boost::asio::buffer( conn->buffer_stream.GetString( ),
conn->buffer_stream.GetSize( ) ),
[conn]( const boost::system::error_code& ec, std::size_t ) {
[ conn ]( const boost::system::error_code& ec, std::size_t ) {
if ( !ec )
{
client_write( conn );
......@@ -1722,11 +1709,11 @@ handle_accept( io_context_t& io_context,
// response.
conn->socket.async_read_some(
boost::asio::buffer( conn->buffer ),
[conn]( const boost::system::error_code& ec, std::size_t ) {
[ conn ]( const boost::system::error_code& ec, std::size_t ) {
if ( !ec )
{
conn->io_context.post(
[conn]( ) { start_client_write( conn ); } );
[ conn ]( ) { start_client_write( conn ); } );
}
} );
accept_loop( io_context, acceptor, cur_diag );
......@@ -1740,7 +1727,7 @@ accept_loop( io_context_t& io_context,
std::shared_ptr< diag_client_conn > conn =
std::make_shared< diag_client_conn >( io_context );
acceptor.async_accept( conn->socket,
[&io_context, &acceptor, conn, &cur_diag](
[ &io_context, &acceptor, conn, &cur_diag ](
const boost::system::error_code& ec ) {
handle_accept(
io_context, acceptor, conn, ec, cur_diag );
......@@ -1785,7 +1772,34 @@ diag_thread_mainloop( diag_thread_args* args,
static_cast< double >( daqd_edcu1.num_chans - 1 ),
static_cast< double >( daqd_edcu1.num_chans + 1 ),
static_cast< double >( daqd_edcu1.num_chans - 1 ),
}
},
SimplePV{
InternalChanNames::uptime_suffix( ),
SIMPLE_PV_INT,
&cur_diag.uptime,
std::numeric_limits< double >::max( ),
0.0,
std::numeric_limits< double >::max( ),
0.0,
},
SimplePV{
InternalChanNames::data_rate_suffix( ),
SIMPLE_PV_INT,
&cur_diag.data_rate,
4 * 1024,
0.0,
4 * 1024,
0.0,
},
SimplePV{
InternalChanNames::gpstime_suffix( ),
SIMPLE_PV_INT,
&cur_diag.gpstime,
std::numeric_limits< double >::max( ),
0.0,
std::numeric_limits< double >::max( ),
0.0,
},
};
PvServerManager epics_server( internal_names->prefix( ), pvInfo );
......
......@@ -123,8 +123,54 @@ sleep 15
"$FE_STREAM_CHECK_NDS" -c 100 -start 0 -stop 5
RESULT=$?
echo "Testing return $RESULT (0 = success)"
exit $RESULT
echo "NDS Testing return $RESULT (0 = success)"
if [ "$RESULT" -ne 0 ]; then
exit $RESULT
fi
val=`caget -t X6:EDCU_CHAN_CONN`
if [ "$val" -eq "0" ]; then
echo "CHAN_CONN was 0"
exit 1
fi
echo "chan_conn $val"
val=`caget -t X6:EDCU_CHAN_NOCON`
if [ "$val" -ne "0" ]; then
echo "CHAN_NOCON was 0"
exit 1
fi
echo "chan_noconn $val"
val=`caget -t X6:EDCU_CHAN_CNT`
if [ "$val" -eq "0" ]; then
echo "CHAN_CNT was 0"
exit 1
fi
echo "chan_cnt $val"
val=`caget -t X6:EDCU_UPTIME_SECONDS`
if [ "$val" -le "0" ]; then
echo "Could not read the uptime value"
exit 1
fi
echo "Uptime $val"
val=`caget -t X6:EDCU_GPS`
if [ "$val" -le "0" ]; then
echo "Could not read the gps value"
exit 1
fi
echo "Gps $val"
val=`caget -t X6:EDCU_DATA_RATE_KB_PER_S`
if [ "$val" -le "0" ]; then
echo "Could not read the datarate value"
exit 1
fi
echo "Data rate $val"
exit 0
#echo "Press enter to continue..."
#DUMMY=""
#read DUMMY
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment