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

Discussions about product bugs & problems!
Note: This is no replacement for the Official ETM Support!
Search

Post Reply
6 posts • Page 1 of 1
SergeyK
Posts: 12
Joined: Wed Nov 02, 2016 12:03 pm

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

Post 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 ?

User avatar
leoknipp
Posts: 2926
Joined: Tue Aug 24, 2010 7:28 pm

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

Post 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

SergeyK
Posts: 12
Joined: Wed Nov 02, 2016 12:03 pm

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

Post 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,

User avatar
leoknipp
Posts: 2926
Joined: Tue Aug 24, 2010 7:28 pm

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

Post 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

User avatar
dgi
Posts: 11
Joined: Wed May 09, 2018 4:28 pm

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

Post 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/)

User avatar
leoknipp
Posts: 2926
Joined: Tue Aug 24, 2010 7:28 pm

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

Post 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

Post Reply
6 posts • Page 1 of 1