Tech Note – SMA Objects
th
<Date April 18 , 2008> – Rev. A
©Copyright InduSoft Systems Ltd. 2008
SMA Custom Objects
Introduction
This document describes the COM Objects created to make it possible to develop the Mobile Access Interface
for the Studio SCADA software.
Session Object
The session object creates a login session. See examples in the files functions.inc and logon.asp.
Object Instantiation
The object can be instantiated in VBScript using the following command:
Set session = CreateObject("SMA.Session")
Remarks
The SMA Session is kept internally by the server. The Session object simply provides access to existing sessions and
the unique identifier by a session is the session cookie (see CreateCookie method). Therefore, in order to establish a
connection this is what needs to be done:
- Create a session object
- Call the CreateCookie Method
- Call the LogOn function
To access a session that has already been created, the following should be done:
- Create a session object
- Set the property Cookie
- Check the property IsValidCookie
For details on how this is done by the SMA, please check the following functions:
functions.inc: chkCookie, chkLogon
Logon.asp: Logon function
Methods
Function LogOn(user, password, expiration)
Description
Checks the user logon and keeps the information for the session.
Parameters
User: User Name
Page 1/5
Tech Note – SMA Objects
th
<Date April 18 , 2008> – Rev. A
©Copyright InduSoft Systems Ltd. 2008
Password: Logon password
Expiration: Idle time to expire the user Log On.
Return Values
True: The user is valid and is logged on
False: Invalid user or passord
Sub CreateCookie( key )
Description
Creates a cookie for a session. Sessions are kept in the list based on their cookie, the key must be unique for that
session. SMA currently using the Remote IP as a key for a session.
Parameters
key: Unique value that identify a connection with a specific client.
Return Values
The method has no return values, but it will fail if the cookie already exists. Therefore, before calling this function
always check with the IsValidCookie (see functions.inc, chkCookie method).
Sub Destroy()
Description
Destroys the current session
Remarks
This method should be used in the logoff.
Properties
IsValidCookie As Bool
Description
Returns true if the cookie exists for the current session.
Page 2/5
Tech Note – SMA Objects
th
<Date April 18 , 2008> – Rev. A
©Copyright InduSoft Systems Ltd. 2008
IsValidLogon As Bool
Description
Returns true if the last call to the Logon for the current session returned successfully.
IsValidLevel(level) As Bool
Description
This property returns true if the level specified in the parameter level is within the acceptable boundaries for the user
currently logged on.
Alarms Object
The Alarms returns a list of alarms. See examples in the file Alarms.asp
Object Instantiation
The object can be instantiated in VBScript using the following command:
Set session = CreateObject("SMA.Alarms")
Remarks
The Alarms object is a very simple interface to retrieve a list of alarms and acknowledge alarms.
Methods
Sub Ack(session, tag, alarmtype, comment, station)
Description
Acknowledges an active alarm.
Parameters
session: A valid instance of a session object
tag: Tag Name
Alarm Type: Type of the alarm being acknowledged
Comment: Alarm comment
Page 3/5
Tech Note – SMA Objects
th
<Date April 18 , 2008> – Rev. A
©Copyright InduSoft Systems Ltd. 2008
Station: Alarm station
Return Values
The method has no return values, but it will fail if the session is invalid.
Properties
NumItems As Long
Description
Returns the number of active alarms.
Item(Index) As AlarmItem)
Description
Returns the information for a specific alarm item based on the alarm item index. The AlarmItem has the following
properties: Tag, Message, TimeStamp, State, Type.
Tags Object
Returns data from tags in the tags database. See examples in the file Tags.asp.
Object Instantiation
The object can be instantiated in VBScript using the following command:
Set session = CreateObject("SMA.Tags")
Remarks
Use this object to retrieve and set tag data in the tags database.
Properties
Value(tag) as String
Description
Page 4/5
Tech Note – SMA Objects
th
<Date April 18 , 2008> – Rev. A
©Copyright InduSoft Systems Ltd. 2008
Use this property to read or set a tag value.
Type(tag) as Integer
Description
Use this property to retrieve a tag type.
Map of Revision
Revision Author Date Comments
Lourenço th
A April 18 2008 Initial Revision
Teodoro
Page 5/5