This project has moved. For the latest updates, please go here.

Status() and GetShortStatus()

Developer
Apr 18, 2013 at 5:25 PM
Can I override the GetShortStatus method and/or the Status property of my CalculatedMeasurements adapter to produce status information specific to my adapter? If so, how can I invoke this during operation? I potentially want to use this mechanism to output troubleshooting information on command instead of using the OnStatusMessage method periodically. Is this something similar to INVOKE <ID> ExamineQueueState in terms of issuing a command?

Thanks!

Kevin
Coordinator
Apr 18, 2013 at 5:57 PM
Edited Apr 18, 2013 at 5:58 PM
Yes and yes. When you are on the console and type "LIST <myadapter>" you will see your short status and the results of the status property.

The short status is used when you just type "LIST /A", for example, this shows all action adapters and their short status.

The "INVOKE" command allows to mark a method in your class for remote invocation (assuming you have rights to this), allowing you to tell the adapter to "do something" or "show something" - whatever you need...

Hope that helps!
Ritchie
Developer
Apr 18, 2013 at 6:15 PM
Yes it does help! Thanks!

I briefly looked through the source code... so I should use something like this to invoked a method as a command?

[AdapterCommand("Description of my command/method")]
public void MyAwesomeNewCommand( )
{
// Do only really awesome stuff here
...
}

Thanks!

Kevin
Coordinator
Apr 18, 2013 at 6:59 PM
That's it! You can also return values from the function as well - although this is more useful when you have a console style connection from another application (like the openPDC Manager - it connects via a console style connection and INVOKEs commands all over the place, and sometimes does things with a return value - like when you request a config frame).

Ritchie
Coordinator
Apr 18, 2013 at 7:07 PM
Also don't forget about parameters - those are acceptable too. System just tries to parse types from strings entered on the console...

Thanks!
Ritchie
Developer
Jun 14, 2013 at 5:55 PM
If I want to now send parameters to my custom adapters command methods would I do it in the following way? :
[AdapterCommand("Description of my command/method")] 
public void MyAwesomeNewCommand( string parameter1, string parameter2, string parameter3) 
{ 
//Convert string parameters to their designated type here and

// Do only really awesome stuff here 
} 
and make the invocation from the command line:
INVOKE <RuntimeID> MyAwesomeNewCommand /parameter1 /parameter2 /paramter3
similar to how with the list command we can specify adapter type?:
 LIST /a; LIST /o; LIST /i
And as for System parsing the type, I assume you mean the following:
[AdapterCommand("Description of my command/method")] 
public void MyAwesomeNewCommand( int parameter1, double parameter2, string parameter3) 
{ 
// System automatically converts the types if possible
// Do only really awesome stuff here 
} 
and invoke in the exact same way?
INVOKE <RuntimeID> MyAwesomeNewCommand /parameter1 /parameter2 /paramter3
Thanks!!

Kevin
Coordinator
Jun 14, 2013 at 6:49 PM
You can use typed parameters - the console interpreter will do it's best to convert the string on the command line into the desired parameter type, even enumerations.

Just don't overload functions where the same method is only differentiated by something that might be interpreted the same way (e.g., int vs long).

Thanks!
Ritchie