Android Smart House eHouse control by form of the List
Sending events from Android software – Select from the list
This article describes how to write software for system control panels eHouse working on the platform ANDROID .
They can be :
- Tablets
- Mobile Panels
- GSM Mobile Phones
- SmartPhone
- touchphone
- PDA
- PADs
- SMART TV
- TV SAT Tuners
- Audio Equipment – video
- any hardware running the Android operating
eHouse Smart Home can be controlled by the choice fields and the events list .
The event is automatically sent (after pressing “Send” ) The WiFi system or via the Internet if the Internet connection option is enabled .
If for any reason there is no TCP/IP (WIFI , INTERNET ( GSM , EDGE , 3G , 4G or another dependent on the type of control panel) event is added to the queue , which can be sent manually to the controller on one of the available methods in eHouse system and possible to achieve in a given type of panel and the range of communication links and protocols.
For this purpose, the generated class ” RunEvent.class ” , which uses alone all operations :
- Loads a list of devices ( controllers) and their settings generated from the application eHouse.exe
- Loads a list of events for each controller
- Allows you to choose any event from a letter to send to the system eHouse
- It allows you to send events to the controller by pressing ” Send ”
Use this control method does not require the creation of complex visualization and is the simplest method of remote intelligent home eHouse .
Screenshots form :
Developing calendar lists events and multiple .
Develop a list of devices ( controllers) –
tip ” – E ” ordinary events ,
tip ” – P ” event – programs ,
without suffix all events
Develop a list of events for security driver CommManager ( Zones of Protection and Security ) .
Sending events via WiFi , Internet (3G , GPRS , 4G , EDGE or other link subject to availability ) when you press
” Run Event ” or ” Run And Hide Event ” .
Descriptions are taken from a text configuration file that you can create other language versions and their own individual descriptions .
Use of the module requires only a few lines of source code .
Sample source code to control a smart home from touch panels , smartphones , Android tablets . It also uses visualization , to show how its integration with the form control
/ * EHouse For ANDROID panels , tablets , PDAs , Smartphones template API for communication to the eHouse system
* ONLY FOR REGISTERED USERS , VENDORS , COOPERATIVES Copyright iSys . En All Rights Reserved
*
* Requires classes :
* !!!!!! . class :
* Sending Events is eHouse system via:
* SMS , eMail , WIFI , INTERNET , ETHERNET , TCPIP * !!!!!! . class :
* Initiate TCP Communication for updating the current status of devices
* Performing Query status from eHouse microcontrollers
* Assuring challange – Authorisation response to the system and communication
*
* !!!!!! . class :
* Organize classes of devices ( names , actual status values etc )
* Fill up with actual values and the date of eHouse1 controllers
* ( 485 )
* !!!!!! . class :
* Organize classes of devices ( names , actual status values etc )
* Fill up with actual values and data of Ethernet controllers eHouse
* (Ethernet )
*
*
* Application Template Steering (API ) for ANDROID platform to communicate with the system eHouse and Visualization System Status
* ONLY for registered users of the system eHouse , Cooperating Firm All Rights Reserved
*
* Requires class :
*
* !!!!! . class :
* Sends system events (commands ) to the system drivers eHouse by :
* SMS , eMail , WIFI , INTERNET , ETHERNET , TCPIP
*
* !!!!! . class :
* Initiates and maintains TCP / IP communication with drivers to update the state
* Drivers eHouse – output , measuring inputs eHouse
* Provides authentication method challange – response to the connection to the system
*
* !!!!! . class :
* This class contains all the settings and current data for each driver eHouse
* For further processing ( name , values , status) updated on a regular basis by the TCP / IP
* For drivers eHouse1 ( 485 )
* !!!!! . class :
* This class contains all the settings and current data for each driver eHouse
* For further processing ( name , values , status) updated on a regular basis by the TCP / IP
* For drivers eHouse2 (Ethernet )
*
* !!!!!! . Sending events to the class system of the form to select a device from the list and zdarzenienia and its sending by pressing via WiFi , Internet or adding to the queue in the absence of connection ( can be then sent manually by SMS , e-mail or other methods available in the system) .
// Option requires a class for graphical visualization and control
//
* !!!!! . class : class implements a complete graphical visualization and standard eHouse graphic control in accordance with the format of the input files ehouse
* For visualization .
* Draw basic curves (rectangle , rounded rectangle , ellipse , line , text
* Runs events related to graphical objects when activated (sending the WiFi or internet link available GSM or other ) .
* Visualization is automatically updated each time you receive a status of drivers .
* The module supports gestures swiping your finger – causes the image in certain directions gesture
* With multitouch screens also supports scaling ( zoom in and out )
*
*
* /
package ehouse . android ;
import android . app . Activity ;
import android . os . Bundle ;
import android . view . KeyEvent ;
import android . widget . toast ;
import java . util . Date ;
import android . content . context ;
public class extends Activity ehouseandroid
{
Public visualization vs ; // object for visualization optional / optional module for visualization remove as not used
static boolean firsttime = true ; // first run flag
TerminatedUpdates boolean = false ;
Date date ;
context context ;
RunEvent RE = null ; // Form to send events to the driver selection list
//////////////////////////////////////////////////
// Set Form to display
// Choice of form for display on Visualization and form a list of events
//
setView void ()
{
try
{
switch ( ehousecommunication . CurrentForm )
{
case ehousecommunication . TEXT_EVENTS : // form displays a list of events to be sent
setContentView (RE . sv ) ; break ;
case ehousecommunication . VISUALIZATION : // optional visualization , optional graphical visualization and control
setContentView ( vs ) ; break ;
default: setContentView (RE . sv ) ; break ;
}
}
catch ( Exception e )
{
MessageBox ( e . getMessage ()) ;
}
}
//////////////////////////////////////////////////
Override
public void onCreate ( Bundle savedInstanceState )
{
super.onCreate ( savedInstanceState ) ;
if ( firsttime == true) ehousecommunication.init () ;
vs = new visualization (this , 100 , 100 , 1 ) ; // Instance optional graphical visualization and control
RE = new RunEvent () ;
RE.Init( this) ;
if ( firsttime == true)
{
/ * Initate and setup Android Application from config files generated from eHouse . exe appliaction
*
* Initializes the settings application on the Android platform generated from the application eHouse . exe
* /
/ *
* Setup and Init List of Devices class containing :
* Names and Values digital input , aDC inputs , outputs ,
* { StatusEhouse for eHouse 1 devices , StatusCommManager for eHouse 2}
*
* Iniciuje device ( Class) { Class StatusEhouse drivers for drivers eHouse1 , Class StatusCommManager for drivers eHouseTCPIP }
* Sets the name of the digital outputs , digital inputs , measuring inputs for drivers and changing the status of the drivers received by panels
* /
EhouseTCP.AllDevsStatus () ;
EhouseTCP.AllDevsTCPStatus () ;
EhouseTCP.ReadViewFile ( ehousecommunication.currentview ) ; // Reads file for visualization (Optional )
/// Visualisation
/ * Start infinite loop for reading the query from eHouse controllers and putting it
* StatusEhouse and StatusCommManager Classes .
* Can be interrupted by EhouseTCP . TerminateQuery () ; function
* Initiates an infinite loop current status data retrieval ( query) with drivers and
* Loading the class StatusEhouse and StatusCommManager
* Can be interrupted by functions EhouseTCP . TerminateQuery ()
* /
/ * Query start * /
EhouseTCP.Query.start() ;
/ *
* Terminate query eHouse controllers for information
*
* If you stop updating the drivers for information on how to do
*
* /
// EhouseTCP . TerminateQuery () ;
/ *
* Clear Event Queue to send ( after successful transmition via any method ) performed automatically box
*
* Clears the event queue to be sent ( automatically removes events after przasłaniu any method )
*
* /
// ehousecommunication . ClearEventQueue () ;
setTitle ( ” eHouse : ” + ehousecommunication . currentview ) ; // displays the application title from the name of the thumbnail graphic visualization
}
else // not first time
{
setTitle ( ” eHouse : ” + ehousecommunication . currentview ) ; // displays the application title from the name of the thumbnail graphic visualization
// EhouseTCP . UpdateVisualization () ;
// EhouseTCP . UpdateViews () ;
// vs . Inav () ;
}
SetView () ; // sets SetContextView for the screen
firsttime = false ; // flag off the first run initialization
}
//////////////////////////////////////////////////
//////////////////////////////////////////////////
public void cap (String str)
{
setTitle ( p ) ;
}
//////////////////////////////////////////////////
public void MessageBox (String message)
{
toast . Maketext (this , message , toast . LENGTH_SHORT ) . show () ;
}
//////////////////////////////////////////////////
// Sample Software hardware buttons mobile phone
Override
public boolean onKeyDown (int keycode , KeyEvent event)
{
if ( keycode == KeyEvent.KEYCODE_MENU ) // menu available
{
MessageBox ( ” menu ” ) ;
}
if ( keycode == KeyEvent.KEYCODE_BACK ) // back for smartphones
{
MessageBox ( ” Back ” ) ;
}
if ( keycode == KeyEvent.KEYCODE_HOME ) // parent does not support
{
MessageBox ( ” Home ” ) ;
}
if ( keycode == KeyEvent.KEYCODE_SEARCH ) // search short long service automatically search
{
MessageBox ( ” Search ” ) ;
}
if ( keycode == KeyEvent . KEYCODE_VOLUME_DOWN )
{ /// Switch visualization / Form and other backward
if ( ehousecommunication.CurrentForm < ehousecommunication . FORM_MAX ) ehousecommunication.CurrentForm ++ ;
else ehousecommunication.CurrentForm = 1 ;
SetView () ;
}
if ( keycode == KeyEvent.KEYCODE_VOLUME_UP )
{// Switch visualization / Form and other forward
if ( ehousecommunication.CurrentForm > 0) ehousecommunication.CurrentForm– ;
else ehousecommunication.CurrentForm = ehousecommunication.FORM_MAX ;
SetView () ;
}
return false ; // otherwise we lose the back of the application and exits
// super.onKeyDown ( keycode , event) ;
}
}