For Enabler V3 and earlier versions - the answer is, "Yes you can". But the solution is Windows ONLY:
It requires the use of an ActiveX COM bridge to work. There are many options for this available some are listed below some are free and some may not do everything
We have tried COM plug-in for Eclipse. We found this worked well with our ActiveX controls and wasn't too hard to use. The rest of this document and example code were prepared using the COM plug-in for Eclipse.
This is easy to install and comes with samples, check out their website for more on the samples.
The plug-in works by generating two packages for each ActiveX/COM component. Each package must be created separately, each within a separate project. Once you have generated the packages required, you can add them all to your application project (or a separate assembly if you prefer).
The steps required to create the packages are:
Now there should be a project with all the COM components needed. Methods can be used to create an instance of EnbSessionX2 and EnbPumpX2 with GUI components
Creating a Session and making it invisible
EnbSessionX2Composite SessionComposite = new EnbSessionX2Composite(shell, SWT.NONE); Session = SessionComposite.getEnbSessionX2Automation(); SessionComposite.oleShow(); SessionComposite.setVisible(false);
Creating a Pump and assigning variables
EnbPumpX2Composite PumpComposite = new EnbPumpX2Composite(shell, SWT.NONE); Pump = PumpComposite.getEnbPumpX2Automation(); PumpComposite.oleShow(); Pump.setSession(Session); Pump.setNumber(int Number);
Unfortunately the generated package does not have very good support for the Enabler API objects (e.g. Delivery, Hose, Grade, and Tank). Some methods return IAutomationObjects and you can't directly cast these to the wrapper object class.
Due to this limitation, members of those objects must accessed via an IAutomationObject using the "getProperty", "setProperty", or "invoke" methods. These methods require the dispatch ID of the object member you want to access. These can be found in the class called I(name_of_object) in the package called (component_name) for example IDelivery contains the dispatch IDs for Delivery and is in (package name).psrvrlib. The help document has example code that shows how to do this.
An example for Pump returning a Delivery and then using Delivery to return the Delivery Type
Private IAutomationObject Delivery; Private Variant DeliveryType; Delivery = Pump.getCurrentDelivery(); DeliveryType = Delivery.getProperty(IDelivery.DISPID_FUNC_GET_TYPE); DeliveryType.getInt();
The Java sample code is provided as a guide only.
We have found that the GetSummary methods do not work correctly through the bridge. However the data returned by these functions is available using the Delivery, Hose and Grade objects.
If you want to use Eclipse and Java to develop your Enabler application we suggest you download our Eclipse Java pumpdemo sample. The sample code is provided to show how you can dynamically create the Pump controls, get delivery details, call methods, and implement event handlers.
If you are using Enabler V3.0 or later, the EnbOPTX control is also available. You will need to generate this control if you plan to use the OPT interface.
This sample application was created using the Enabler V3.0 ActiveX controls. If you are using an older version of Enabler your ActiveX control may not have some of the methods used in the sample code. For example .QuickAuthorise() and .QuickSaleSelect().
|IAutomation Object causes error when trying to use a method||This may be because you are using the wrong method to call that method. Check the type of method you are calling
IDelivery.DISPID_FUNC_GET_TYPE is a GET method
therefore getProperty will be used
IDelivery.DISPID_FUNC_SET_TYPE is a SET method
therefore setProperty will be used
IDelivery.DISPID_FUNC_INV_GETLOCK is an INV method
therefore invoke will be used
|Pump shows as not installed||This will happen if the session and number haven't been assigned to the pump correctly
Pump[i].setSession(Session); Pump[i].setNumber(int Number);