public class ScheduledActionManager extends Object
Modifier and Type | Method and Description |
---|---|
static void |
clearPendingActions()
Clear any pending action in the scheduled action manager which has NOT been started yet.
|
static int |
DynDnsUpdate()
Use the Scheduled Action Manager to send synchronize the eWON online IP address with a dynamic DNS server like NO-IP.
The function will push the request in the Scheduled Action Manager queue. |
static int |
getActionLogSize()
Read the number of actions in the scheduled action log.
|
static int |
GetFtp(String ServerSideFile,
String eWonSideFile,
String CnxParam)
Use the Scheduled Action Manager to read a file by FTP.
See also BASIC GETFTP command documentation. |
static int |
GetHttp(String CnxParam,
String FileName,
String FileUrl)
Use the Scheduled Action Manager to read an HTTP content.
See also BASIC GETHTTP command documentation. |
static int |
getNextActionId()
Read the Id of the next action that will be created.
|
static int |
NtpSync()
Use the Scheduled Action Manager to Posts a request for clock re-synchronization
The function will push the request in the Scheduled Action Manager queue. |
static int |
PutFtp(String FileName,
String Content,
String CnxParam)
Use the Scheduled Action Manager to send data by FTP.
The function will push the eMail request in the Scheduled Action Manager queue. |
static int |
PutHttp(String CnxParam,
String UrlForm,
String TextFields,
String FileFields,
String Response)
Use the Scheduled Action Manager to post an HTTP form.
See also BASIC PUTHTTP command documentation. |
static ScheduledAction |
readAction(int actionNdx)
Read an action from the scheduled action log defined by its index in the list.
|
static ScheduledAction[] |
readActionLog()
Read an array of
ScheduledAction
with all the actions in the scheduled action log. |
static ScheduledAction |
searchAction(int actionId)
Read an action from the scheduled action log defined by its ID
|
static int |
SendMail(String FromSrc,
String ToDest,
String CcDest,
String Subject,
String Content)
Use the Scheduled Action Manager to send an eMail.
The function will push the eMail request in the Scheduled Action Manager queue. |
static int |
SendSMSAction(String SMSDest,
String Message)
Use the Scheduled Action Manager to send an SMS.
See also BASIC SENDSMS command documentation. |
static int |
SensSMSAction(String SMSDest,
String Message)
For compatibility - see
SendSMSAction .See also BASIC SENDSMS command documentation. |
public static int SendMail(String FromSrc, String ToDest, String CcDest, String Subject, String Content) throws EWException
FromSrc
- The eMail address of the person sending the messageToDest
- The eMail address list of recipient. Each email address must be separated by ','CcDest
- The eMail address list of CC recipient. Each email address must be separated by ','Subject
- The text containing the eMail subjectContent
- The is the eMail text content. The dynamic eMail content syntaxt is usable and described
in detail in the eWON manual (export block descriptors inlined and attached to emails).
Example: SendMail("your_email@example.com","dest1@example.com,dest2@example.com","","Your Subject","The message");
This is an example with 2 recipients and no CC.
EWException
public static int PutFtp(String FileName, String Content, String CnxParam) throws EWException
FileName
- The destination file name (leave empty if sending multiple files)Content
- The destination file content. This content follows a special syntax allowing including EXPORT_BLOCK_DESCRIPTOR contentsCnxParam
- The connection nameCnxParam
is an empty string ("") then the config's FTP server definition is used.
Example: PutFtp("/ewon1/events","[$dtEV]","adm:adm@10.0.0.53:21,1");
This example will connect to 10.0.0.53 in passive mode.
EWException
public static int GetFtp(String ServerSideFile, String eWonSideFile, String CnxParam) throws EWException
EWException
public static int PutHttp(String CnxParam, String UrlForm, String TextFields, String FileFields, String Response) throws EWException
EWException
public static int GetHttp(String CnxParam, String FileName, String FileUrl) throws EWException
EWException
public static int SendSMSAction(String SMSDest, String Message) throws EWException
EWException
public static int SensSMSAction(String SMSDest, String Message) throws EWException
SendSMSAction
.EWException
public static int DynDnsUpdate() throws EWException
EWException
public static int NtpSync() throws EWException
EWException
public static void clearPendingActions()
public static ScheduledAction readAction(int actionNdx)
actionNdx
- The index of the action in the action log.
The index starts at 0 and goes up to getActionLogSize
.
Important: the log is a circular buffer, so action with index 0 is not often the oldest one.
ScheduledAction
object.This object has a number of properties describing the action.
public static ScheduledAction searchAction(int actionId)
actionId
- The eWON has a global counter which is increased at every new action.
When a new action is created it receives the current actionId. The actionId is different
for every new action, it can then be used to return information on a specific action.
If the last action must be fetched getNextActionId()
can be used (-1 for last action)
The following example shows how to read the whole log from the last action and print som info .
int actionLogSize = ScheduledActionManager.getActionLogSize(); int nextActionId = ScheduledActionManager.getNextActionId(); while ((actionLogSize--)>=0) { nextActionId--; try { ScheduledAction scheduledAction = ScheduledActionManager.readAction(nextActionId); System.out.println("Id: "+scheduledAction.getId()+" ---------------------------"); System.out.println("TypeStr: "+scheduledAction.getTypeAsString()); } catch (Exception e) { System.out.println("Error readSamTest: "+e.toString()); } }
ScheduledAction
object.This object has a number of properties describing the action.
public static ScheduledAction[] readActionLog()
ScheduledAction
with all the actions in the scheduled action log.ScheduledAction
.This array is ordered from the newer action to the oldests (ie from the higher action id to the smaller).
public static int getNextActionId()
public static int getActionLogSize()
This function is used with readAction(int)
to known the number of
actions that can be feteched.
This number is limited by the size of the Action Log.