Can I call Basic functions from Java or Java functions from Basic?


#1

Can Basic and Java code interact with each other?


#5

It is entirely possible to interface with the BASIC engine from Java and from JAVA to BASIC, though it is quite a bit easier to interface with BASIC from JAVA.

JAVA to BASIC

Many of the core functions that exits in BASIC have an equal method in JAVA. There may however be those functions that do not exist in JAVA. This can require you to interface with the BASIC Engine by sending your requests to the ExeScriptForm. The ExeScriptForm is an internal form in the eWONs internal system that can execute scripts on the eWON.

Lets say that we have a function in our eWON to turn on a boolean called: enableBool, we could call this function from Java by doing something like:

public static void main(string[] args){
    String form = "ExeScriptForm";
    String ewonRoot = "192.168.100.1/rcgi.bin";
    String postParam = "Command1=@enableBool";
    int res = ScheduledActionManager.PutHTTP(ewonRoot, form, postParam, "");

}

Note: This example is not perfect and needs to be tested and validated.



Now as I previously mentioned, BASIC to JAVA requires quite a bit more effort. In order to call Java from BASIC we need to add a form listener inside of the JAVA engine and call that url from BASIC via a PUTHTTP or a REQUESTHTTPX command.

A good example can be found here:

https://developer.ewon.biz/content/custom-configuration-page-java