- Posts: 14
- Thank you received: 0
Online Forums
Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.
Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.
Do not use the Contact page for technical issues.
- Forum
- Discussions
- QuickOPC-Classic in COM
- Reading, Writing, Subscriptions, Property Access
- How to Decode the DAVtq ?
How to Decode the DAVtq ?
'OPCClient.VAQ' ⎕wi 'properties'
children class clsid data def description errorcode errormessage events instance interface links methods modified modifystop name obj opened pending progid properties self state suppress version xQuality xTimestamp xValue
So xQuality, xTimestamp and xValue should be available to interrogate but it is not working. I never used before the greater than sign '>' (as suggested in the documentation to resolve ambiguous call to a property), usually if it appears in the list of properties it is working.
I will continue my readings and experimentations.
Thanks for your help
Please Log in or Create an account to join the conversation.
What about the hint contained in the error message:
Use are using ">" - what are the others for?use ">", "<", or "@" to request proper invocation
Please Log in or Create an account to join the conversation.
Thanks again for your help.
Please Log in or Create an account to join the conversation.
This is how the IDAVtq is actually declared in our code:
/// <summary>Holds data value, timestamp and quality, abbreviated sometimes as VTQ. This is a common combination in OPC,
/// e.g. returned when an OPC item is read.</summary>
/// \incpart{Example (JScript),IEasyDAClient.ReadItem.Main.js,//+++,//---}
/// \incpart{Example (VBScript),IEasyDAClient.ReadItem.Main.vbs,Rem+++,Rem---}
[
object,
uuid(7C486189-8B81-4902-83E0-8F695F6786FB), // IID changed for V5.0
dual,
oleautomation,
nonextensible,
helpstring("Holds data value, timestamp and quality, abbreviated sometimes as VTQ"),
pointer_default(unique)
]
interface IDAVtq : IDispatch
{
/// <summary>Gets or sets the data value.</summary>
[propget, id(1), helpstring("Gets or sets the data value")]
HRESULT Value([out, retval] VARIANT *pVal);
//[propput, id(1), helpstring("property Value")] HRESULT Value([in] VARIANT newVal);
/// <summary>Gets or sets the timestamp.</summary>
[propget, id(2), helpstring("Gets or sets the timestamp")]
HRESULT Timestamp([out, retval] DATE *pVal);
//[propput, id(2), helpstring("property Timestamp")] HRESULT Timestamp([in] DATE newVal);
/// <summary>Gets or sets the quality.</summary>
[propget, id(3), helpstring("Gets or sets the quality")]
HRESULT Quality([out, retval] LONG *pVal);
//[propput, id(3), helpstring("property Quality")] HRESULT Quality([in] LONG newVal);
/// <summary>Formats the data value for display.</summary>
/// <param name="pvarResult">Receives the return value.</param>
/// <returns>Returns the formatted data value.</returns>
/// <remarks>Returns empty string when the quality is bad. The current data value can be a null reference.</remarks>
[id(101), helpstring("Formats the data value for display")]
HRESULT DisplayValue([out, retval] VARIANT* pvarResult);
/// <summary>Returns whether the <see cref="Value"/> contains valid data.</summary>
/// <param name="pvarResult">Receives the return value.</param>
/// <returns>Returns True when the <see cref="Quality"/> is not Bad.</returns>
[id(102), helpstring("Returns whether the Value contains valid data")]
HRESULT HasValue([out, retval] VARIANT* pvarResult);
/// <summary>Returns a string that represents the current <see cref="DAVtq"/>.</summary>
/// <param name="pvarResult">Receives the return value.</param>
/// <returns>A string representation of the current value, timestamp and quality.</returns>
/// <remarks>
/// <para>When the quality is bad, the returned string contains just the timestamp and quality. Otherwise, the
/// returned string contains also the data value, and its type.</para>
/// </remarks>
/// \incpart{Example (JScript),IEasyDAClient.ReadItem.Main.js,//+++,//---}
/// \incpart{Example (VBScript),IEasyDAClient.ReadItem.Main.vbs,Rem+++,Rem---}
[id(103), helpstring("Returns a string that represents the current DAVtq")]
HRESULT ToString([out, retval] VARIANT* pvarResult);
};
Isn't there a separate, different syntax in your language to access the properties?
Please Log in or Create an account to join the conversation.
'OPCClient' ⎕WI 'XReadItem > .VAQ' '' 'OPCLabs.KitServer.2' 'Demo.Ramp'
The following 3 methods are working:
'OPCClient.VAQ' ⎕wi 'XHasValue'
1
'OPCClient.VAQ' ⎕wi 'XDisplayValue'
-2.6082706451416
'OPCClient.VAQ' ⎕wi 'XToString'
-2.6082706451416 {VARTYPE(5)} @07-Nov-14 10:59:24 AM; OPCQUALITY(192)
However the following 3 properties are not working:
'OPCClient.VAQ' ⎕wi 'xValue'
⎕WI ACTION ERROR: Ambiguous invocation: use ">", "<", or "@" to request proper invocation
'OPCClient.VAQ' ⎕wi 'xValue >'
2
'OPCClient.VAQ' ⎕wi 'xTimestamp >'
4
'OPCClient.VAQ' ⎕wi 'xQuality >'
3
The XDisplayValue is returning the proper value but in characters. It is easy to convert it to a numerical value but would prefer to use the xValue property. Any idea that could help ?
Please Log in or Create an account to join the conversation.
I think the issue may come from the fact that in the interface, the result is typed as a generic VARIANT, and not IDAVtq. This is intentional, because some tools (namely, VBScript) cannot work with anything else. In addition, many tools use late-binding, meaning that you can take the returned object, specify a property on it, and it will see that the VARIANT contains IDispatch and it will use the type library/IDispatch to figure it all out.
Yours may be one of the tools that do not do this, and in these cases it is necessary to have some language construct that specifies that the returned value, while declared as VARIANT, is supposed to actually contain an IDAVtq pointer. Not knowing your language, I cannot currently tell how this is done. Is there any documentation describing the COM interoperability aspects of the language that I can look at?
Best regards
Please Log in or Create an account to join the conversation.
Thanks in advance.
Please Log in or Create an account to join the conversation.
If you are not seeing these objects, but a number instead, I think there is something done wrong on the consuming side of things.
Please Log in or Create an account to join the conversation.
Question 1: Is this number the numerical representation of the DAVtq ?
Question 2: In the affirmative how to 'decode' this numeric DAVtq to obtain the Value, Time and Quality ?
Thanks in advance.
Please Log in or Create an account to join the conversation.
- Forum
- Discussions
- QuickOPC-Classic in COM
- Reading, Writing, Subscriptions, Property Access
- How to Decode the DAVtq ?