cwIo.h/cpp : Added uiSetTitle(), uiCreateHList() and second version of uiGetBlob(). Changed name of uiCreateList() to uiCreateVList().

This commit is contained in:
kevin 2024-10-12 15:25:03 -04:00
parent 8c4ba8a9f7
commit 83267b1016
2 changed files with 67 additions and 2 deletions

View File

@ -2806,7 +2806,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;
}
@ -3817,6 +3831,24 @@ cw::rc_t cw::io::uiCreateLog( handle_t h, unsigned& uuIdRef, unsigned pare
return rc;
}
cw::rc_t cw::io::uiCreateVList( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title )
{
rc_t rc;
ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::createVList(uiH,uuIdRef,parentUuId,eleName,appId,chanId,clas,title);
return rc;
}
cw::rc_t cw::io::uiCreateHList( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title )
{
rc_t rc;
ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::createHList(uiH,uuIdRef,parentUuId,eleName,appId,chanId,clas,title);
return rc;
}
cw::rc_t cw::io::uiSetNumbRange( handle_t h, unsigned uuId, double minValue, double maxValue, double stepValue, unsigned decPl, double value )
{
rc_t rc;
@ -3992,6 +4024,14 @@ cw::rc_t cw::io::uiSetScrollTop( handle_t h, unsigned uuId )
return rc;
}
cw::rc_t cw::io::uiSetTitle( handle_t h, unsigned uuId, const char* title )
{
rc_t rc;
ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::setTitle(uiH,uuId,title);
return rc;
}
cw::rc_t cw::io::uiSetBlob( handle_t h, unsigned uuId, const void* blob, unsigned blobByteN )
{
@ -4012,6 +4052,21 @@ const void* cw::io::uiGetBlob( handle_t h, unsigned uuId, unsigned& blobByteN_
return nullptr;
}
cw::rc_t cw::io::uiGetBlob( handle_t h, unsigned uuId, void* buf, unsigned& bufByteN_Ref )
{
unsigned bN = 0;
const void* b = uiGetBlob(h,uuId,bN);
if( bN > bufByteN_Ref )
{
bufByteN_Ref = 0;
return cwLogError(kBufTooSmallRC,"UI blob buffer is too small.");
}
memcpy(buf,b,bN);
bufByteN_Ref = bN;
return kOkRC;
}
cw::rc_t cw::io::uiClearBlob( handle_t h, unsigned uuId )
{
rc_t rc;

12
cwIo.h
View File

@ -383,6 +383,11 @@ namespace cw
rc_t uiCreateLog( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title );
rc_t uiCreateVList( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title );
rc_t uiCreateHList( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title );
rc_t uiSetTitle( handle_t h, unsigned uuId, const char* title );
rc_t uiSetNumbRange( handle_t h, unsigned uuId, double minValue, double maxValue, double stepValue, unsigned decPl, double value );
rc_t uiSetProgRange( handle_t h, unsigned uuId, double minValue, double maxValue, double value );
@ -409,9 +414,14 @@ namespace cw
int uiGetOrderKey( handle_t h, unsigned uuId );
rc_t uiSetScrollTop( handle_t h, unsigned uuId );
// uiSetBlob() allocates internal memory and copies the contents of blob[blobByeN]
rc_t uiSetBlob( handle_t h, unsigned uuId, const void* blob, unsigned blobByteN );
const void* uiGetBlob( handle_t h, unsigned uuId, unsigned& blobByteN_Ref );
// On call bufByteN_Ref holds the size of buf in bytes, on return it is set to the count of bytes in buf[].
// If buf[] is not large enough to hold all bytes kBufTooSmallRC is returned.
rc_t uiGetBlob( handle_t h, unsigned uuId, void* buf, unsigned& bufByteN_Ref );
rc_t uiClearBlob( handle_t h, unsigned uuId );
// Register parent/child/name app id's