Vm201 Instructed by Java Routine

Dear all,

I have got the Vm201 Board now for about 1 year, but spent so far more time and effort to integrate the Vm110 and Vm140 in my medical environment. Now to proceed the integration of the Vm201 in the same environment I developed a small java routine which proceeds the Request-Response of the Vm201 instructions. The global purpose is obviously to control Relays on/off and their timing respectively. All of this is being managed by external web application instructing the board, like deciding Relays On/Off, Timing, Alerts sent by mail, Last situation at Power fail etc.

I only need the use of Relays. The Url below seems not to be documented, unless I’m wrong, but it works great. Timing is handled outside the board, but you can instruct timers in the same way.
The return of the Status is Body-like Xml but the head is missing. So in order to Parse the body properly, you must insert a Xml head on top of the return string.

IpAddress/cgi/leds.cgi?led=0?led0=1 (To Switch On Relay 1)
IpAddress /cgi/leds.cgi?led=0?led0=0 (To Switch Off Relay 1)

I’m happy to share this java app, hope this help.
Foxy

import java.util.;
import java.io.
;
import java.net.*;

public class MdsVm201 {
public String MdsClientVm201()
{return “Constructor for MdsVm201” ;}

public static void main (String args[]) {
MdsVm201 t = new MdsVm201();
String s = t.MdsClientVm201(args[0],args[1],args[2],args[3]);
}
public String MdsClientVm201(String Vm201Instruction, String Parm1, String Parm2, String Parm3) {

      try {
          URL u = new URL(Vm201Instruction);
          URLConnection uc = u.openConnection();
          HttpURLConnection connection = (HttpURLConnection) uc;
          connection.setDoOutput(true);
          connection.setDoInput(true); 
          connection.setRequestMethod("POST");
          OutputStream out = connection.getOutputStream();
          OutputStreamWriter wout = new OutputStreamWriter(out, "UTF-8");
  
          wout.flush();
          out.close();
  
          InputStream in = connection.getInputStream();
          int c;     
          boolean Append;
          Append = true;
          String Message;
          Message = "";
          
          while ((c = in.read()) != -1) {
        	 Message = Message + new Character((char)c).toString();
  	          }

          in.close();
          wout.close();
          connection.disconnect();
          return Message;
          }
           catch (Exception e) {
           String Message;
           Message = "MdsVm201 - Failure : " + e;     
           return Message;
           }

}
}