background image

Running i!-EquipmentMonitor

4

 i!-EquipmentMonitor

Now, all you need to do is call the function that sends an email. If you want to send an email every 

time someone presses a button on a touch panel, your code would look like this:

BUTTON_EVENT[dvTP,1]

{

  PUSH:

  {

    SmtpQueMessage('[email protected]',

                                  '[email protected] ',

                                  'My Emails subject’,

     'this is the body of my email!  Wow, this is Cool!',

                                  '')

  }

}

The call to 

SmtpQueMessage()

 causes your email to queue and transmit to the SMTP server. The 

maximum number of emails that can be queued is controlled by the constant 

SMTP_MAX_EMAILS

which defaults to 10. You can override this value if you choose; you will probably never have a 

need to since the emails are sent very quickly.

The parameters to 

SmtpQueMessage()

 control where your email will be sent. The first parameter 

is the From Email Address. This usually does not have to be a real email address but some SMTP 

server configurations may require a valid one. It is best to obtain an email address from your email 

administrator.

The second parameter is the To Email Address. This can be a list of addresses separated by a ";" so 

you can send an email to more than one recipient in a single call to 

SmtpQueMessage()

. The next 

two parameters are the subject and message of the email. The message can be up to 

SMTP_MSG_MAX

 characters long (the default value is 2000 but you can override it if necessary).

The last parameter is an attachment file name. If you supply a value for this parameter, 

i!-EquipmentMonitorOut attempts to open this file from the Master’s file system and include it as 

an attachment to the email. Binary files are not supported at this time so the file must be ASCII 

(text) only. If the file does not exist or cannot be opened, an error is printed to the terminal, but the 

email is still sent without an attachment.

Receiving Email

To support receiving email, first include the i!-EquipmentMonitorIn.axi (page 11) into you 

program:

#INCLUDE 'i!-EquipmentMonitorIn.axi'       // Include to get email

Next, make sure that the default IP local port used by i!-EquipmentMonitorIn.axi is available on 

your system. 

i!-EquipmentMonitorIn.axi uses local port 0:11:0 for sending emails. Make sure there is no current 

entry in your 

DEFINE_DEVICE

 section for 0:11:0. If there is a current entry for 0:11:0, you can 

change the existing entry to another local port number or override the default local port used by i!-

EquipmentMonitorIn.axi like this in the 

DEFINE_DEVICE

 section:

dvPop3Socket  =  0:4:0

Next, you need to initialize the POP3 server value by calling 

Pop3SetServer ()

. You will need 

the name or IP address of your local POP3 server, provided by your Network administrator. Using a 

name for the server is acceptable if you have DNS properly configured on the NetLinx Master. 

Otherwise, you will need an IP address. Once you have the correct POP3 server name or address, 

call Pop3SetServer like this:

Summary of Contents for i!-EquipmentMonitor

Page 1: ...instruction manual integration Solutions i EquipmentMonitor ...

Page 2: ... any accompanying hardware This limited warranty gives you specific legal rights You may have others which vary from state country to state country NO LIABILITY FOR CONSEQUENTIAL DAMAGES In no event shall AMX Corporation be liable for any damages whatsoever including without limitation damages for loss of business profits business interruption loss of business information or any other pecuniary lo...

Page 3: ...Minimum PC Requirements 1 Installing i EquipmentMonitor 2 Running i EquipmentMonitor 3 Sending Email 3 Receiving Email 4 Configuring for Timezone 6 i EquipmentMonitorOut axi 7 Constants 7 Structures 8 Variable 8 Functions 8 i EquipmentMonitorIn axi 11 Constants 11 Structures 11 Variables 11 Functions 12 ...

Page 4: ...ii i EquipmentMonitor Table of Contents ...

Page 5: ...onitorTest axs is a test program using both i EquipmentMonitorIn axi and i EquipmentMonitorOut axi Supported Operating Systems Windows 95 98 with at least 48 MB of installed memory Windows NT 4 0 Workstation or Server service pack 6 B or greater with at least 64 MB of installed memory Windows 2000 Professional or Server running on a Pentium 233 MHz processor minimum requirement 300 MHz or faster r...

Page 6: ...se all Windows programs before going any further Click Next to proceed 4 In the Select i EquipmentMonitor Install Location dialog use the Browse button to navigate to a directory other than the default install directory if desired Click Next 5 In the i EquipmentMonitor Shortcut Creation dialog select Install Shortcut Icons for the installed components on your desktop if desired 6 Click Next in the...

