C++ Plugin Read data from a measurement channel.

  • Developers
  • C++ Plugin Read data from a measurement channel.
Britton Leslie

Posted on 08.01.2018 19:32

Please provide an example of how to find and read data from a Dewesoft measurement channel and then output it on a plugin channel in a C++ plugin. Below are snippets of my code. I started with the C++ Dewesoft tutorial that shows how to mount channels and I am now attempting to read channels and output that back out via the plugin.


IData* data;

_bstr_t MyChannelName = "amb_temp";

data->FindChannel(MyChannelName, &foundChannel);

foundChannel->GetValueAtAbsPos(-1,NULL,TRUE,&tempValue);

ch3->AddAsyncSingleSample(tempValue, time);

pluginGroup->MountChannel(7, TRUE, -1, &ch3);

_bstr_t s3 = "Amb Temp C";

ch3->put_Name(s3);

ch3->put_Used(TRUE);


thanks!



DEWESoft Support
Technical support
Posted on 09.01.2018 07:31

Hi,

we already have some examples on our webpage which you should look at. If you have Visual Studio 2015, then you should use the extension wizard: http://www.dewesoft.com/download?file=DewesoftX2Ex...

To find other examples, just search the developers section. Please note that you have to be logged on in order to see the files.

The general principles of reading data are described in the DCOM manual, available here: https://www.dewesoft.com/assets/dcom/dws7_dc_how_t...

Britton Leslie

Posted on 09.01.2018 14:21

Thanks for the reply. I am currently using VS 2013. I was able to read a channel in the following way:

float tempValue;

double tempValueScaled;

IData* data;

long dPos;

IChannel* dirBufPos;

app->get_Data(&data);

_bstr_t MyChannelName = "amb_temp";

data->FindChannel(MyChannelName, &foundChannel);

foundChannel->get_DBPos(&dPos);

foundChannel->GetValueAtAbsPos(dPos - 1, &dPos, TRUE, &tempValue); //Works, but is not scaled

foundChannel->ScaleValueDouble(tempValue, &tempValueScaled);


Login to reply to this topic. If you don't have account yet, you can signup for free account .