Sunday, 11 March 2018

J2ME FTP class for EHS6 and BGS5 modules

J2ME implementation of FTP class for EHS6 and BGS5 modules.



protected void startApp() throws MIDletStateChangeException {
        log = createLogger(FtpExampleApp.class, ILogger.DEBUG);   
        

    // Create ftp object with your GPRS settings, GPRS_APN, GPRS_USER, GPRS_PASS, GPRS_TIMEOUT
    FtpClient ftp = new FtpClient("internet","gprs_user","gprs_pass",45);
     ftp.setLogger(this.createLogger(FtpClient.class, ILogger.DEBUG));
        

    try {
       // make connection to you ftp server
        ftp.open("ftp.yourserver.nl", (short)21, "ftpuser", "ftppass");
           
      log.log(ILogger.DEBUG, "Uploading file to FTP...");
       // Upload file to ftp server
      ftp.putFile("upload.txt", "uploaded.txt", FtpClient.MODE_ASCII, false);
           
       ftp.changeDir("test");           
           
       log.log(ILogger.DEBUG, "Downloading file from FTP current /test directory ");
        // Download some other file from fto server to EHS6
        ftp.getFile("downloaded.txt", "log.txt", FtpClient.MODE_ASCII);
           
        ftp.close();
    } catch (FtpException e) {
            log.log(ILogger.ERROR, e.getMessage());
    } catch (IOException e) {
            log.log(ILogger.ERROR, e.getMessage());
    }
    destroyApp(true);
}

J2ME email class for EHS6, BGS

J2ME implementation of email protocols that can be used on EHS6 and BGS5 modules.

In this package we provide SMTP, POP3, IMAP implementation in J2ME.

Here is example code for using SMTP class for EHS6 :

protected void startApp() throws MIDletStateChangeException {
   log = createLogger(EmailTest.class, ILogger.DEBUG);   
   SmtpClient smtpClient = null;           
           
   try {               
     smtpClient = new SmtpClient("ehs6.demo@gmail.com", createLogger(SmtpClient.class,ILogger.DEBUG));
               
           
    if(!smtpClient.connected()) {   
   // MAIL_SERVER, SMTP_PORT, SSL, APN, GPRS_USER, GPRS_PASS, SMTP_USER, SMTP_PASS
                 smtpClient.open("smtp.gmail.nl",463,true,"internet","","","smtpuser","smtppass");           
   }
           
   log.log(ILogger.DEBUG, "putting message together...");
   // FROM_ADDRESS, TO_ADDRESS, SUBJECT_TEXT
    Message message = new Message("from@address", "to@address", "Email from EHS6 with SSL");
   message.beginTextMessage();           
   message.addBodyLine("EHS6 email test message");           
   message.closeMessage();
           
   smtpClient.sendMessage(message);               
           
   } catch (Exception e) {
      log.log(ILogger.ERROR, "ERR sending email!");
       e.printStackTrace();
   }
       
   finally {
     if (null != smtpClient) { try { smtpClient.close(); }
       catch (Exception ex) {     } 

     }
      smtpClient = null;
      destroyApp(true);
   }
 }

Thursday, 1 March 2018

EHS6 concept board hardware




Features;
Power supply by USB interface
Ease of access to EHS6 modules
On-board Java module
On-board Penta-band antenna
Mini SIM card
Shield interface
8 GPIO lines with level shifters
4 ADC inputs
Compatible with a range of Arduino shields
GSM/GPRS (Mobile Communications) - Enclosed