Page 7: ...calling SmptSetServer You need the name or IP address of your local SMPT server which you can obtain from you Network administrator Using a name for the server is acceptable if you have DNS properly configured on the NetLinx Master Otherwise you need an IP address Make sure to use the SMPT server value here Often the email server refers to the POP3 server most likely this is not what you need Once...

Page 8: ...e is 2000 but you can override it if necessary The last parameter is an attachment file name If you supply a value for this parameter i EquipmentMonitorOut attempts to open this file from the Master s file system and include it as an attachment to the email Binary files are not supported at this time so the file must be ASCII text only If the file does not exist or cannot be opened an error is pri...

Page 9: ...in three different variables sPop3EmailMessage nPop3QtyMail and nPop3TotalMail nPop3QtyMail and nPop3TotalMail tell you how many email messages were retrieved up to POP3_MAX_EMAILS default 20 and how many emails were on the server when i EquipmentMonitor last logged in Up to POP3_MAX_EMAILS are downloaded and all other emails if any remain on the server until you retrieve them again sPop3EmailMess...

Page 10: ...elete any emails you like by calling Pop3ClearEmailMessage or Pop3ClearAllEmailMessages Pop3ClearEmailMessage allows you to delete one email at a time Pop3ClearAllEmailMessages allows you to delete all the emails at once Configuring for Timezone The i EquipmentMonitorOut axi file can read the time zone information from i TimeManager and includes this information in email and notifications Simply i...

Page 11: ...clude file SMTP_PORT IP Port that the SMTP server is listening on default 25 SMTP_SERVER_TO Timeout in 1 10 for contacting the SMTP server default 1200 SMTP_URL_MAX Maximum length for e mail server name default 1000 SMTP_USER_MAX Maximum length for e mail addresses default 500 SMTP_LINE_MAX Maximum length for date subject and attached file default 256 SMTP_MAX_EMAILS Maximum length for number of q...

Page 12: ...File SmtpQueMessage has these arguments Source String containing the senders e mail address Dest String containing the recipients e mail address or addresses Subject String containing the subject of the e mail Message String containing the message body of the e mail File String containing the ASCII text only file name to attach to the e mail SmtpQueMessage returns these values 1 If the message was...

Page 13: ... 9 00 0800 Hong Kong SAR UTC 8 00 0700 Bangkok Hanoi Jakarta UTC 7 00 0300 Baghdad Kuwait Riyadh UTC 3 00 0200 Israel UTC 2 00 0600 Mexico City Tegucigalpa UTC 6 00 0600 Central America UTC 06 00 0200 Jerusalem UTC 2 00 0300 Nairobi UTC 3 00 Example SmtpSetTimeOffset 0600 Remarks SmtpSetTimeOffset should be called to configure i EquipmentMonitor to send emails with the correct time Some SPAM detec...

Page 14: ...he senders email address Dest String containing the recipients email address or addresses Subject String containing the subject of the email ConfigNotify does not return a value Example ConfigNotify user2 test com user1 test com Equipment Notification Room 301 Remarks ConfigNotify should be called in DEFINE_START of your application You must also call the SmtpSetServer Function The To parameter ca...

Page 15: ...of message retrieved from server VOLATILE Integer nPop3TotalMail Number of total messages on server VOLATILE CHAR bPop3Debug Set to 1 to debug i EquipmentMonitorIn axi Constants dvPop3Socket The IP device number for sending e mails default 0 11 0 POP3_VERSION Version number of the include file POP3_PORT IP Port that the POP3 server is listening on default 110 POP3_BUFFER_MAX Maximum size of buffer...

Page 16: ...nvalid the e mail was deleted successfully Example Pop3ClearEmailMessage 1 Remarks Pop3ClearEmailMessage should be called when you want to delete a message from the internally stored e mail list Deleting an e mail from the internally stored list will most likely affect message ordering Pop3ClearEmailMessage updates nPop3QtyMail and nPop3TotalMail accordingly This function does not delete an e mail...

Page 17: ...tically retrieved from the server By default e mail is not retrieved from the server automatically Pop3SetServer Sets Your POP3 Server Name for your use Syntax Pop3SetServer CHAR Server Pop3SetServer has these arguments Server String containing the name or IP of your e mail POP3 server Example Pop3SetServer mail amx com Remarks Pop3SetServer should be called in DEFINE_START of your application Pop...

Page 18: ...ive richardson TX 75082 USA 469 624 8000 800 222 0193 fax 469 624 7153 technical support 800 932 6993 033 004 2549 6 05 2005 AMX Corporation All rights reserved AMX the AMX logo the building icon the home icon and the light bulb icon are all trademarks of AMX Corporation AMX reserves the right to alter specifications without notice at any time In Canada doing business as Panja Inc ...

Reviews: