From 3f47ea20f305f70a49284229d4091849f1efb0f6 Mon Sep 17 00:00:00 2001 From: kevin Date: Mon, 7 Oct 2024 12:22:39 -0400 Subject: [PATCH] cwIo.cpp : Add missing body of serialDeviceSend(). --- cwIo.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/cwIo.cpp b/cwIo.cpp index b9ff36a..68d39a7 100644 --- a/cwIo.cpp +++ b/cwIo.cpp @@ -2695,7 +2695,21 @@ void cw::io::serialDeviceSetId( handle_t h, unsigned devIdx, unsigned id cw::rc_t cw::io::serialDeviceSend( handle_t h, unsigned devIdx, const void* byteA, unsigned byteN ) { rc_t rc = kOkRC; - //io_t* p = _handleToPtr(h); + io_t* p = _handleToPtr(h); + + if( devIdx >= p->serialN ) + { + rc = cwLogError(kInvalidArgRC,"%i is an invalid serial device index.",devIdx); + goto errLabel; + } + + if((rc = send( p->serialPortSrvH, p->serialA[devIdx].userId, byteA, byteN )) != kOkRC ) + { + rc = cwLogError(rc,"Send on serial device index %i failed.",devIdx); + goto errLabel; + } + +errLabel: return rc; }