Page 1 of 1

3.18, API Driver Code, Manager::getId(xx,xy) is not working

Posted: Wed Jul 14, 2021 3:27 am
by SergeyK
Hello Community,

I'm working on a custom driver development with C++ API.
I can build the sample project and run it as a WinCC OA Manager.

For some reason the function DrvManager::getId(dpTestName, dpIdBytesTx) function is not working in a Driver project, but it works in an API Manager sample project.

Here is a code snippet. I triple-checked that the dp-name is correct.

Code: Select all

dpTestName = CharString("_MtmDriver.State.NumBytesTx:_original.._value");
DEBUG_MSG("MtmDriverIntDp::getDpName4Query dpTestName is : " << dpTestName);
if (DrvManager::getId(dpTestName, dpIdBytesTx)) {
	DEBUG_MSG("MtmDriverIntDp::getDpName4Query BytesTxAddr Address: " << dpIdBytesTx.getDp());

	if (!dpIdBytesTx.isNull())
		DrvManager::dpSet(dpIdBytesTx, IntegerVar(2));
	}
	else {
		DEBUG_MSG("MtmDriverIntDp::getDpName4Query BytesTxAddr GetID Failed.");
	}
I noticed that in case of the Driver project this function belongs to a class deriving from Manager, but for API Project the class derive from oaManager. is it related ?

Re: 3.18, API Driver Code, Manager::getId(xx,xy) is not working

Posted: Wed Jul 14, 2021 4:15 pm
by leoknipp
Normally a driver does not load the complete DP identification.
This is possibly the cause why resolving the DP name does not work in your example.

If you want to know the details of the WinCC OA API we suggest to attend a WinCC OA API training.
For details you can have a look at the following page:
https://www.winccoa.com/support/training.html

Best Regards
Leopold Knipp
Senior Support Specialist

Re: 3.18, API Driver Code, Manager::getId(xx,xy) is not working

Posted: Thu Jul 15, 2021 2:52 am
by SergeyK
Hi Leopold,

You answer is not very helpful !
I understand that a driver would rely on a HWMapper for the linking purposes, but I also need to communicate with other DPs.

How can I enable the driver code to load complete DP identifications ? Is there an alternative to Manager::getId() method ?

I reviewed the 3 slide decks for API training (Control Extension, API Manager and Driver development), but this topic is not covered.
And overall impression about API documentation is quite poor.

Regards,

Re: 3.18, API Driver Code, Manager::getId(xx,xy) is not working

Posted: Mon Jul 19, 2021 12:52 pm
by leoknipp
I am not an API specialist. Therefore, I cannot give you detailed information how to change the API code to load identification or to access datapoint elements.
Why do you need to communicate to others DPs (not related to the driver)?

If you do an API training (can also be made with a live session) you can ask our API specialists for details how to manage WinCC OA data within your driver.

Best Regards
Leopold Knipp
Senior Support Specialist

Re: 3.18, API Driver Code, Manager::getId(xx,xy) is not working

Posted: Tue Feb 08, 2022 12:46 pm
by dgi
SergeyK wrote: Thu Jul 15, 2021 2:52 am How can I enable the driver code to load complete DP identifications ? Is there an alternative to Manager::getId() method ?
Hi,
here is what I do:

Code: Select all


// impl just to signal the framework, that we want the DPIdTable
class WrapDrvPluginHdl : public DrvPluginHdl
{
  bool needDpContainer() override
  {
    // yes, give us the table
    return true;
  }
  void processValue(
    DpIdentifier &DpId,
    Variable *Var,
    BitVec &BitFlags,
    TimeVar &tm,
    PtrList &beforeValue,
    PtrList &afterValue
  ) override {
  // stub
  }
};

// then place following line into your DrvManager CTor
drvPluginHdl = new WrapDrvPluginHdl();

but afaik this is not recommend/mentioned in ETM trainings. (I am not employed by ETM!)

Regards,
Giri
(https://www.linkedin.com/in/nwrkbiz/)

Re: 3.18, API Driver Code, Manager::getId(xx,xy) is not working

Posted: Wed Feb 09, 2022 10:02 am
by leoknipp
In a WinCC OA basic training the API toolkit is not part of the content.
For the API toolkit there are own training modules available:. For details please have a look at the following links:
https://www.winccoa.com/support/training.html

https://www.winccoa.com/fileadmin/pdf/d ... dev_EN.pdf
https://www.winccoa.com/fileadmin/pdf/d ... edw_EN.pdf

Best Regards
Leopold Knipp
Senior Support Specialist