Thesis 062208P

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 82

Design and Development of Home Automation System

Controlled through Short Message Service (SMS)

Md. Anowar Hossain

DEPARTMENT OF ELECTRICAL & ELECTRONIC ENGINEERING


DHAKA UNIVERSITY OF ENGINEERING AND TECHNOLOGY, GAZIPUR

January 2009
Design and Development of Home Automation System
Controlled through Short Message Service (SMS)

A thesis
submitted to the Department of Electrical and Electronic Engineering, DUET,
Gazipur in partial fulfillment of the requirements for the degree

of

MASTER OF ENGINEERING IN ELECTRICAL AND ELECTRONIC


ENGINEERING

by

Md. Anowar Hossain

DEPARTMENT OF ELECTRICAL & ELECTRONIC ENGINEERING


DHAKA UNIVERSITY OF ENGINEERING AND TECHNOLOGY, GAZIPUR
January, 2009
The thesis titled “Design and Development of Home Automation System
Controlled through Short Message Service (SMS) submitted by Md. Anowar
Hossain, Student No.: 062208P. Session: 2006 – 2007, has been accepted as
satisfactory in partial fulfillment of the requirement for the degree of Master of
Engineering in Electrical and Electronic Engineering on ______________.

Board of Examiners

1.
………………………………………..
(Dr. Md. Shaheen Hasan Chowdhury) Chairman
Professor & Head, Dept. of EEE
(Supervisor)
DUET, Gazipur.

2. ……………………………………….
Member
(Mr. Md. Abdul Mannan)
Associate Professor Dept. of EEE
DUET, Gazipur.

3. ………………………………………. Member
Palash Kumar Banerjee…
Asstt. Professor, Dept. of EEE
DUET, Gazipur-1700.

4. ………………………………………..
Member
(Mohammed Sazzat Hossain)
Asstt. Professor, Dept. of EEE
DUET, Gazipur.

5. ………………………………………..
(Dr. Md. Sekendar Ali) Member
Professor, Head (External)
Dept. of EEE
The University of Asia Pacific, Bangladesh.
DECLARATION

I hereby declare that this thesis or any part of the thesis has not been submitted
elsewhere for the award of any degree or diploma.

Signature of the candidate

Md. Anowar Hossain


ACKNOWLEDGEMENT

I would like to express my gratitude and profound indebtedness to my supervisor


Professor Dr. Md. Shaheen Hasan Chowdhury, Head, Department of Electrical and
Electronic Engineering of Dhaka University of Engineering and Technology, Gazipur
for his guidance, inspiration and helpful support throughout my thesis work. I am
grateful to my thesis co-supervisor Mohammad Shazzat Hossain, Assistant Professor,
Department of Electrical and Electronic Engineering of Dhaka University of
Engineering and Technology, Gazipur for his continuous help, without which the
work could not have been completed for their continuous inspiration to complete my
work within the time frame.

I would like to express my gratitude and specially thanks to Md. Abdul Mannan,
Associate Professor, Department of EEE of DUET, for his cordial help and valuable
suggestions. I would like to thank my family members and relatives for their constant
encouragements.

I would like to convey my utmost gratitude towards my friends for their help and
invaluable supports throughout this research work. I am also grateful to all of my
colleagues.

I am also indebted to the librarian and the staffs of Dhaka University of Engineering
and Technology for their assistance.

January, 2009 Md. Anowar Hossain


ABSTRACT

Home automation is a specialized system used for controlling the electromechanical


appliances used in private home. The automation system includes the switching
ON/OFF control of light, fan, air-cooler etc; opening and closing control of door,
window shutter etc; security and alarm control etc. The automation system is achieved
in three ways: wired control, wireless control and both wire and wireless control. In
this project, wireless control approach is employed to design and develop the
proposed home automation system. The existing wireless networking system of
Bangladesh, which is used for cellular communication, is applied to design the
controlling system. In cellular system, the mobile phone companies offer various
services to the subscribers. Short Message Service (SMS) is a very essential and
useful service of mobile phone to the user. This one way communication method is
used to exchange text message. In this report, an extensive application of SMS is
recommended where this service is used to switching ON/OFF control of home
appliance. In this work an appliance controlling SMS is received by a mobile phone
which is sent from a remote mobile phone. The receiving mobile phone should have
infrared facility and logically connected with a PC through infrared USB. The
controlled devices are also connected with the PC through parallel port. The proposed
automation scheme is comprised on both software and hardware. The software
provides a logical interfacing between the receiving mobile and the PC. To read the
SMS from the receiver mobile phone application software named ‘SMS and Pager
Toolkit’ is used. A customize software written in Visual Basic is developed to
generate necessary switching signal from the text message (SMS). The switching
signal is then sent to the parallel port of the PC. The IO.dll file provides necessary
functionalities for this. The hardware is designed to provide electrical connections to
the switches of the appliances. The hardware includes a step down transformer, signal
conditioning circuit and relays. The entire work is designed, implemented and tested
and found its performance satisfactory. The system can be modified for sophisticate
controlling the wide range of equipments.

(vi)
ABBREVIATIONS

ASCII American Standard Code for International Interchange


ASP Active Server Pages
CDMA Code Division Multiple Access
GSM Global System for Mobile Communication
JDK Java Development Kit
MAP Mobile Application Part
PDU Protocol Data Unit
PSTN Public Switched Telephone Network
SDK Software Development Kit
SIM Subscriber Identity Module
SMPP Short Message Peer to Peer
SMSC Short Message Service Center
SMTP Simple Mail Transfer Protocol
TDMA Time Division Multiple Access
USB Universal Serial Bus
WAP Wireless Application Protocol
CONTENTS

Page
No.
Board of Examiners iii
Declaration iv
Acknowledgement v
Abstract vi
Abbreviations vii

Chapter – 1: Short Message Service

1.1 Introduction … 01
1.2 Short Message Service (SMS) … 01
1.3 Short Message Service Center (SMSC) … 03
1.4 SMS-Wireless Application Protocol (WAP) … 05
1.5 Benefits of SMS … 06
1.6 SMS Support on Different Networks … 08
1.7 SMS Tools (eSMS-C) … 08
1.8 Java SMS Development Kit … 10
1.9 PC Connectivity Software Development Kit … 11
1.10 SMS Gateway … 11
1.11 SMS Application … 11
1.12 Objectives of the Thesis … 13
1.13 Organization of the Thesis … 13

Chapter – 2 : SMS and Pager Toolkit

2.1 Introduction … 14
2.2 SMS and Pager Toolkit Features … 14
2.3 The development Language … 15
2.4 Hardware Requirements … 15
Page
No
2.4.1 Network Cards with SMPP protocol … 15
2.4.2 GSM Modems … 16
2.4.3 GSM Phones with AT+C Modem Command … 16
Support
2.4.4 Hayes Compatible Modems (1200 bps or higher) … 16
2.4.5 SMS and Pager Toolkit Architecture … 17
2.5 System Requirements … 17
2.5.1 NET Framework … 18
2.5.2 Internet Information Server … 18
2.5.3 Internet Explorer 4.x or higher … 18
2.5.4 Windows scripting host (WSH) … 18
2.5.5 Programming Environment … 18
2.6 Installation Process … 19
2.6.1 Automatic Installation … 19
2.6.2 Manual Installation … 19
2.7 SMS and Pager Toolkit … 19
2.8 Error Codes and Constants … 21
2.8.1 Error Codes … 21
2.8.2 Constants … 21
2.9 The Objects …. 21
2.9.1 GsmOut Object … 21
2.9.1.1 Sending SMS message via GSM modem … 23
2.9.2 GsmIn Object … 29
2.9.2.1 GsmIn Object- Introduction … 31
2.9.2.2 Delete Messages from the GSM storage … 32
after receive
2.10 Smpp Object … 37
2.10.1 Send SMS through SMPP by SMPP Object … 38
2.11 Dial of Object … 47
2.12 Pager Object … 49
2.13 WapPush and WApBookmark Objects … 51
2.14 IO.dll Synapsis … 51
Page
no
2.15 Functions … 56

Chapter – 3: Software Features

3.1 Introduction … 57
3.2 General Features … 57
3.3 Required Software … 57
3.4 Main Manu … 57
3.5 User Guide … 58

Chapter – 4: Interfacing Technique

4.1 Introduction … 59
4.2 Parallel Printer Port of PC … 59
4.3 Parallel Port Programming Considerations … 60
4.3.1 Output to address 278/378/3BCHex … 60
4.3.2 Output to address 27A/37A/3BE Hex … 60
4.4 Parallel Port Addresses … 61
4.5 Parallel Port Modes in BIOS … 62
4.6 Standard Parallel Printer Port … 63
4.6.1 Signal from PC to LPT1 port … 64
4.7 The Main Interfacing Circuit … 65

Chapter – 5: Conclusion

5.1 Conclusion … 68
5.2 Recommendation for Future Work … 68
References … 69
Appendix – I … 71
CHAPTER – 1

Text Message Services in Cellular System

1.1 Introduction:
Text Messaging - also called SMS (Short Message Service) - allows short text messages
to be sent and received on a mobile phone. SMS is a communication protocol allowing
the interchange of short text messages between mobile telephone devices. SMS text
messaging is the most widely used data application on the planet, with 2.4 billion active
users, or 74% of all mobile phone subscribers sending and receiving text messages on
their phones.The SMS technology has facilitated the development and growth of text
messaging. The connection between the phenomenon of text messaging and the
underlying technology is so great that in parts of the world the term "SMS" is used as a
synonym for a text message or the act of sending a text message, even when a different
protocol is being used.

The SMS service is simply a digital network facility that allows digital phone users to
receive text messages on their digital phones. Each message may be a maximum of 160
characters long. In this document, we provide an introduction to basic SMS concepts,
networks and specifications, and SMS tools and services.

1.2 Short Message Service (SMS):

Short Message Service (SMS) is the transmission of short text messages to and from a
mobile phone, fax machine, and/or IP address. Messages must be no longer than 160
alphanumeric characters and contain no images or graphics. SMS is a relatively simple
messaging system provided by the mobile phone networks. SMS messages are supported
by GSM, TDMA and CDMA based mobile phone networks currently in use. Although
services based on SMS have been feasible for many years, the recent mobile phone
penetration and large scale adoption of the existing services by users, have made the SMS
based services even more attractive to service providers.

Once a message is sent, it is received by a Short Message Service Center (SMSC), which
must then direct it to the appropriate mobile device. To do this, the SMSC sends a SMS

1
Request to the home location register (HLR) to find the roaming customer. Once the HLR
receives the request, it will respond to the SMSC with the subscriber's status: 1) inactive
or active 2) where subscriber is roaming. If the response is 'inactive', then the SMSC will
hold onto the message for a period of time. When the subscriber accesses his device, the
HLR sends a SMS Notification to the SMSC, and the SMSC will attempt delivery.

The SMSC transfers the message in a Short Message Delivery Point-to-Point format to
the serving system. The system pages the device, and if it responds, the message gets
delivered. The SMSC receives verification that the message was received by the end user,
then categorizes the message as 'sent' and will not attempt to send again.

Although services enabled by WAP (Wireless Application Protocol) and UMTS


(Universal Mobile Telecommunications System) will most probably replace SMS
messages as the most popular media for wireless applications, there will still be a very
large user base for a long time. The great market interest related to WAP and so-called
mCommerce (mobile commerce) has made also SMS interesting as a service delivery
channel. Operators and service providers are creating many new services. Wireless
Application Service Provision (WASP) is a recent, interesting service architecture for
providing SMS based services.

The basic principle is that there is only one SMSC (SMS Center) that encodes the
messages to be submitted through the GSM network. The basic difficulty in developing
SMS based services is the variety of protocols used in SMS Centers. The European
Telecommunication Standards Institute (ETSI) has approved four SMSC protocols:
SMPP (by Logica), CIMD (by Siemens), UCP/EMI (by CMG) and SMS2000 (by
SEMA). All these protocols have slightly different functionalities and largely different
character conversions. Supporting all these protocols is a demanding task for a service
provider. There are several SMS gateways able to interact with some or all of the SMS
protocols. However, there is no standard way for service providers to interact with the
SMS gateways. Also, only few of the SMS gateways support all the SMSC protocols.
This draft proposes a solution by introducing an easily adoptable interface to SMS
Centers or SMS gateways for service providers. Most countries use the GSM standard,
the United States is one of the few countries to favor use of CDMA and TDMA standards
over GSM (though there are GSM networks throughout the US). CDMA and TDMA
allow extremely limited SMS capabilities.

Short messages can be sent and received simultaneously with GSM voice, Data and Fax
calls. This is possible because whereas voice, Data and Fax calls take over a dedicated

2
radio channel for the duration of the call, short messages travel over and above the radio
channel using the signaling path. As such, users of SMS rarely, if ever, get a busy or
engaged signal as they do during peak network usage times.

Ways of sending multiple short messages are available. SMS concatenation (stringing
several short messages together) and SMS compression (getting more than 160 characters
of information within a single short message) have been defined and incorporated in the
GSM SMS standards.

To use the Short Message Service, users need the relevant subscriptions and hardware,
specifically:

 A subscription to a mobile telephone network that supports SMS


 A mobile phone that supports SMS.
 The use of SMS must be enabled for the user. (automatic access to the SMS is
given by some mobile network operators, others charge a monthly subscription
and require a specific opt-in to use the service)
 Knowledge of how to send or read a short message using the specific model of
mobile phone.
 A destination to send a short message to, or receive a message from. This is
usually another mobile phone but may be a fax machine, PC or Internet address.

1.3 Short Message Service Center (SMSC):


SMS messages are transferred between mobile phones via a Short Message Service
Center. The SMSC is software that resides in the operators network and manages the
processes including queuing the messages, billing the sender and returning receipts if
necessary. Many operators now offer web based interfaces to their SMSC so we can send
short messages to any mobile phone from the web. Some websites now offer free SMS.

In North America, SMS was made available initially on digital wireless networks built by
early pioneers such as BellSouth Mobility, PrimeCo, and Nextel, among others. These
digital wireless networks are based on GSM, code division multiple access (CDMA), and
time division multiple access (TDMA) standards.

Network consolidation from mergers and acquisitions has resulted in large wireless
networks having nationwide or international coverage and sometimes supporting more
than one wireless technology. These new classes of service provider’s demands network-
grade products that can reliably and easily provide a uniform solution, enable ease of
operation and administration, and accommodate existing subscriber capacity, message
throughput, future growth, and services. Short messaging service center (SMSC)

3
solutions based on an intelligent network (IN) approach are well suited to satisfy these
requirements, while adding all the benefits of IN implementations.

Communication with the wireless network elements such as the home location register
(HLR) and mobile switching center (MSC) is achieved through the signal transfer point
(STP).

SMS provides a mechanism for transmitting short messages to and from wireless devices.
The service makes use of an SMSC, which acts as a store-and-forward system for short
messages. The wireless network provides the mechanisms required to find the destination
station(s) and transports short messages between the SMSCs and wireless stations. In
contrast to other existing text-message transmission services such as alphanumeric
paging, the service elements are designed to provide guaranteed delivery of text messages
to the destination. Additionally, SMS supports several input mechanisms that allow
interconnection with different message sources and destinations.

A distinguishing characteristic of the service is that an active mobile handset is able to


receive or submit a short message at any time, independent of whether a voice or data call
is in progress (in some implementations, this may depend on the MSC or SMSC
capabilities). SMS also guarantees delivery of the short message by the network.
Temporary failures due to unavailable receiving stations are identified, and the short
message is stored in the SMSC until the destination device becomes available.

SMS is characterized by out-of-band packet delivery and low-bandwidth message


transfer, which results in a highly efficient means for transmitting short bursts of data.
Initial applications of SMS focused on eliminating alphanumeric pagers by permitting
two-way general-purpose messaging and notification services, primarily for voice mail.
As technology and networks evolved, a variety of services have been introduced,
including e-mail, fax, and paging integration, interactive banking, information services
such as stock quotes, and integration with Internet-based applications. Wireless data
applications include downloading of subscriber identity module (SIM) cards for
activation, debit, profile-editing purposes, wireless points of sale (POSs), and other field-
service applications such as automatic meter reading, remote sensing, and location-based
services. Additionally, integration with the Internet spurred the development of Web-
based messaging and other interactive applications such as instant messaging, gaming,
and chatting.

1.4 SMS - Wireless Application Protocol (WAP):

SMS is the short messaging service for GSM. It is also present on most other digital
cellular networks and tends to operate in a similar fashion on each network. SMS enables

4
2-way short messages to be sent between GSM subscribers. Using gateways, it is also
possible to interchange messages with other systems such as Internet email, the web etc.
So, SMS is essentially a messaging transport service to enable reliable 2-way messaging.

WAP on the other hand is a "protocol set" aboard which various services can be
delivered. Like any protocol, it states how devices can be made compatible ("speak the
same language") in order to exchange information. Since SMS is a means for information
to be transported, two devices could use SMS to exchange WAP-compliant data.

As well as being a transport service, SMS also has a protocol. However, as mentioned
earlier, the SMS protocol is really only concerned with reliable 2-way messaging and so it
is restricted to basic functionality. In protocol terms, this means a very basic command set
such as "Send Message" and "Receive Message". Clearly for anything more sophisticated,
this protocol is very limited. However, there's nothing to stop another protocol being
added on top with more commands that just get sent using the Send and Receive of SMS.
This is what WAP does.

So why does WAP do this? Well, to use the mobile phone to converse with any
information-delivery system (such as the web or a database), the method of delivery
needs to be tailored to the limitations of the phone - mainly the small text-only display,
and the restrictive keyboard and navigation keys. So a part of WAP is concerned with
sensible data formatting and navigation appropriate to these limitations. However,
sending data over mobile air interfaces poses problems with delays and slow links. These
can be overcome to an extent by optimizing the way in which the protocol is mapped to
the interface (such as the SMS carrier or an ordinary GSM data call). Another part of
WAP is concerned with efficient protocol transport.

So is SMS still needed after WAP? The answer is yes. Firstly there are many applications
that simply do not need WAP. The simple send and receive primitives of SMS are
sufficient. Also, there is often no need, or no context, to maintain an ongoing (connected)
communications session over SMS and so SMS tends to get used in a connectionless
mode, like sending a letter or an email - whereby immediate, or even any, response is not
required (though it may be desirable at times).

Many SMS messages are alerts of one kind or another, used to notify the recipient of an
event. These types of messages usually require follow-on action other than sending a
reply using SMS. In these circumstances, SMS is sufficient and there is no need to move
to WAP.

Secondly, WAP is not widely available yet and there are millions of phones that can
handle SMS but not WAP. These will stay in circulation for some time.

5
WAP is particularly useful for interactive services on the handset. Interactive services can
be realized using native SMS, but this is not as elegant as WAP. Using WAP, the user can
be prompted for information and guided along the interactivity path, whereas while using
only SMS, the user has to remember how to respond with any preset commands.

So, we need both SMS and WAP. The both are needed and they have different uses and
applications. SMS is particularly good for pushing out information to mobile phone users.
In particular, Xsonic InTouch monitors a variety of data sources within the Microsoft
Exchange messaging server and pushes out alerts, such as "new email from...",
"appointment at..." etc. Xsonic DataNow also generates alerts from any data changes that
occur within an SQL Server database.

Alerts can be followed up by a variety of actions. These may include SMS replies of one
form or another. Additionally, SMS can be used to pull data from a database. This feature
gets used in Xsonic InTouch to pull contact details from a user's personal contacts folder
in the Exchange database. In this way a mobile worker could get the fax number of a
customer, their address, home phone number etc. For many of these types of applications,
the quick alert or prompt/pull operations of SMS are ideal. Indeed, an advantage of SMS
is that it is quick.

The advantage of WAP is that it enables greater interactivity with the data source. This
would be useful, for example in any operation that is multi-paged in nature (such as
navigating through a hierarchy). Traversing an email Inbox is one such application. With
Xsonic InTouch, a WAP phone could be used to receive SMS alerts (e.g. calendar
reminders, email notification etc.) and the user could then elect to respond with short
SMS commands and get a quick reply, or they could elect to connect to the server via a
secure remote access point and navigate through the various Exchange folders.

SMS and WAP are different entities and are often complimentary. A well designed
application would exploit the essential characteristics of SMS and WAP to suit the end-
user requirements. For fast alert or quick-shot pull systems, SMS is a good solution. For
any communications requiring ongoing interaction with a hierarchical data source, WAP
is a good solution. Sometimes, both solutions can be used to get the best of both worlds.

1.5 Benefits of SMS:

In today's competitive world, differentiation is a significant factor in the success of the


service provider. Once the basic services, such as voice telephony, are deployed, SMS
provides a powerful vehicle for service differentiation. If the market allows for it, SMS
can also represent an additional source of revenue for the service provider.

6
The benefits of SMS to subscribers center around convenience, flexibility, and seamless
integration of messaging services and data access. From this perspective, the primary
benefit is the ability to use the handset as an extension of the computer. SMS also
eliminates the need for separate devices for messaging because services can be integrated
into a single wireless device- the mobile terminal. These benefits normally depend on the
applications that the service provider offers.
At a minimum, SMS benefits include the following:

 Delivery of notifications and alerts


 Guaranteed message delivery
 Reliable, low-cost communication mechanism for concise information
 Ability to screen messages and return calls in a selective way
 Increased subscriber productivity

More sophisticated functionality provides the following enhanced subscriber benefits:

 Delivery of messages to multiple subscribers at a time


 Ability to receive diverse information
 E-mail generation
 Creation of user groups
 Integration with other data and Internet-based applications

The benefits of SMS to the Service Provider are as follows:

 Ability to increment average revenue per user (due to increased number of calls
on wireless and wireline networks by leveraging the notification capabilities of
SMS)
 An alternative to alphanumeric paging services, which may replace or
complement an existing paging offer
 Ability to enable wireless data access for corporate users
 New revenue streams resulting from addition of value-added services such as e-
mail, voice mail, fax, and Web-based application integration, reminder service,
stock and currency quotes, and airline schedules
 Provision of key administrative services such as advice of charge, over-the-air
downloading, and over-the-air service provisioning
 Protection of important network resources (such as voice channels), due to SMS’
sparing use of the control and traffic channels
 Notification mechanisms for newer services such as those utilizing wireless
application protocol (WAP)

7
All of these benefits are attainable quickly, with modest incremental cost and short
payback periods, which make SMS an attractive investment for service providers.

1.6 SMS Support on Different Networks:

Since its inclusion in the GSM standard, SMS has also been incorporated into many other
mobile phone network standards, including Nordic Mobile Telephone (NMT), Code
Division Multiple Access (CDMA) and Personal Digital Cellular (PDC) in Japan. Each of
these standards implements SMS in slightly different ways and message lengths do vary.
The availability and characteristics of SMS on different mobile network standards is
given in Table 1.

Table 1: SMS Facilities on Different Mobile Networks

Mobile network SMS Message


Type Deployment
Standard Availability Length
GSM 900 Digital Yes 160 Widely
GSM 1800 Digital Yes 160 Widely
GSM 1900 Digital Yes 160 North America
TACS/ETACS Analog No N/A N/A
NMT Analog Yes N/A Eastern Europe
TDMA/D-AMPS Digital Yes N/A North America
14 alphanumeric
NAMPS Analog Yes North America
32 numeric
CDMA Digital Yes 160 Widely
PHS Digital Yes N/A Japan
PDC Digital Yes N/A Japan
North and South
IDEN/NEXTEL Digital Yes 140
America
TETRA/ Dolphin Digital Yes 256 Parts of Europe
Globalstar Satellite Yes 160 Truly global

Mobile network standard GSM-900, GSM-1800 and CDMA are used in Bangladesh, both
provides SMS facilities with maximum character length of 160.

1.7 SMS TOOLS:

With the popularity of SMS growing by the day, telecom operators seek to apply latest
technologies to insure messages are being handled in an efficient and productive manner.
Short Message Services can add up a lot of the business revenue. Insuring customer
satisfaction in this arena is a necessary goal. Eskadenia SMS Centre (ESMSC) has been

8
specially designed to cater for current and future business requirements of Short Message
Service. ESMSC can integrate with a wide range of networks over SS7. ESMSC Supports
Enhanced Message Service (EMS), enabling mobile subscribers to insert sounds, images,
or animation into their messages. ESMSC also enables subscribers to send messages in
any language and to send/receive long messages.

Key features of ESMSC are:

 Modulator architecture
 Compatibility with standardized system
 High service reliability, availability and continuity
 Scalable performance
 Realtime charging support
 Failure recovery
 High level of security
 Multilingual support
 Advanced reports and statistics
 Advanced transaction logging
 CDR generation
 E-mail, SMS and SNMP alarms and notifications

Main functionalities of ESMSC are:

 Post-paid payment method


 Multiple message content
 Flexible charging
 Network access
 Powerful operation, Administration and maintenance (OAM)
 Customer care web access
 Operators Interconnect and roaming
 Traffic Management

The eSMS-C, one of the SMS tools, is Ericsson’s SMS solution that offers short message
functionality, message notification, e-mail. In addition, eSMS-C offers more advanced
features such as:

 Information Services - Services providing information e.g. headline news, sport


scores and stock quotes,
 Over-The-Air Services like activation and programming,

9
 Telemetry Applications such as vending machine alarms and remote meter
readings,
 Mobile e-Commerce such as mobile banking, movie ticket purchases.

The eSMS-C supports GSM, TDMA, CDMA, and GPRS networks. It has been
successfully interoperability tested in both Ericsson and Siemens environments. The
capability of eSMS-C fits well in wireless networks due to the SMS capable cellular
phones that are available.

By using any of the Ericsson supported interfaces, the eSMS-C connects directly with a
Mobile-services Switching Center (MSC). The eSMS-C routes directly to the mobile end-
user’s hand set wherever it is, whether roaming or not by communicating directly with the
Home Location Register.

Supported interfaces include:

 SMPP - Short Message Protocol Peer to Peer is a defacto standard for short
messaging. SMPP provides an interface to a variety of applications including
"push" and pull type services as well as WAP Gateways and EMS.
 CAPII - Computer Access Protocol II is an Ericsson short message protocol that
offers some advantages in creating Web based applications.
 SMTP - Simple Mail Transfer Protocol is an E-mail protocol that allows the
eSMS-C to convert an SMS to e-mail and vice versa.

1.8 Java SMS Development Kit:


The SMS Software Development Kit offers a quick, seamless, turnkey approach to
developing wireless applications. With ActiveX, Java, Perl, PHP, and Shared Object
versions, this offers a solution for developers on nearly any platform or operating system.
The SMS Software Development Kit, operating in conjunction with the Wireless
Messaging Network, allows developers to easily embed wireless messaging (Short
Message Service) capabilities into any application. The SMS-JDK provides a simple and
effective interface to the world of wireless short messaging, hiding all the protocol
complexities from the application developer and so allow the developer to focus on the
application's service. www.noctor.com has developed a JDK for SMS. This significantly
reduces the development time-frame, maintenance overhead and cost. The SMS-JDK is
100% Java.

10
1.9 PC Connectivity Software Development Kit (SDK):

The PC Connectivity SDK is a sophisticated and easy-to-use programming interface for


Siemens GSM and TDMA phones. The SDK allows communication with Siemens GSM
and TDMA phones and development of PC applications that utilize the features supported
by the phones.

The PC Connectivity SDK library consists of several separate libraries, each performing a
special set of tasks related to GSM or TDMA phone functionalities. The included libraries
are:

 General Settings Library


 SMS Library
 Phonebook Memory Library
 WAP Library

1.10 SMS Gateway:


SMS Gateway is a 32 Bit Windows utility that enables you to send and receive text and
binary "Short Messages" over GSM digital cellular telephone networks. The package
consists of both an interactive messaging application (with full source code), and a stand-
alone messaging gateway to other Windows applications through the use of DDE, OLE,
and Command Line Interface. SMS Gateway also supports POP3 for message
transmission and SMTP for message reception, so it may be used in almost any
environment without need for custom development.

1.11 SMS Applications:


SMS was initially designed to support limited-size messages, mostly notifications and
numeric or alphanumeric pages. While these applications are and will continue to be
widely used, there are more recent niches that SMS still can exploit.

Short bursts of data are at the heart of many applications that were restricted to the world
of data networks with fixed terminals attached to a local-area network (LAN) or wide-
area network (WAN). However, many of these applications are better served if data
communication capabilities could be added to the mobility of the station. Thus, a waiter
who can charge a customer's credit card right at the table, at any time, instead of going to
a fixed POS terminal located by the register will be able to help customers in a faster,
more convenient way.

Also, the ability to track the location of a moving asset such as a truck or its load is very
valuable for both providers and clients. This application, again, just needs to interchange

11
small amounts of information, such as the longitude and latitude at a current time of the
day, and perhaps other parameters like temperature or humidity.

This application does not necessarily require the monitored entity to be in movement. The
requirements are basically short, bursty data and a location that has digital network
coverage. For example, in a neighborhood, it would be faster, easier, and cheaper to drive
a truck from the local power company, which interrogates intelligent meters to obtain
their current readings and then forwards them via short message to a central data
processing center to generate the billing. Similarly, delivery trucks could be alerted of the
inventory of a customer running low, when the truck is close to the customer’s facilities.
The truck driver could place a quick phone call to the customer to offer a short-time
replenishment at a low cost for the distributor.

Another family of applications that can use SMS as a data transport mechanism is
banking. It is no secret that automated teller machine (ATM) and Internet transactions are
less costly than transactions completed at a branch. Internet transactions are even cheaper
than ATM transactions. Therefore, enabling wireless subscribers to check their balances,
transfer funds between accounts, pay their bills and credit cards is valuable, not only for
the subscriber but also for financial institutions.

Entertainment applications are also good drivers of SMS usage. Examples of these are
simple short message exchanges between two parties ("texting") or between multiple
participants ("chat"). Also, delivery of information that the subscriber can tailor to his or
her lifestyle represents an attractive proposition for wireless users.

Wireless Web browsing allows the users to search for information without the physical
restrictions of a PC. College students certainly appreciate not having to go to the
computer lab or their dorm to check e-mail or find out what the required book is for the
semester that is about to start.

E-mail continues to be by far the most used wireless data application. However, handsets
are evolving quickly and are including more and more functionality that supports newer
applications at the same time that user friendliness increases. Probably the next big
success beyond wireless Web will be Internet shopping and other e-commerce
applications such as electronic coupons, advertising, etc.

The potential for applications is enormous, and new needs appear to arise constantly,
demanding a solution that may travel over SMS.

12
1.12 Objectives of the Thesis:

In this thesis electrical home appliances are controlled through SMS that have been sent
from mobile phone. The major objectives of this thesis are:

 To introduce a new switching technique for controlling remote electrical devices.


 To develop a reliable controlling scheme.
 To control the overseas devices.
 To implement a secured controlling approach.

1.13 Organization of the Thesis:

The thesis is comprised in five chapters. The introductory chapter is “Text Message
Services in Cellular System” which deals with a short discussion on SMS, SMS centre,
WAP, benefits of SMS, SMS tools, JDK, SDK, SMS Gateway and application of SMS.
The basic aims and objectives of the thesis and the organization of the report is also
presented in this chapter.

The second chapter is "SMS and Pager Toolkit" which contains the system requirements,
installation process of “ActiveXpert” application program, related objects for this
program, possible error codes and constants and IO.dll Saynapsis for configuring the
parallel IO port.

The third chapter is "Customized Software" which includes the details on the general
features of the developed program, the Main Window of the developed software and an
user’s Guide to help the novice user.

The fourth chapter is "Interfacing Technique" where the detail of the Parallel Port of PC,
considerations for Parallel Port Programming, port addresses. Port Modes in BIOS and
Standard Parallel Printer Port are also discussed in this chapter.

The conclusion chapter is the fifth chapter. In this chapter the performance of the
designed and developed system is detailed. The recommendations for the future
researchers who are interested on it are discussed.

13
CHAPTER – 2

SMS and Pager Toolkit

2.1 Introduction:

SMS and pager Toolkit is an ActiveX/COM component, and provides SMS and pager
messaging functionality. Adding SMS and Pager capabilities to an application is not a
simple matter. It requires specialized knowledge that might be outside an individual
programmer's expertise. Today, Windows developers rely upon the power, flexibility and
reliability of the SMS and pager Toolkit by ActiveXperts Software. This Toolkit can send
and receive SMS messages via a:

 GSM modem;
 GSM phone;
 SMPP compliant SMSC provider;
 Hayes compatible modem.

2.2 SMS and Pager Toolkit Features:

SMS and Pager Toolkit should have the following features:

 Send alphanumeric text SMS messages;


 Send numeric Pager messages;
 Send multimedia SMS messages, including ring-tones, pictures and logo's;
 Verify delivery of outgoing SMS message;
 Send WAP Push messages;
 Send WAP Bookmarks;
 Receive SMS messages;
 Receive SMS messages from different storage locations;
 Support for Unicode, to support foreign languages like Chinese, Turkisch, etc.;
 Support for multi-part messages, to allow messages longer than 160 characters;
 Support for GSM modems and GSM phones to send and receive SMS messages;
 Support for SMPP (Short Message Peer to Peer) providers for large message
volumes;
 Support TAP/XIO and UCP dial-in SMSC providers;
 Support Windows 'Phone and Modem devices' and direct COM ports;

14
 Support Multi-threading environments. The component is thread-safe, which
means it can be used in a multi-threaded environment;
 Troubleshooting facilities by tracing all modem commands and responses;
 Samples included for various development platforms: MS Visual Basic, MS
Visual Basic .NET, MS Visual C++, MS Visual C# .NET, ASP, ASP .NET and
more.

2.3 The Development Language:

SMS and Pager Toolkit can be used by any of the following development languages:

 Visual Basic .NET - Windows .NET based application;


 Visual C# .NET - Windows .NET based applications;
 Visual Basic 5.x or higher - Windows based applications;
 Visual C++ 5.x or higher - Windows based applications;
 ASP .NET - Web site based on Active Server Pages and the .NET Framework;
 ASP 2.x - Web site based on Active Server Pages (server-side scripting);
 PHP - Embedded HTML scripting;
 VBScript - Windows based scripts;
 Java/Javascript - Java based scripts;
 HTML - Client scripts within HTML pages;
 Any other development platform that supports ActiveX/COM components.

2.4 Hardware Requirements:

SMS and Pager Toolkit support the following hardware:

2.4.1 Network Cards with SMPP protocol

Customers requiring a high throughput should deliver SMS messages over a network
connection to a remote SMPP-compliant SMSC provider. The SMPP ( 'Short Message
Peer-to-Peer' ) protocol is a Layer-7 TCP/IP protocol for exchanging SMS messages
between SMS peer entities such as short message service centers. It is often used to allow
third parties (e.g. content suppliers like news organizations) to submit SMS messages,
often in bulk.

To send SMS messages using an SMPP-compliant provider and SMS and Pager Toolkit,
use the Smpp object.

15
The free “ActiveXperts SMPP Demo server” (smpp.activexperts-labs.com) can be used to
send and receive a limited number of SMPP messages (for testing only). For daily use, it
is needed to sign-up with a commercial SMPP-compliant SMSC provider.

2.4.2 GSM Modems:

This is a fast and reliable device to send and receive SMS messages.
The plain text SMS messages, uni-code messages, ring-tones and other advanced SMS
messages can be sent using a GSM modem.

Two objects are used to send and receive message using GSM Modem. The “GsmOut
object” is used to send SMS messages using a GSM and to receive message the “GsmIn
object” is used.

“ActiveXperts” recommends “WaveCom GSM modems” and “MultiTech GSM


modems”.

2.4.3 GSM Phones With AT+C Modem Command Support:

The GSM phone is connected to a PC or server via the serial port, USB port or Bluetooth.
GSM phones work similar to GSM modems. People usually prefer to use a dedicated
GSM modem rather than a GSM phone, because it is cheaper and faster. GSM phones
also supports the GsmIn and GsmOut objects.

2.4.4 Hayes Compatible Modems (1200 bps or higher):

Use SMS and Pager Toolkit to connect the normal Hayes modem (1200 bps or higher) to
an SMSC service provider and send out SMS messages, one-by-one.

There are many SMSC dial-in providers around the world. Most of them do not require
sign-up. We pay per dial-up call. For a complete list of SMSC dial-in providers around
the world.

We can only send plain text messages with a normal modem; to send ringtones, data,
unicode and other advanced SMS format, you should use a GSM Modem (or GSM phone
with modem functions). We cannot receive SMS messages using a normal Hayes modem.

To use a normal Hayes modem to connect to an SMSC dial-in provider with SMS and
Pager Toolkit, use the DialUp object.

To send Pager messages, We can use any of the above hardware devices; however, there
is no need to use a GSM modem or GSM phone for paging, because it will only use ATD
commands. A normal Hayes compatible modem is less expensive.
To send pager messages with SMS and Pager Toolkit, use the “Pager object”.

16
2.4.5 SMS and Pager Toolkit Architecture

SMS and Pager Toolkit is built on top of the Microsoft serial device drivers and TAPI
drivers. It does NOT replace any Windows drivers during installation; it neither adds any
files or components to the Windows or Windows System directory.

The core of SMS and Pager Toolkit consists of one file:

3 ASmsCtrl.dll - the SMS and Pager Toolkit ActiveX object.

The component encapsulates the following objects:

 Constants - This object is a collection of read-only properties (so called


constants) that can be used anywhere in the source code for various purposes;
 GsmOut - Send SMS messages using a GSM modem (like MultiTech
MultiModem GSM/GPRS USB Modem) or GSM phone (like Siemens CX-75);
 GsmIn - Receive SMS messages using a GSM modem or GSM phone;
 Smpp - Send and Receive corporate and high volumes SMS messages. Use the
ActiveXperts Demo SMPP server for testing, or sign-up with a commercial SMPP
SMSC provider;
 DialUp - Send SMS messages though an SMSC dial-up provider. This requires a
standard Hayes compatible modem and a dial-in number of an SMSC provider;
 Pager - Send pager messages. This requires a standard Hayes compatible modem;
 WapPush - Format messages as WapPush messages.
 WapBookmark - Format messages as WapBookmark messages .

SMS and Pager Toolkit can be distributed easily to many PC's. Once you have purchased
the licenses, you copy the ASmsCtrl.dll to the PCs and register the DLL on that PC.

2.5 System Requirements


The SMS and Pager Toolkit can be used in any of these languages:

 Visual Basic .NET;


 Visual C# .NET;
 Visual Basic 5.x or higher;
 Visual C++ 5.x or higher;
 ASP .NET;
 ASP 2.x;
 PHP - Embedded HTML scripting;
 VBScript;
 Java/Javascript;
 HTML;

17
 Any other development platform that supports ActiveX/COM components.

2.5.1 NET Framework

To use SMS and Pager Toolkit in an ASP.NET, Visual Basic.NET or Visual C#.NET
environment the .NET Framework must be installed on the system. The .NET Framework
is part of the Windows 2003 Operating System. On Windows 2000, Windows 98,
Windows ME, Windows NT, Windows Server 2003, Windows XP, it's available as a
separate installation. Please visit the “Technology Information for the .NET Framework”
page to download the .NET Framework.

2.5.2 Internet Information Server

Internet Information Server (IIS) Setup installs the Visual Basic Script and Java Script
engines.

To run ASP pages on NT4 Servers, IIS 4.x must be installed. IIS 4.x ships with the NT4
Option Pack CD's. To run ASP pages on Windows XP Professional and Windows
2000/2003 Servers, IIS 5.x or higher must be installed. IIS is part of the Windows XP
Professional and Windows 2000/2003 Operating Systems. IIS is NOT supported on
Windows XP Home and Windows 98/ME.

2.5.3 Internet Explorer 4.x or higher

The Internet Explorer 4.x Setup (or higher) installs the Visual Basic Script and Java
Script engines. We can use the SMS and Pager Toolkit component from client HTML
browser using Javascript.

2.5.4 Windows Scripting Host (WSH)

SMS and Pager Toolkit can be used in VBScript scripts. VBScripts can be used by
passing the script-file as a parameter to the scripting host (either 'cscript' or 'wscript').
WSH relies on the Visual Basic Script and Java Script engines provided with Internet
Explorer 4.x or later. WSH is also installed as part of Windows 98, Windows 2000/2003,
Windows XP and Internet Information Services 4.0 or higher. A separate setup program
is provided for Windows 95.

2.5.5 Programming Environment:

SMS and Pager Toolkit can be used in Visual Basic 5.x or higher or in Visual C++ 5.x or
higher.

18
2.6 Installation process

The SMS and Pager Toolkit package consists of 4 components; any combination of
components can be installed:

 The SMS and Pager Toolkit ActiveX/COM component (required) -


ASMSCTRL.DLL (the actual ActiveX/COM component);
 The SMS and Pager Toolkit Help Files (optional) - documentation;
 The SMS and Pager Toolkit Example Files (optional) - sample code for various
development platforms;
 The SMS and Pager Toolkit Utilities (optional) - SMS demo applications.

The installation process has two options, i.e. automatic installation and manual
installation. These processes are given under.

2.6.1 Automatic Installation

Simply run the ASMSTOOL.EXE Setup program; it can be downloaded this Setup file
here. The “InstallShield wizard” will guide you through the rest of the setup. The Setup
program will be installed automatically after completing the registration of the Active
X/COM component.

Any subsequent installation of SMS and Pager Toolkit can be performed either manually
or by using the Automatic Installation.

2.6.2 Manual installation

To install the ActiveX/COM component manually, simply perform the following tasks:

 Copy the ASMSCTRL.DLL (the SMS and Pager Toolkit ActiveX/COM


component) to a destination location on the target machine;
 Register the ActiveX/COM component by using the following command:
REGSVR32 <dest-location>\ASMSCTRL.DLL

2.7 SMS and Pager Toolkit objects


The following code snippets (VBScript) illustrate how to use various SMS and Pager
Toolkit objects.

First of all make sure that the SMS & Pager Toolkit is already installed on the desired
system. This Toolkit can be used in Visual Basic 5.x or advanced versions.

19
In Visual Basic, go to the 'Project/References...' menu item and check the box next to
'ActiveXperts SMS and Pager Toolkit' Type Library. Then SMS objects can be declared
and created.

A new “SmsConstants object” can be created in the following way:

Dim objConstants As ASmsCtrl.SmsConstants ' Declaration


Set objConstants = CreateObject("ActiveXperts.SmsConstants") ' Creation

For a GSM modem (or GSM phone) to send SMS messages, a new “GsmOut object”
should be created using the 'CreateObject' function in following way:

Dim objGsmOut As ASmsCtrl.GsmOut ' Declaration


Set objGsmOut = CreateObject( "ActiveXperts.GsmOut" ) ' Creation

For a GSM modem (or GSM phone) to receive SMS messages, a new “GsmIn object”
using the 'CreateObject' function should be created in following way:

Dim objGsmIn As ASmsCtrl.GsmIn ' Declaration


Set objGsmIn = CreateObject( "ActiveXperts.GsmIn" ) ' Creation

For a SMPP-compliant SMSC provider to deliver messages, a new “Smpp object” should
be created in the following way:

Dim objSmpp As ASmsCtrl.Smpp ' Declaration


Set objSmpp = CreateObject( "ActiveXperts.Smpp" ) ' Creation

For a normal modem to connect to an SMSC dial-in provider, a new “DialUp object” also
should be created using the 'CreateObject' function in following way:

Dim objDialUp As ASmsCtrl.DialUp ' Declaration


Set objDialUp = CreateObject( "ActiveXperts.DialUp" ) ' Creation
For a normal modem to send out Pager messages, a new “Pager object” should be created
in the following way:

Dim objPager As ASmsCtrl.Pager ' Declaration


Set objPager = CreateObject( "ActiveXperts.Pager" ) ' Creation

To format SMS messages as WAP Push or WAP Bookmark messages, a new “WapPush
object” or “WapBookmark object” should be created in the following way:

20
Dim objWapPush As ASmsCtrl.WapPush ' Declaration
Set objWapPush = CreateObject( "ActiveXperts.WapPush" ) ' Creation
Or,
Dim objWapBookmark As ASmsCtrl.WapBookmark ' Declaration
Set objWapBookmark = CreateObject( "ActiveXperts.WapBookmark" )
'Creation
After these declarations and creation of the object(s), the objects can be used in the
desired Visual Basic projects.

2.8 Error Codes and Constants

2.8.1 Error Codes

When a function is called, the result of the function is stored in the object's 'LastError'
property. When 'LastError' is 0, it means that the last called function completed
successfully; otherwise, an error occured. The value of the LastError tells why the
function failed. All error codes are listed on the ActiveXperts web
site:“www.activexperts.com/support/errorcodes (list of error codes)”. In this website, it
can be also lookup a specific error to find its description.

The 'GetErrorDescription' function can be also called to find the error description of any
of the objects.

2.8.2 Constants
In SMS and Pager Toolkit, all constants are grouped together in a separate object called
“SmsConstants”. it can be used at first the ‘Constant object’ must be created then SMS
caonstant can be written as:
Set objConstants = CreateObject( "ActiveXperts.SmsConstants" )
WScript.Echo objConstants.asDIALMODE_TONE
WScript.Echo objConstants.asDIALMODE_PULSE

2.9 The Objects


The ActiveXpert toolkit has various object. GsmIn and GsmOut are two important and
useful objects.

2.9.1 GsmOut Object

The ‘GsmOut’ object enables the sending of SMS using a GSM Modem or a modem-
capable GSM phone.

21
The GsmOut object communicates through a serial port, USB port, Bluetooth connection,
infrared port or any Windows telephony compliant device. It is recommended to use
Windows 'Phone and Modem' devices, for example 'Standard 9600 bps Modem', or '
Siemens CX-75 Phone'.

If a Windows telephony device is used, settings are controlled by the Windows telephony
driver, and can be configured through the 'Phone and Modem' settings. The configuration
process is:

 Open the Windows Control Panel from the Start menu;


 Double-click on 'Phone and Modem Options' and select the 'Modems' tab;
 Select the preferred modem and click on 'Properties'; from here, we can change
the settings.

To select a 'Phone and Modem' device in the toolkit's object, assign an existing telephony
name to the Device property as:

 Device - the literal Windows telephony device string, for instance: 'Standard 9600
Modem'.

Alternatively, a port directly can be used, for instance: 'COM1'. The device properties
must be setup properly before receiving messages. The device properties set up includes
the following settings:

 Device - The actual COM port, formatted as COMx, where x represents the COM
port number;
 DeviceHwFlowControl - Hardware flow control is used to regulate commands
from PC to device and visa versa; default setting is On.
 DeviceSwFlowControl - Software flow control is used to regulate data from
device to device; default setting is Off.
 DeviceSpeed - The speed to be used to communicate with the GSM modem or
GSM phone; default setting is Zero (which means that factory defaults are used
for modem communications);
 DeviceSettings - The number of databits, paritybits and stopbits; default settings
are 8 databits, no parity, 1 stopbit.
 DeviceInitString - The modem initialization string is used to initialize the modem;
default value: ''i.e. a generic initialization string will be used within this pair of
comma..

Using ‘GsmOut object’ different types of SMS messages can be sent such as

22
 Text – which means plain text. It is a default setting.
 Flash - which means Plain text, in the immediate display
 Data - which means Data message (raw, 8 bits)
 Unicode - Unicode message
 Unicode Flash - which means Unicode message, immediate display
 WAP Push - which means propagation of a URL to the remote recipient's WAP
phone
 WAP Bookmark - which means propagation of a bookmark to the remote
recipient's WAP phone

For more information about recommended GSM Modems, for a list of GSM phones
tested with SMS and Pager Toolkit.

2.9.1.1 Sending SMS message via GSM Modem / GSM phone:

The following sample demonstrates how to send an SMS message using a GSM modem
(or modem-capable GSM phone):

Set objGsmOut = CreateObject( "ActiveXperts.GsmOut" )


objGsmOut.Device=" Siemens CX-75 Modem" 'Use a Siemens CX-75
Windows telephony device
objGsmOut.MessageRecipient= "+4412345678" 'Recipient's mobile
number
objGsmOut.MessageData= "Hello, world!" ‘SMS message text
objGsmOut.RequestStatusReport = False ' No request for status
report
objGsmOut.ValidityPeriod = 0 'Use GSM operator's
default retry time
objGsmOut.EnterPin ( "1234" ) 'SIM card's PIN code
objGsmOut.Send()
If objGsmOut.LastError = 0 Then
WScript.Echo "Message successfully delivered."
Else
WScript.Echo "Error: " & objGsmOut.LastError

End If

For a recommended Windows telephony devices " Siemens CX-75 " can be replaced by
"COM1", by assuming that the Siemens CX-75 phone is connected on COM1.

23
The Functions used in GsmOut Object are:

The Activate function


This functions activates the SMS and Pager Toolkit product. A valid registration code
should be passed as parameter.

Parameters:

 The registration code

Return value:

Always zero the ‘LastError’ property can be checked to see whether the function was
completed successfully.

For Example:
Set objGsmOut = CreateObject( "ActiveXperts.GsmOut" )
objGsmOut.Activate "xxxxx-xxxxx-xxxxx" 'replace xxxxx-xxxxx-
xxxxx by the personal
registration code

The Clear function


This function resets all Properties to their initial or default values.

Parameters:

 None

Return value:

Always zero. Check ‘LastError’ property also can be checked to see whether the function
was completed successfully

For Example:
Set objGsmOut = CreateObject( "ActiveXperts.GsmOut" )
objGsmOut.Send()
objGsmOut.Clear()
objGsmOut.Send()
objGsmOut.Clear()

The GetDeviceCount function


The function returns the number of installed Windows telephony devices on the local
computer.

24
Parameters:

 None

Return value:
The number of installed Windows telephony devices also can Checked the ‘LastError’
property to see whether the function was completed successfully.

For Example:
Set objGsmOut = CreateObject( "ActiveXperts.GsmOut" )
WScript.Echo "Number of installed Windows telephony devices: " &
objGsmOut.GetDeviceCount()
The GetDevice function
The function returns the n-th telephony device of the system. The number n can be
between 0 and ‘GetDeviceCount()’-1.

Parameters:

 Zero based index, to iterate over all telephony devices.

Return value:
If returns the name of the device. ‘LastError’ function can be called to see if the function
was completed successfully. The name of the device already has been assigned to the
‘Device property’ to open a Windows telephony device.

For Example:

Set objGsmOut = CreateObject( "ActiveXperts.GsmOut" )


n = objGsmOut.GetDeviceCount()
For i = 0 to n-1
WScript.Echo "Device " & i & ": " & objGsmOut.GetDevice( i )

Next

Another Example to get first telephony device:


Set objGsmOut = CreateObject( "ActiveXperts.GsmOut" )
If( objGsmOut.GetDeviceCount() > 0 )
objGsmOut.Device = objGsmOut.GetDevice( 0 ) ' Use the first
telephony device
objGsmOut.Receive()
End If

25
The EnterPin function

The functions enter the PIN code, which is Required for PIN protected SIM cards

Parameters:

 PIN code

Return value:

Always zero . The ‘LastError property’ can be used to see whether the function was
completed successfully.

The Example:
Set objGsmOut = CreateObject( "ActiveXperts.GsmOut" )
objGsmOut.EnterPin( "1234" )
....
objGsmOut.Send()
Next

The Send function


The function is used to send an SMS message via a GSM mode or GSM phone.

Parameters:

 None

Return value:

Always zero. The ‘LastError property’ can be checked to see whether the function was
completed successfully

The Example:

Receive SMS messages without removing them from the SIM card
Set objGsmOut = CreateObject( "ActiveXperts.GsmOut" )
objGsmOut.Device = "MultiTech GSM MultiModem"
objGsmOut.MessageRecipient = "+31624896641"
objGsmOut.MessageData = "Hello, world!"
objGsmOut.RequestStatusReport = False ' No request for status
report
objGsmOut.ValidityPeriod = 0 ' Use GSM operator's
default retry time
objGsmOut.Send()
If objGsmOut.LastError = 0 Then
WScript.Echo "Message successfully delivered"

26
Else
WScript.Echo "Error: " & objGsmOut.LastError

End If

The QueryStatus function:

Query the status of a message that was successfully submitted by the Send function. The
function queries the message indicated by the MessageReference property. If the function
completes successfully (i.e. if the LastError is 0 after the call), it can be checked the
StatusCode property to check the status of the message.

Please note that status delivery info ONLY works if the RequestStatusReport was set
before sending the SMS message(s). Only then, the telecom operator knows that want a
status report for the particular SMS message.

By default, status reports are retrieved from the SIM card. Some advanced GSM modems
have a sepcial Status Reports memory inside their device. If it is wanted to use this
special Status Reports memory, set the Storage property before calling 'QueryStatus'.

Parameters:

 None

Return value:

Always zero.The ‘LastError property’ can be checked to see whether the function was
completed successfully

Example:
Set objGsmOut = CreateObject( "ActiveXperts.GsmOut" )
...
objGsmOut.RequestStatusReport = True
objGsmOut.MessageRecipient = "+4412345678"
objGsmOut.Send()
If( objGsmOut.LastError = 0 ) Then
WScript.Echo "MessageReference of last sent message: " &
objGsmOut.MessageReference
WScript.Sleep 20000 ' Wait for 20 msecs to
allow operator to deliver
the message
objGsmOut.QueryStatus() ' Query the status of

27
message indicated by
objGsmOut.Message
Reference
If( objGsmOut.LastError = 0 ) Then
WScript.Echo "Status: " & objGsmOut.StatusCode
WScript.Echo "Status description: " &
objGsmOut.GetStatusDescription( objGsmOut.StatusCode )
WScript.Echo "Status updated at: " & objGsmOut.StatusTime
WScript.Echo "Status updated at (in seconds after 1/1/1970): " &
objGsmOut.StatusTimeSeconds
End If
End If

The GetStatusDescription function:


The function retrieve the description of a status code.

Parameters:

 Status code, for a list of valid status codes

Return value:

The status string is the return value.

Example:

Set objGsmOut = CreateObject( "ActiveXperts.GsmOut" )


...
objGsmOut.MessageReference = "123"
objGsmOut.QueryStatus()
If objGsmOut.LastError <> 0 Then
WScript.Echo "Status code: " & objGsmOut.StatusCode
WScript.Echo "Status description: " & objGsmOut.GetStatusDescription(
objGsmOut.StatusCode )
End If

The GetErrorDescription function:


This function is used to retrieve the explanation of an error code.

Parameters:

 Error code.

28
Return value:

The Error string is the return value.

Example:
Set objGsmOut = CreateObject( "ActiveXperts.GsmOut" )
objGsmOut.Send()
If objGsmOut.LastError <> 0 Then
WScript.Echo "Error description: " & objGsmOut.GetErrorDescription(
objGsmOut.LastError )

End If

2.9.2 GsmIn Object:


The GsmIn object enables receiving of SMS messages using a GSM Modem or a modem-
capable GSM phone.

The GsmIn object communicates through a serial port, USB port, Bluetooth connection,
infrared port or any Windows telephony compliant device. It is recommended to use
Windows Phone and Modem devices, for example 'Standard 9600 bps Modem', or '
Siemens CX-75 Phone'. If a Windows telephony devices is used, settings are controlled
by the Windows telephony driver, and can be configured through the 'Phone and Modem'
settings. The settings are:

 Open the Windows Control Panel from the Start menu;


 Double-click on 'Phone and Modem Options' and select the 'Modems' tab;
 Select the preferred modem and click on 'Properties'; from here, it can be changed
the settings.

To select a 'Phone and Modem' device in the toolkit's object, assign an existing telephony
name to the Device property:

 Device - the literal Windows telephony device string, for instance: 'Standard 9600
Modem'.

Alternatively, a port can be used directly, for instance: 'COM1'. In this case device
properties must be setup properly before receiving messages:

 Device - The actual COM port, formatted as COMx, where x represents the COM
port number;

29
 DeviceHwFlowControl - Hardware flow control is used to regulate commands
from PC to device and visa versa; default: On;
 DeviceSwFlowControl - Software flow control is used to regulate data from
device to device; default: Off;
 DeviceSpeed - The speed to be used to communicate with the GSM modem or
GSM phone; default: 0 (which means that factory defaults are used for modem
communications);
 DeviceSettings - The number of databits, paritybits and stopbits; default: 8
databits, no parity, 1 stopbit;
 DeviceInitString - The modem initialization string is used to initialize the modem;
default value: '' (which means a generic initialization string will be used).

Table 2.1 Overview of device properties

Property Type In/Out Mand/Opt Description


Version String Out n/a Product version number
ExpirationDate String Out n/a Product expiration date
Name of the device you want to use for
Device String In/Out M
receiving the SMS messages
Identifier string indicating databits, parity and
DeviceSettings Number In/Out O
stopbits
DeviceSpeed Number In/Out O The baudrate of the communication session
DeviceHwFlowControl Boolean In/Out O Hardware flow control
DeviceSwFlowControl Boolean In/Out O Software flow control
DeviceInitString String In/Out O Initialization string for the device
Storage Number In/Out O Preferred storage
DeleteAfterReceive Boolean In/Out O Delete message from storage after receive
MessageSender String Out n/a Received message: SMS number of the sender
Received message: SMSC number of the
MessageSMSC String Out n/a sending provider (in case SMS was sent by an
SMSC provider)
Received message: Time (friendly string) at
MessageTime String Out n/a
which message was received
Received message: Time (in seconds from
MessageTimeSeconds Number Out n/a
1/1/1970) at which message was received
MessageType Number Out n/a Received message: Message Type
MessageData String Out n/a Received message: Message Data
LastError Number Out n/a Result of the last called function
All GSM commands and responses are logged to
LogFile String In/Out O
this file

SMS messages can be received from different types of storage. The storage location
depends on the type of hardware: GSM phones usually store incoming SMS messages in
their internal memory; GSM modems usually keep SMS messages on the SIM card. It is
recommended to read from the default storage. Some devices (including WaveCom GSM

30
modems) have a special storage for delivery reports. This enables you to verify the
delivery of a message. The 'GsmIn' object supports the following storage locations:

 Default - use default device settings;


 SIM Memory - use SIM memory;
 Device Memory - use device memory;
 Any - use any device memory;
 Reports - status report memory;
 Archive - Use archive memory.

SMS messages are always received in 'batches', i.e. all incoming SMS messages are read
from the message storage and stored in the SMS and Pager Toolkit internal message
queue. This queue is a FIFO (First-In-First-Out) queue.

To read all messages from the selected storage, use the following function:

 Receive - Receive incoming SMS messages and place them in the internal
message queue. Optionally, delete all messages from device storage.

After calling the 'Receive' function, messages can be fetched one-by-one using the
GetFirstMessage/GetNextMessage functions:

 GetFirstMessage - Fetch first SMS message from the toolkit's internal message
queue
 GetNextMessage - Fetch next SMS message from the toolkit's internal message
queue

After each function call, we should check the result of the function. The result of the last
called function is stored in the 'LastError' property. All other functions will also store our
result in this 'LastError' property.

2.9.2.1 Receive SMS Messages Using a GSM Device:

The following sample demonstrates how to receive SMS messages via a GSM modem (or
modem-capable GSM phone):

Set objGsmIn = CreateObject( "ActiveXperts.GsmIn" )


objGsmIn.Device= " Siemens CX-75 Modem" ' Use the Siemens telephony
device

31
objGsmIn.Receive()
If objGsmIn.LastError = 0 Then
objGsmIn.GetFirstMessage()
While objGsmIn.LastError = 0
WScript.Echo "Message received from: " & objGsmIn.MessageSender & " at
" & objGsmIn.MessageTime
WScript.Echo " Type: " & objGsmIn.MessageType
WScript.Echo " Message: " & objGsmIn.MessageData
objGsmIn.GetNextMessage()
WEnd
End If

2.9.2.2 Delete Messages from the GSM Storage after Receive:

By default, messages are not deleted from storage (usually: SIM card or device)..But for
the system proposed the SMS once open received should be deleted To delete messages
from storage after receive, it must set the 'DeleteAfterReceive' property.

The code for deleting message from the GSM storage after receive is as follows:

Set objGsmIn = CreateObject( "ActiveXperts.GsmIn" )


objGsmIn.Device=" Siemens CX-75 Modem"'Use the Siemens telephony device
objGsmIn.DeleteAfterReceive=True'Delete from storage after calling 'Receive'
objGsmIn.Receive()
If objGsmIn.LastError = 0 Then
objGsmIn.GetFirstMessage()
While objGsmIn.LastError = 0
...
objGsmIn.GetNextMessage()
WEnd
End If

The " Siemens CX-75 Modem" can be replaced by "COM1", as if it assuming that the
Siemens phone is connected on COM1.

32
The Activate function:

This functions activates the SMS and Pager Toolkit product. A valid registration code
should be passed as parameter.

Parameters:

 The registration code

Return value:

Always zero. The ‘LastError property’ can be checked to see whether the function was
completed successfully

The Example:
Set objGsmIn = CreateObject( "ActiveXperts.GsmIn" )
objGsmIn.Activate "xxxxx-xxxxx-xxxxx" ' replace xxxxx-xxxxx-xxxxx by
your personal registration code.

The Clear function:

This function resets all Properties to their initial, default values.

Parameters:

 None

Return value:

Always zero. The ‘LastError property’ can be checked to see wether the function was
completed successfully

The Example:
Set objGsmIn = CreateObject( "ActiveXperts.GsmIn" )
objGsmIn.Receive()
objGsmIn.Clear()
objGsmIn.Receive()
objGsmIn.Clear()

The GetDeviceCount function:

The function is used to returns the number of installed Windows telephony devices on the
local computer.

Parameters:

 None

33
Return value:

The number of installed Windows telephony devices. The ‘LastError property’ can be
checked to see whether the function was completed successfully.

The number of Windows telephony devices does not include the number installed COM
ports.

The Example:
Set objGsmIn = CreateObject( "ActiveXperts.GsmIn" )
WScript.Echo "Number of installed Windows telephony devices: " &
objGsmIn.GetDeviceCount()

The GetDevice function:


Returns the n-th Windows telephony device of the system. The number n can be between
0 and ‘GetDeviceCount()’-1.

Parameters:

 Zero based index, to iterate over all Windows telephony devices.

Return value:
The name of the device. Call the ‘LastError’ function to see if the function was completed
successfully. The name of the device can be assigned to the ‘Device property’ to open a
Windows telephony device.

The Example:
Set objGsmIn = CreateObject( "ActiveXperts.GsmIn" )
n = objGsmIn.GetDeviceCount()
For i = 0 to n-1
WScript.Echo "Device " & i & ": " & objGsmIn.GetDevice( i )
Next

The Example:
Set objGsmIn = CreateObject( "ActiveXperts.GsmIn" )
If( objGsmIn.GetDeviceCount() > 0 )
objGsmIn.Device = objGsmIn.GetDevice( 0 ) ' Use the first Windows
telephony device
objGsmIn.Receive()
End If
The EnterPin function:
The function enters the PIN code, which is required for PIN protected SIM cards.

34
Parameters:

 PIN code

Return value:

Always zero. The ‘LastError property’ can be checked to see whether the function was
completed successfully.

Example:
Set objGsmIn = CreateObject( "ActiveXperts.GsmIn" )
objGsmIn.EnterPin( "1234" )
....
objGsmIn.Receive()
Next
The Receive function:

Retrieve all incoming SMS messages (read and unread) from the device storage (i.e. SIM
card and/or device memory). Messages are queued internally by the Toolkit and can be
fetched one-by-one by calling the “GetFirstMessage” and “GetNextMessage” functions.
The number of received messages is indicated by the return value. The function requires
one parameter, to indicate whether messages should be deleted on the SIM card or not. If
you pass True, all messages will be deleted from the SIM card.

Parameters:

 None

The Return value:

Always zero. The ‘LastError property’ can be checked to see whether the function was
completed successfully

The Example:

Receive SMS messages without removing them from the SIM card
Set objGsmIn = CreateObject( "ActiveXperts.GsmIn" )
numMessages = objGsmIn.Receive()
If( objGsmOut.LastError = 0 And numMessages > 0 ) Then
objGsmIn.GetFirstMessage()
While( objGsmIn.LastError = 0 )
WScript.Echo "Message received from " & objGsmIn.MessageSender
& " at " & objGsmIn.MessageTime
WScript.Echo " Type: " & objGsmIn.MessageType
WScript.Echo " Message: " & objGsmIn.MessageData

35
objGsmIn.GetNextMessage()
WEnd
End If

The Example:

Receive SMS messages; delete them after you've listed them all
Set objGsmIn = CreateObject( "ActiveXperts.GsmIn" )
objGsmIn.DeleteAfterReceive = True '
numMessages = objGsmIn.Receive()
If( objGsmIn.LastError = 0 And numMessages > 0 ) Then
objGsmIn.GetFirstMessage()
While( objGsmIn.LastError = 0 )
...
objGsmIn.GetNextMessage()
WEnd
End If

GetFirstMessage and GetNextMessage functions:

After a successfull call of the Receive function, you can retrieve the SMS messages one-
by-one.

Parameters:

 None.

Return value:

Always zero. The ‘LastError property’ can be checked to see whether the function was
completed successfully

The Example:
Set objGsmIn = CreateObject( "ActiveXperts.GsmIn" )
numMessages = objGsmIn.Receive()
If( objGsmIn.LastError = 0 And numMessages > 0 ) Then
objGsmIn.GetFirstMessage()
While( objGsmIn.LastError = 0 )
WScript.Echo "Message received from " & objGsmIn.MessageSender &
" at " & objGsmIn.MessageTime
WScript.Echo " Type: " & objGsmIn.MessageType
WScript.Echo " Message: "& objGsmIn.MessageData
objGsmIn.GetNextMessage()
WEnd

36
End If

The GetErrorDescription function:

Thefunction retrieve the explanation of an error code.

Parameters:

 Error code.

Return value:

The Error string is the return value.

The Example:
Set objGsmIn = CreateObject( "ActiveXperts.GsmIn" )
objGsmIn.Receive()
If objGsmIn.LastError <> 0 Then
WScript.Echo "Error description: " & objGsmIn.GetErrorDescription(
objGsmIn.LastError )
End If

2.10 Smpp Object:


The Smpp object enables high volumes and corporate SMS messaging. We must sign-up
with an SMPP-compliant SMSC provider before we can actually use the SMPP object

The Smpp object connects to the remote SMPP-compliant SMSC provider using the
SMPP network protocol. SMPP ('Short Message Peer-to-Peer') is a Layer-7 TCP/IP
protocol, which allows you to send high volumes SMS messages, usually 10 SMS
messages per second or more. Messages can be 'acknowledged', which means that
delivery can be guaranteed.

The Smpp object only allows sending of SMS messages.


The Smpp object supports both v.3.3 and v.3.4 of SMPP.

We can send different types of SMS messages:

 Text - Plain text (default)


 Unicode - Unicode message
 Ringtones
 Logo's
 Data - Data message (raw, 8 bits)
 Data - Data message (UDH)
 WAP Push - Propagate a URL to the remote recipient's WAP phone
 WAP Bookmark - Propagate a bookmark to the remote recipient's WAP phone

37
2.10.1 Send SMS Message Through SMPP by the use of the Smpp Object:

The following sample demonstrates how to deliver an SMS message through an SMPP-
compliant SMSC provider by the use of the Smpp object:
Set objSmpp = CreateObject( "ActiveXperts.Smpp" )
' SMSC Server properties
objSmpp.Server = "smpp.activexperts-labs.com" ' ActiveXperts SMPP Demo
server
objSmpp.ServerPort = 2775 ' TCP port
objSmpp.SystemID = "AX005" ' Account to logon to the
SMSC provider
objSmpp.SystemPassword ="812056"'Password to logon to the SMSC provider
objSmpp.Connect ' Establish a TCP/IP
based SMPP session
If objSmpp.IsConnected = True Then
objSmpp.MessageRecipient = "+31647134225" ' Recipient SMS number
objSmpp.MessageData = "Hello World via SMPP" ' SMS message text
objSmpp.Send
If( objSmpp.LastError <> 0 ) Then
WScript.Echo "Failed to send message, error: " & objSmpp.LastError
Else
WScript.Echo "Message successfully delivered"
End If
objSmpp.Disconnect
End If

38
Table 2.3 Overview of Functions for Smpp Object:

Function Description
Activate Activate the product
Clear Clear all properties
Connect Establish an SMPP connection to the remote SMPP provider. Based on TCP/IP
Disconnect Disconnect current SMPP connection
Send Send an SMS message
QueryStatus Query message status of an outgoing message
Cancel Remove an outgoing pending message from SMPP provider
GetFirstMessage Get first incoming message
GetNextMessage Get next incoming message
GetStatusDescription Lookup status description of the given status code
GetErrorDescription Lookup error description of the given error code

Activate function:

This functions activates the SMS and Pager Toolkit product. A valid registration code should be
passed as parameter.

Parameters:

 The registration code

Return value:

Always zero. The ‘LastError’ property can be checked to see whether the function was
completed successfully

The Example:
Set objSmpp = CreateObject( "ActiveXperts.Smpp" )
objSmpp.Activate "xxxxx-xxxxx-xxxxx" ' replace xxxxx-xxxxx-xxxxx by your
personal registration code

The Clear function:


This function resets all ‘Properties’ to their initial, default values.

Parameters:

 None

Return value:

Always zero. The ‘LastError property’ can be checked to see whether the function was
completed successfully

Example:
Set objSmpp = CreateObject( "ActiveXperts.Smpp" )
...

39
objSmpp.Send()
objSmpp.Clear()
...
objSmpp.Send()
objSmpp.Clear()

The Connect function:


Establish an SMPP connection to the remote SMPP-compliant SMSC provider. Based on
TCP/IP. If it is connected to the SMPP provider, we can simply check if the connection is
still established by checking the “IsConnected” property.
You must first sign-up with an SMPP-compliant SMSC provider before you can connect
to it. The function requires a “Server” and “Port” specification, as well as a valid
“SystemID” and “SystemPassword” to log on.

Parameters:

 None

Return value:

Always zero. The “LastError” property can be checked to see whether the function was
completed successfully

Example:
Set objSmpp = CreateObject( "ActiveXperts.Smpp" )
objSmpp.Server = "smpp.yoursmppprovder.com" ' DNS name of the remote SMPP
provider
objSmpp.ServerPort= "8011" ' TCP port number
objSmpp.SystemID = "yourlogin" ' SystemID provided by the
SMSC
provider
objSmpp.SystemPassword = "yourpassword" ' Password provided by the SMSC
provider
...
If( objSmpp.IsConnected = False )

objSmpp.Connect() ' Connect to the remote SMPP


provider
End If

The Disconnect function:

40
Disconnect a connection that was established by the “Connect” function.
You can call 'Disconnect' even when there is no connection, to make sure the session gets
disconnected.

Parameters:

 None

Return value:

Always zero. The “LastError” property can be checked to see whether the function was
completed successfully

The Example:
Set objSmpp = CreateObject( "ActiveXperts.Smpp" )
...
If( objSmpp.IsConnected = False )
objSmpp.Disconnect()
End If

The Send function:


Send an SMS message. The contents of the message is indicated by the “MessageData”
and “MessageType” properties. It must first “connect” to the SMPP provider before you
actually send the message. The provider returns a message ID which is stored in the
“MessageReference” property after a successfull submission.

Parameters:

 None

Return value:

Always zero. The “Last Error” property can be checked to see whether the function was
completed successfully

The Example:
Set objSmpp = CreateObject( "ActiveXperts.Smpp" )
objSmpp.Server = "smpp.activexperts.com"
objSmpp.ServerPort = 8011
objSmpp.SystemID = "8888sdsad"
objSmpp.SystemPassword = "add34dfa8"
objSmpp.SystemType = "SMPP"
objSmpp.Connect
If objSmpp.IsConnected = True Then

41
objSmpp.MessageData = "Hello, world (1)"
objSmpp.MessageRecipient = "+31624896641"
objSmpp.Send ' Send a message
If( objSmpp.LastError = 0 )
WScript.Echo "MessageReference: " & objSmpp.MessageReference
En d If
objSmpp.MessageData = "Hello, world (2)"
objSmpp.MessageRecipient = "+3162910877"
objSmpp.Send ' Send another message
If( objSmpp.LastError = 0 )
WScript.Echo "MessageReference: " & objSmpp.MessageReference
End If

objSmpp.Disconnect ' Disconnect


End if

The QueryStatus function:


Query the status of a message that was successfully submitted by the “Send” function.
The function querie the messages that is indicated by the “MessageReference” property.
If the function completes successfully (i.e. if the “LastError” is 0 after the call), you can
check the “StatusCode” property to check the status of the message.

Parameters:

 None

Return value:

Always zero. The “LastError” property to see whether the function was completed
successfully

Example:
Set objSmpp = CreateObject( "ActiveXperts.Smpp" )
objSmpp.Server = "smpp.activexperts.com"
objSmpp.ServerPort = 8011
objSmpp.SystemID = "8888sdsad"
objSmpp.SystemPassword = "add34dfa8"
objSmpp.SystemType = "SMPP"
objSmpp.Connect
If objSmpp.IsConnected = True Then
objSmpp.MessageReference = "FABCFACD" ' A message ID that was a result
of a previous submission

42
objSmpp.QueryStatus ' Query the status of the
message
If( objSmpp.LastError = 0 )
WScript.Echo "Status: " & objSmpp.StatusCode
WScript.Echo "Status description: " & objSmpp.GetStatusDescription(
objSmpp.StatusCode )
WScript.Echo "Status updated at: " & objSmpp.StatusTime
End If
objSmpp.Disconnect ' Disconnect
End if

The Cancel function:


Cancel a message that was previously submitted by the “Send” function.The function will
only work for SMS message that were not yet delivered to the recipient (i.e. pending at
the SMSC provider).

Parameters:

 None

Return value:

Always zero. The “LastError” property can be checked to see whether the function was
completed successfully

Example:
Set objSmpp = CreateObject( "ActiveXperts.Smpp" )
...
objSmpp.Connect
If objSmpp.IsConnected = True Then
objSmpp.MessageData = "Hello, world (1)"
objSmpp.MessageRecipient = "+31624896641"
objSmpp.Send ' Send a message
If( objSmpp.LastError = 0 )
objSmpp.Cancel ' Try to cancel the
message
that has just been sent
End If
objSmpp.Disconnect ' Disconnect
End if

The GetFirstMessage and GetNextMessage functions:

43
Use the 'GetFirstMessage' and 'GetNextMessage' functions to retrieve incoming messages
- one by one - from the SMPP provider. Call 'GetFirstMessage' and 'GetNextMessage' as
long as “LastError” is 0.

Parameters:

 None

Return value:

Always zero. The “LastError” property can be checked to see whether the function was
completed successfully.

Example:
Set objSmpp = CreateObject( "ActiveXperts.Smpp" )
...
objSmpp.Connect ' Connect to SMPP
provider
If objSmpp.IsConnected = True Then
While( True )
objSmpp.GetFirstMessage() ' Get frist incoming
message - if any
While objSmpp.LastError = 0
WScript.Echo "Message received from " & objSmpp.MessageSender
WScript.Echo " Message body: " & objSmpp.MessageData
...
objSmpp.GetNextMessage() ' Get the next message
WEnd
...

objSmpp.Sleep( 5000 ) ' Wait for 5 seconds to


check for incoming
messages again
WEnd
objSmpp.Disconnect ' Disconnect
End if

The GetStatusDescription function:


The function retrieve the description of a “status code”.

Parameters:

 Status code, for a list of valid status codes

44
Return value:

The status string is defined as return value.

Example:
Set objSmpp = CreateObject( "ActiveXperts.Smpp" )
...
objSmpp.MessageReference = "FEBBACDA"
objSmpp.QueryStatus()
If objSmpp.LastError <> 0 Then
WScript.Echo "Status code: " & objSmpp.StatusCode
WScript.Echo "Status description: " & objSmpp.GetStatusDescription(
objSmpp.StatusCode )
End If

The GetErrorDescription function:


The function to retrieve the explanation of an “error code”.

Parameters:

 Error code.

Return value:

The Error string is defined as return value.

Example:
Set objSmpp = CreateObject( "ActiveXperts.Smpp" )
...
objSmpp.Send()
If objSmpp.LastError <> 0 Then
WScript.Echo "Error description: " & objSmpp.GetErrorDescription(
objSmpp.LastError )
End If

2.11 DialUp Object:


The DialUp object enables we send SMS messages using a normal Hayes compatible
modem (1200 bps or higher). The modem connects to an SMSC dial-in Service
Provider to deliver the SMS message. It can be used the DialUp object to send SMS
messages; receiving messages is not supported by the nature of SMSC Service Providers.
The DiaUp object can only send messages one-by-one.

45
There are many SMSC dial-in service providers around the world; for a list of supported
SMS providers.

The DialUp object communicates with a normal modem using either a direct COM port,
or using a Windows telephony device. It is recommended to use Windows telephony
devices, for instance 'Standard 5600 bps Modem'.
If a Windows telephony device is used, settings are controlled by the Windows telephony
driver, and can be configured through the 'Phone and Modem' settings:

 Open the Windows Control Panel from the Start menu;


 Double-click on 'Phone and Modem Options' and select the 'Modems' tab;
 Select the preferred modem and click on 'Properties'; from here, you can
change the settings.

To select a 'Phone and Modem' device in the toolkit's object, assign an existing telephony
name to the Device property:

 Device - the literal Windows telephony device string, for instance: 'Standard
9600 Modem'.

Alternatively, it can be used a port directly, for instance: 'COM1'. As a result, device
properties must be configured properly before sending messages:

 Device - The actual COM port, formatted as COMx, where x represents the
COM port number;
 DeviceHwFlowControl - Hardware flow control is used to regulate commands
from PC to device and visa versa; default: On;
 DeviceSwFlowControl - Software flow control is used to regulate data from
device to device; default: Off;
 DeviceSpeed - The speed to be used to communicate with the GSM modem or
GSM phone; default: 0 (which means that factory defaults are used for modem
communications);
 DeviceSettings - The number of databits, paritybits and stopbits; default: 8
databits, no parity, 1 stopbit;
 DeviceInitString - The modem initialization string is used to initialize the
modem; default value: '' (which means a generic initialization string will be
used).

It can be set the Sender address to indicate the originator of the message. (this is different
from the GsmOut object, where the Sender address is inherited from the SIM card and -

46
as a result - cannot be overwritten). To set the Sender address, assign the following
property:

 Sender - the SMS address of the sender. Default value: "00000000000"

To indicate the Recipient of the message, you must set the 'MessageRecipient' property:

 MessageRecipient - the SMS number of the person that should receive the
message. The length of the field must be between 4 and 20 digits.

It can be only sent plain text messages. To send advanced SMS messages (like: flash,
multi-part messages, data, ringtones, unicode, etc.) you must use the “GsmOut object”.
This object requires a GSM modem or GSM phone to deliver its messages.

There are two types of SMSC dial-in providers:

 TAP/XIO providers
 UCP providers

The DialUp object supports them both. Our list of “supported SMSC providers” shows
the type of provider (TAP/XIO or UDP) for each provider. It must tell the DialUp object
what type of provider you are going to dial:

 ProviderType - type of provider: TAP/XIO or UCP. Default: UCP

Send an SMS message through an SMSC dial-in provider:

The following sample demonstrates how to send an SMS message though an SMSC
provider. A standard 19200 modem is used to connect to the remote SMSC dial-in
provider:

Set objDialUp = CreateObject( "ActiveXperts.DialUp" )


objDialUp.Device = "Standard 19200 bps modem"' Use a standard modem
objDialUp.Sender= "0627308601"' Your mobile number (if you have one, otherwise
leave it blanc)
objDialUp.MessageRecipient = "012345678"' Recipient's mobile number
objDialUp.MessageText = "Hello, world !" ' Message body
objDialUp.ProviderType = asPROVIDER_TYPE_UCP ' Provider is UCP
objDialUp.ProviderDialString = "0,0653141414" ' Dial-in number,
dial a 0 first
objDialUp.Send() ' Deliver the message
to the provider

47
If( objDialUp.LastError <> 0 ) Then
WScript.Echo "Failed to send message, error: " & objDialUp.LastError
Else
WScript.Echo "Message successfully sent"
End If
NOTE: As an alternative, "Standard 19200 bps modem" can be replaced by "COM1",
assuming that the modem is connected on COM1. However, It is recommend to use
Windows telephony devices.

2.12 Pager Object:


The Pager object enables to send pager messages using a normal Hayes compatible
modem (1200 bps or higher). The modem connects to the remote pager directly. The
Pager object communicates with a normal modem using either a direct COM port, or
using a Windows telephony device. It is recommended to use Windows telephony
devices, for instance 'Standard 5600 bps Modem'. If a Windows telephony device is used,
settings are controlled by the Windows telephony driver, and can be configured through
the 'Phone and Modem' settings:

 Open the Windows Control Panel from the Start menu;


 Double-click on 'Phone and Modem Options' and select the 'Modems' tab;
 Select the preferred modem and click on 'Properties'; from here, we can change
the settings.

To select a 'Phone and Modem' device in the toolkit's object, assign an existing telephony
name to the Device property:

 Device - the literal Windows telephony device string, for instance: 'Standard
9600 Modem'.

Send a Pager message:

The following sample demonstrates how to send a Pager message:

Set objPager = CreateObject( "ActiveXperts.Pager" )


objPager.Device = "Standard 19200 bps modem" ' Use a standard modem
objPager.MessageRecipient = "0742781722,,66#" ' Pager recipient:
0742781722, extension
number 66
objPager.Send() ' Deliver the message to
the recipient
If( objPager.LastError <> 0 ) Then

48
WScript.Echo "Failed to send message, error: " & objPager.LastError
Else
WScript.Echo "Message successfully sent"
As an alternative, "Standard 19200 bps modem" can be replaced by "COM1", assuming
that the modem is connected on COM1. However, it was recommend to use Windows
telephony devices.

2.13 WapPush and WapBookmark objects:


WAP Push messages are specially formatted SMS messages that display an alert message
to the user, and give the user the option of connecting directly to a particular URL via the
mobile phone’s WAP browser.

The WAP specifications define a format for applications to create XML-based "PAP"
(Push Access Protocol) documents that can be posted to an operator’s “PPG” (Push Proxy
Gateway), in order to deliver a WAP Push message to a mobile device. The complexity of
the WAP format has made it difficult for developers to deploy WAP Push in their
applications in the past.

The SMS and Pager Toolkit makes it easy to generate and deliver WAP Push messages.
You can send WAP Push messages using a GSM modem (or GSM phone), or using an
SMPP messages. Use the WapPush object to format the message of the SMS, and use the
regular “GsmOut” or “Smpp” functions to send the Wap Push formatted message.

Sending Wap Bookmarks is just like sending Wap Push messages: use the WapBookmark
object to encode the Wap Bookmark message, and send out this meessage using
“GsmOut” or “Smpp”.

2.14 IO.Dll Synopsis:


IO.DLL allows seamless port I/O operations for Windows 95/98/NT/2000/XP using the
same library.

In the pre-Windows days, it was a relatively simple matter to access I/O ports on a typical
PC. Indeed, nearly every language sported a special command for doing so. As Windows

49
emerged and gradually evolved, this flapping in the wind behaviour could no longer be
tolerated because of operating system's ability to virtualize hardware.

Virtualizing hardware means that an application (typically a DOS box in Windows)


believes it is talking directly to a physical device, but in reality it is talking to a driver that
emulates the hardware, passing data back and forth as appropriate. This is how we are
able to open dozens of DOS boxes in Windows session, each one with the strange notion
that it has exclusive access to peripherals such as the video adapter, keyboard, sound card
and printer.

If one were to rudely bang out data to an I/O port that Windows thought it was in full
control of, the "official bad thing" could occur, the severity of which depending upon the
exact hardware that was being accessed. Actually, with the virtualization just mentioned,
it is quite improbable that Windows would permit anything too nasty from occurring.

Windows 95/98 actually does allow I/O operations be executed at the application level,
although you'd be hard pressed to find a language that supports this directly. Typically the
programmer will have to resort to assembly language for this kind of low-level control. If
you know what you are doing, this can be a quick and easy way to access I/O ports. Of
course, not everyone knows, or desires to learn 80x86 assembly programming just
because they want to turn on a lamp from their computer. However, the unwillingness to
learn assembly language becomes rather trivial when faced with 9x's big brother.

Windows NT/2000/XP, being the secure operating system that it is, does not permit port
I/O operations at the application level at all. Period. A program with inline IN and OUT
assembly instructions that runs perfectly on Windows 95/98 will fail horribly when it
comes to Windows NT/2000/XP.

Windows NT/2000/XP does, however, allow I/O instructions in its kernel mode drivers.
A kernel mode driver runs at the most privileged level of the processor and can do
whatever it pleases; including screwing up the system beyond repair, thus writing a kernel
mode driver is not for the feint of heart.

If we were to take it upon yourself to wade through the documentation of the Windows
NT/2000/XP ddk and piece together a driver that was callable by application to do the I/O
instructions on behalf of your application, probably notice something not too pleasant--
this sort of access is painfully slow. The call from application level to system level
typically takes about one millisecond. Compare this to the one microsecond that a normal
I/O access takes. To further the insult, It is at the whim of the operating system. If it has

50
tasks which it believes are of higher priority than lowly call to driver, it will perform
them, making precise timing nearly impossible.

Obviously, writing a driver that does acts a proxy for the I/O calls isn't the most ideal
solution. There is, however, a solution for NT/2000/XP that allows the same convienience
of inline assembly language that 95/98 does.

As mentioned, a kernel mode driver can do whatever it wants. The implication here is that
if another kernel mode driver shut off application access to the I/O ports, it should be
possible for another kernel mode driver to turn it back on. This is where IO.DLL enters
the picture.

2.14.1 Licensing:

IO.DLL is completely free! However, it may not:

 Charge others for it in any way. For example, it cannot sell it as a stand alone
product.
 Charge for an IO.DLL wrapper, such as an OCX or Delphi control whose purpose
is just to put a fancy interface on IO.DLL. These to be considered as"derived
works" and they must be provided free of charge.
 Claim that it is general property.

Also, the author (that's me) cannot be held liable due to IO.dll's failure to perform.

2.14.2 Description of IO.DLL:

IO.DLL provides a useful set of commands for reading and writing to the I/O ports. These
commands are consistent between 95/98 and NT/2000/XP. Furthermore, there is no need
for the programmer to learn assembly language or muck with kernel mode drivers.
Simply link to the DLL and call the functions. It's that easy.

Windows NT/2000/XP is accommodated through the use of a small kernel mode driver
that releases the ports as needed to the application. This driver is embedded in the DLL
and is installed if Windows NT/2000/XP is determined to be the underlying operating
system.

Due to the very minor overhead involved in dynamically linking to IO.DLL, and the
optimized functions contained within, access to I/O ports is nearly as fast as if it was
written in raw assembler and inlined in application. This holds true for both Windows
95/98 and Windows NT/2000/XP.

51
Before moving on, it is probably prudent to mention that the technique employed in
IO.DLL for releasing the ports to the application level isn't, strictly speaking, the proper
way to do things. The proper way is to have a virtual device driver for Windows 95/98
and a kernel mode driver for Windows NT/2000/XP. This isn't very practical for many
people though, nor is it really necessary. There are several successful commercial
products on the market that do exactly what IO.DLL does.

For this project, IO.zip or IO.dll file should have to download from Internet. Each of
these file contains all required files and size is 46 kilo-Byte.

The following two files are required for C++ users. The io.cpp and io.h file are required
for the prototypes section. The C/C++ Prototypes are:

void WINAPI PortOut(short int Port, char Data);


void WINAPI PortWordOut(short int Port, short int Data);
void WINAPI PortDWordOut(short int Port, int Data);
char WINAPI PortIn(short int Port);
short int WINAPI PortWordIn(short int Port);
int WINAPI PortDWordIn(short int Port);
void WINAPI SetPortBit(short int Port, char Bit);
void WINAPI ClrPortBit(short int Port, char Bit);
void WINAPI NotPortBit(short int Port, char Bit);
short int WINAPI GetPortBit(short int Port, char Bit);
short int WINAPI RightPortShift(short int Port, short int Val);
short int WINAPI LeftPortShift(short int Port, short int Val);
short int WINAPI IsDriverInstalled();

To use IO.DLL with Visual C++/ Borland C++, etc, “LoadLibrary” and
“GetProcAddress” are needed to use.

Just save io.cpp and io.h files in PC and should be included them in the developed
project. The Visual C++ user may need to add #include "StdAfx.h" at the top of io.cpp
otherwise the compiler will face a problem. These files take care of calling “LoadLibrary”
and all the necessary calls to “GetProcAddress”, which will help to get desired result.

The step do is calling the “LoadIODLL” at the beginning of the customize program.
Make sure to do this or it will find faced with all sorts of interesting crashes. The file
should include the following procedure and function prototypes:

procedure PortOut(Port : Word; Data : Byte);


procedure PortWordOut(Port : Word; Data : Word);

52
procedure PortDWordOut(Port : Word; Data : DWord);
function PortIn(Port : Word) : Byte;
function PortWordIn(Port : Word) : Word;
function PortDWordIn(Port : Word) : DWord;
procedure SetPortBit(Port : Word; Bit : Byte);
procedure ClrPortBit(Port : Word; Bit : Byte);
procedure NotPortBit(Port : Word; Bit : Byte);
function GetPortBit(Port : Word; Bit : Byte) : WordBool;
function RightPortShift(Port : Word; Val : WordBool) : WordBool;
function LeftPortShift(Port : Word; Val : WordBool) : WordBool;
function IsDriverInstalled : Boolean;
To use these functions in Delphi program, the correct calling convention of stdcall is
required. For example:
procedure PortOut(Port : Word; Data : Byte); stdcall; external 'io.dll';

For Visual Basic users the following prototypes are required:

Private Declare Sub PortOut Lib "IO.DLL" (ByVal Port As Integer, ByVal Data
As Byte)
Private Declare Sub PortWordOut Lib "IO.DLL" (ByVal Port As Integer, ByVal
Data As Integer)
Private Declare Sub PortDWordOut Lib "IO.DLL" (ByVal Port As Integer, ByVal
Data As Long)
Private Declare Function PortIn Lib "IO.DLL" (ByVal Port As Integer) As Byte
Private Declare Function PortWordIn Lib "IO.DLL" (ByVal Port As Integer) As
Integer
Private Declare Function PortDWordIn Lib "IO.DLL" (ByVal Port As Integer) As
Long
Private Declare Sub SetPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit
As Byte)
Private Declare Sub ClrPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit
As Byte)
Private Declare Sub NotPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit
As Byte)
Private Declare Function GetPortBit Lib "IO.DLL" (ByVal Port As Integer,
ByVal Bit As Byte) As Boolean
Private Declare Function RightPortShift Lib "IO.DLL" (ByVal Port As Integer,
ByVal Val As Boolean) As Boolean
Private Declare Function LeftPortShift Lib "IO.DLL" (ByVal Port As Integer,

53
ByVal Val As Boolean) As Boolean
Private Declare Function IsDriverInstalled Lib "IO.DLL" As Boolean

2.15 Functions:

In this project work Visual Basic language is used for coding the customize software.
Therefore the above mentioned prototypes for the particular language are used. The used
functions that are supported by the included prototypes are described as follows:

PortOut : This function is used to output a byte to the specified port.

PortWordOut: The function is used to output a word (16-bits) to the specified


port.

PortDWordOut: The function is used to output a double word (32-bits) to the


specified port.

PortIn : The function is used to read a byte from the specified port.

PortWordIn : The function is used to read a word (16-bits) from the specified
port.

PortDWordIn: The function is used to read a double word (32-bits) from the
specified port.

SetPortBit : The function is used to set the bit of the specified port.

ClrPortBit : The function is used to clear the bit of the specified port.

NotPortBit : The function is used to NOT (invert) the bit of the specified port.

GetPortBit : The function is used to return the state of the specified bit.

RightPortShift: The function is used to shift the specified port to the right. The
LSB is returned, and the value passed becomes the MSB.

LeftPortShift: The function is used to shift the specified port to the left. The MSB
is returned, and the value passed becomes the LSB.

IsDriverInstalled: The function is used to return non-zero if io.dll is installed and


functioning. The primary purpose of this function is to ensure that
the kernel mode driver for NT/2000/XP has been installed and is
accessible.

54
CHAPTER – 3

The Customized Software

3.1 Introduction:

A customized software is developed, coded and installed to implement this project. The
developed software is written in Visual Basic 6.0 which is logically interfaced with “SMS
and Pager Toolkit” and “IO.dll file”. In this project, to handle SMS and paging
information the “ActiveXpert Toolkit” is used and to configure the parallel port “IO.dll
file” is used. The developed software is written in this project works with the SMS from
a GSM mobile.

3.2 General Feature:

The general features of the developed customized software are:


 The software can handle with a SMS from GSM mobile.
 The software is coded in Visual Basic 6.0.
 The software linked with “ActiveXperts SMS and Page Toolkit”.
 The objects are written in this software are “ActiveXpert.GsmIn”,
“ActiveXperts.SmsConstants” and “ActiveXpert.GsmOut”.
 The software is also linked with IO.dll file to configure the parallel port. Here the
COM 3 port is used.
 The software is capable to delete the message from the receiving mobile storage
(SIM or device) once after reading the SMS.
 It is also featured with generating a confirmation message to the remote sender
after reading the SMS.

3.3 Supporting System and Software:

In this project work, it is required to take help of various systems and require to provide
necessary link with supporting software. The supporting auxiliaries are:
i. Visual Basic 6.0 language which is used to give dual interfacing. One is
generating switching signal from the sent SMS and then send it to the parallel
port. Another is creating an interactive Main Menu for the potential user.

55
ii. ActiveXpert Toolkit which is used to handle the SMS and Paging information.
The toolkit is used to read SMS from the mobile phone, delete the SMS already
read, send back a confirmation message to the remote sender.
iii. Infrared USB Driver which provides necessary link between mobile phone and
PC.
iv. PC equipped with Windows XP.

3.4 The Main menu:

The following figure Fig. 3 shows the main menu of the developed customized software.

Fig.3 : Main Menu of the Developed Software

In this menu the “Message” text box is used to display the sender SMS (like Light ON,
Light OFF, Fan ON, Fan OFF).
The “Sender Number” text box displays the sender mobile phone number, who has sent
SMS for controlling the device.
“Switch1 (Light)” & “Switch2 (Fan)” text box display the present state of devices i.e. the
state of light & Fan respectively. After carrying out the action as per received SMS the
text boxes are modified.

56
“Error Message” text box is used to display the error message if an unrecognized SMS is
sent.
“Return Message” text box is used to display a “Successful” message which is sent back
to the sender after carrying his request.

3.5 Guideline for Users:

It is very interactive and simple system. Therefore it is easy to operate. Any novice used
can flow the following instructions to get smooth and error free operation:

At first, be sure that your PC is equipped with Windows XP, Visual Basic 6.0, ActivXpert
Toolkit, and
IO.dll file. Your PC must have a Parallel Port also.
Copy the customized software in your PC.
Run the software.
Test whether the phone is successfully connected. To be sure go to control pannel and see
COM port where the phone is connected and then set COMx in program. Be sure that
your phone is infrared supported.
Now the system is ready to operate. To control the switches of electrical devices simply
send SMS from the remote cell phone to the interfaced mobile phone.
To switch ON the light, send a text message “Light ON” to the interfaced mobile phone.
To switch OFF the Light, write a text message “Light OFF” and send to the interfaced
mobile phone.
To swtich ON the Fan, write a text message “Fan ON” and send and so on.
To switch ON all devices write text message “All ON” and to switch OFF all devices
write “All OFF” and send to the interfaced mobile phone.
If you send correct message you will get a successful conformation message.
Otherwise you will get a message to try again and an error message will be displayed.
Don’t send blank message

57
CHAPTER - 4

Hardware Design

4.1 Introduction:
The hardware section of this project has an interfacing circuit only which is used to drive
the switches of the controlled appliances. This section includes a signal conditioner
circuit to provide appropriate DC voltage for the relay operated switch. The signal
conditioner circuit has three parts: a step down transformer, a bridge rectifier circuit and a
filter circuit. In this project, an IBM parallel printer port is used to interface the electrical
devices. The printer port has been used as a bi-directional data communication port in the
SPP mode whose base address is assigned as 378h. The port address for parallel printer
port is fixed to 378h to 37Fh for LPT1 and 278h to 27Fh for LPT2 so there is no need for
extra address decoding as in the case with ISA slot. In BIOS there are different modes for
parallel port, each of them has its own specification. This chapter describes each of these
modes in details. At the beginning of this chapter, it also gives an idea about parallel port
adapter, parallel port centronics handshake, and parallel port addresses. Then the design
and functions of the electrical circuit is presented.

4.2 Parallel Printer Port of PC:

The Parallel Port is the most commonly used port for interfacing home made projects.
This port will allow the input of up to 9 bits or the output of 12 bits at any one given time,
thus requiring minimal external circuitry to implement many simpler tasks. It's found
commonly on the back of the PC as a D-Type 25 Pin female connector. The original
IBM-PC's Parallel Printer Port had the followings:

 12 digital outputs and 5 digital inputs accessed via 3 consecutive 8-bit ports in the
processor's I/O space.
 8 output pins accessed via the DATA Port

 5 input pins (one inverted) accessed via the STATUS Port

 4 output pins (three inverted) accessed via the CONTROL Port

58
 8 ground pins

The following figure Fig 4.1 shows the over view of a D-type 25 pin female port.

Fig 4.1 D-type 25 pin Female Parallel Printer Port Pin Configuration
There may also be a D-Type 25 pin male connector. This will be a serial RS-232 port and
thus, is a totally incompatible port.

4.3 Parallel Port Programming Considerations:

The printer adapter responds to five I/O instructions: two outputs and three inputs. The
output instructions transfer data into two latches whose outputs are presented on the pin
soft a 25-pin D-type female connector. Two of the three input instructions allow the
processor to read back the contents of the two latches. The third allows the processor to
read the real time status of a group of pins on the connector. A description of each
instruction is given below:

4.3.1 Output to address 278/378/3BC Hex:

The instruction captures data from the data bus and is present on the respective pins.
These pins are each capable of sourcing 2.6 mA and sinking 24 mA. It is essential that
the external device not try to pull these lines to ground.
The bit vs pin assignment is given bellow:

Bit 7 6 5 4 3 2 1 0
Pin 9 8 7 6 5 4 3 2

59
4.3.2 Output to address 27A/37A/3BE Hex:

This instruction causes the latch to capture the least significant bits of the data bus. The
four least significant bits present their outputs, or inverted versions of their outputs, to the
respective pins shown bellow:

Bit 7 6 5 4 ~3 2 ~1 ~0
Pin - - - IRQ 17 16 14 1

enable

If bit 4 is written as 1, the card will interrupt the processor on the condition that pin 10
transitions high to low.

These pins are driven by open collector drivers pulled to +5 volt dc through 4.7 k-ohm
resistors. They can each sink approximately 7 mA and maintain 0.8 volts down level.

4.4 Parallel Port Addresses:


The Parallel Port has three commonly used base addresses. These are listed in Table 4.1.
The 3BCh base address was originally introduced used for Parallel Ports on early Video
Cards. This address then disappeared for a while, when Parallel Ports were later removed
from Video Cards. They have now reappeared as an option for Parallel Ports integrated
onto motherboards, upon which their configuration can changed using BIOS be.

LPT1 is normally assigned base address 378h, while LPT2 is assigned 278h. However
this may not always be the case as explained later. 378h & 278h have always been
commonly used for Parallel Ports. The lower case h denotes that it is in hexadecimal.
These addresses may change from machine to machine.

When the computer is first turned on, BIOS (Basic Input/Output System) will determine
the number of ports you have and assign device labels LPT1, LPT2 & LPT3 to them.
BIOS first look at address 3BCh. If a parallel Port is found here, it is assigned as LPT1,
and then it searches at location 378h. If a Parallel card is found there, it is assigned the
next free device label. This would be LPT1 if a card wasn't found at 3BCh or

60
LPT2 if a card was found at 3BCh. The last port of call is 278h and follows the same
procedure than the other two ports. Therefore it is possible to have a LPT2 which is at
378h and not at the expected address 278h.

Some manufacturers of Parallel Port cards have jumpers which can be used to set the Port
to LPT1, LPT2, and LPT3. On the majority of cards LPT1 is 378h, and LPT2, 278h, but
some will use 3BCh as LPT1,378h as LPT1 and 278h as LPT2.

The assigned devices LPT1, LPT2 & LPT3 should create no difficulty to interface a
device to the PC. Most of the time, the base address is used to interface the port rather
than LPT1 etc. However to find the address of LPT1 or any of the Line Printer Devices, a
lookup table provided by BIOS can be used. When BIOS assigns addresses to the printer
devices, it stores the address at specific locations in memory.

Table 4.2 LPT addresses in the BIOS data area .

Start Address Function


0000:0408 LPT1's Base Address
0000:040A LPT2's Base Address
0000:040C LPT3's Base Address
0000:040E LPT4's Base Address (Note 1)

The above Table 4.2, shows the address at which the Printer Port's addresses in the BIOS
Data Area can be found. Each address takes up 2 bytes.

4.5 Parallel Port Modes In BIOS:


Today, most Parallel Ports are multi-mode ports. They are normally software
configurable of one of many modes from BIOS. The typical modes are:
(i) Printer Mode (Sometimes called Default or Normal Modes)
(ii) Standard & Bi-directional (SPP) Mode
(iii) EPP1.7 and SPP Mode
(iv) EPP1.9 and SPP Mode
(v) ECP Mode
(vi) ECP and EPP1.7 Mode
(vii) ECP and EPP1.9 Mode

61
Printer Mode is the most basic mode. It is a Standard Parallel Port in forward mode
only. It has no bi-directional feature, thus Bit 5 of the Control Port will not
respond. Standard & Bi-directional (SPP) Mode is the bi-directional mode. Using
this mode, bit 5 of the Control Port will reverse the direction of the port, so a value
can read back on the data lines.

EPP1.7 and SPP Mode is a combination of EPP 1.7 (Enhanced Parallel Port) and SPP
Modes. In this mode of operation the SPP registers (Data, Status and Control) and the
EPP Registers can be accessed. In this mode the direction of the port can be reversed
using bit 5 of the control register.

EPP1.9 and SPP Mode is just like the previous mode, only it uses EPP version 1.9
this time. As in the previous mode, using this mode access to the SPP registers,
including Bit 5 of the control port is possible. However this differs from EPP1.7
and SPP Mode in that it also has access to the EPP Timeout bit.

ECP Mode gives an Extended Capabilities Port. The mode of this port can then be
set using the ECP's Extended Control Register (ECR). However in this mode from
BIOS the EPP Mode (100) will not be available.

ECP and EPP1.7 Mode and ECP and EPP1.9 Mode gives an Extended Capabilities Port,
just like the previous mode. The above modes are configurable through BIOS.

4.6 Standard Parallel Printer Port:

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second.
Table 4.3 gives a table of the "Pin Outs" of the D-Type 25 Pin connector and the
Centronics 36 Pin connector. The D-Type 25 pin connector is the most common
connector found on the Parallel Port of the computer. The IEEE 1284 standard however
specifies 3 different connectors for use with the Parallel Port. The first one, 1284 Type A
is the D-Type 25 connector found on the back of most computers. The 2nd is the 1284
Type B, which is the 36 pin Centronics connector found on most printers. IEEE 1284.
The third, 1284 Type C however, is a 36 conductor connector like the Centronics, but
smaller.

62
Table 4.3 Pin assignments of the 25 pin parallel printer port connector.

Pin No (D- Pin No Direction Hardware


SPP Signal Register
Type 25) (Centronics) In/out Inverted
1 1 Nstrobe In/Out Control Yes
2 2 Data 0 Out Data
3 3 Data 1 Out Data
4 4 Data 2 Out Data
5 5 Data 3 Out Data
6 6 Data 4 Out Data
7 7 Data 5 Out Data
8 8 Data 6 Out Data
9 9 Data 7 Out Data
10 10 Nack In Status
11 11 Busy In Status Yes
Paper-Out /
12 12 In Status
Paper-End
13 13 Select In Status
NAuto-
14 14 In/Out Control Yes
Linefeed
15 32 nError / nFault In Status
16 31 Ninitialize In/Out Control Yes
nSelect-Printer
17 36 In/Out Control Yes
/ nSelect-In
18 – 25 19-30 Ground Gnd

The Table 4.3 uses "n" in front of the signal name to denote that the signal is active low.
The "Hardware Inverted" means the signal is inverted by the Parallel card's hardware. The
output of the Parallel Port is normally TTL logic levels. Most Parallel Ports implemented
in ASIC, can sink and source around 12mA.

4.6.1 Signals from PC to LPT1 port:

There are 12 signals from the PC to printer. Out of these, eight signals are data bits
and four signals are control signals.

The data bits are D0-D7. This is purely a write only port, which means it can be
used only to output data.

63
The control signals are: STROBE, INIT, SLCT IN, and AUTO FEED XT. All the
control signals are low active.

STROBE: The printer should take the data when this signal is low.

INIT: When INIT is low, the printer resets its electronics logic and clears the printer
buffer.

SLCT IN: SLCT IN is an interface enable signal. When this signal is low, the printer
responds to signals from the controller.

AUTO FEED XT: After printing every line, the printer will provide one line feed
automatically if this signal is low. This type of line feed is known as hardware line feed.

4.7 The Main Interfacing Circuit:


The home automation system includes both hardware and software.. The software system
is for actual speech recognition and the hardware system is for communicating with the
electrical devices through the parallel printer port. In this system , eight electrical devices
are controlled with eight different speech commands. The interfacing circuit for
contolling two electrical devices is shown in the figure

6V 4
1 220
From Relay
Power 2
6V
Device -
Section 3 5 1

Pin 2 R
D0

4
1
Relay
2
6V Device -
3 5 2

Pin 3
R
D1

Fig -4.1 Main Interfacing Circuit

64
.

The interfacing circuit includes following components:


1. Diode(4007)
2: NPN Transistor(D400)
3. Relay(6 V)
4. Transformer(220V-6V)
5. Resistor(1Kohms)

The purpose of each component is described below:

Here two diodes are used for each electrical device in the main block. The Diode1(D1) is
used to restrict the conflict that may happen when the source voltage is short circuited
with the computer mainboard. The Diode2(D2) is used as if the relay device is not
switched by itself.

Each of the transistor is used as a switch whose collector is connected with a relay in
series .The base of each transistor , Diode1 and a resistor is connected with series which
will be connected with one of the data pins(Pin2-Pin9) of the parallel printer port. The
emitter of each transistor is connected with the ground pin (Pin 18) of the same port.

Here 6V relay has been used. A relay device has 5 pins .The relay becomes on when a
6V is applied at pin1 and approximately 0V is applied at pin3. Pin3 of each relay device
is connected with the collector of one of the transistors as shown in the figure 3.1. Pin2
is connected with one phase of a AC source. The other phase of AC source and Pin5 is
connected with a electrical device. When the transistor is saturated, the relay device
becomes on and Pin2 and Pin5 is closed and the connected device becomes on. Each of
the transistors is controlled by sending voltages to the parallel port pins.

65
4.8 The Power supply section:

The power supply section is shown in fig 4.2

Diode

220 – 6
220 V
V To Load Driver
AC
Circuit
6V
DC

Transformer Bridge Rectifier Filter

A transformer along with a rectifier circuit is used to obtain 6V DC which is connected to


pin1 of each of the relay devices.

A resistor of 1 Kohms is used to restrict the current flow through the interfacing circuit.

66
Chapter - 5

Conclusion

5.1 Discussion:
In the project, Various software and hardware are used for this project. The software
uesed under this project are ActiveXperts pager toolkits, IO.dll file, Siemens CX-75
Software, Visual Basic 6.0 & Siemens CX-75 data cable software. The Hardware section
has an interfacing circuit, an infrared supported GSM mobile phone, an user mobile
phone for sending message and an USB infrared. This project is designed and developed
to control electrical devices through Short Text Message (SMS). The project is dedicated
to control home appliances like fan, light, TV etc. The developed system can receive
SMS from GSM mobile only. The received SMS is translated by the developed
customized software to generate necessary switching signals. The signal is sent to the
parallel port for controlling the home appliances. The parallel port drives the switching
circuit of the load. This system is interactive as well as user friendly. The project is
designed to control two electrical devices only. The customized software is coded,
compiled, executed and more tested. The performance of the system is satisfactory. But it
may be needed to control many devices. Therefore the project need further extension.
This system is also extendable and provides adequate facilities for further development.

5.2 Recommendation for future work:

The project is capable to handle the switching ON/OFF control of two devices only. But
there may be many more devices in a modern home. Therefore the system is needed to
modify as the requirement of potential user.

The system is developed for GSM mobile only. So this system can be upgraded to
CDMA, TDMA or any other types of mobile.

67
The hardware is designed for single phase device controlling which may be modified to
control for three phase devices also.

In future the project can be implemented to control the sophisticated office equipments.

For industrial control, this system can be extensively used with a little bit modification.

The installation cost of this project is high and need dedicated PC and may be impractical
for private home automation. But it may put a great appeal to a hotel manager or a office
manager or industrialist.

68
REFERENCES

[1] McAdams, J.(2006) SMS for SOS: Short Message Service earns valued role as a
link of last crisis communications. http://www.few.com/article972790-04-03-06-
Print April 3 2006.

[2] Textually.org (2006). Mobile Technology Aids Swedish Evacuation.


http://www.texually.org/textually/archives/2006/07/012985.htm, July 20, 2006.

[3] G. Aranguren, L. Nozal, A. Blazuez, and J. Arias, “Remote control of sensors and
actuators by GSM”, IEEE 2002 28th Annual Conference of the Industrial
Electronics Society IECON 02, vol. 3 , 5-8 Nov. 2002, pp.2306-2310.

[4] Wu, Bing-Fei, Peng, Hsin-Yuan; Chen, Chao-Jung “A practical home security
system via mobile phones”,WSEAS Transactions on Communications, v 5, 2006,
pp. 1061-1066.

[5] Kim. Eung Soo, Kim, Min Sung, “Design and fabrication of security and home
automation system”, ICCSA 2006, International Conference Computational
Science and Its Applications Proceedings-Part III, 2006 pp. 31-37.

[6] Yang Lili, Yang Shuang-Hua, Yao Fang, “Safety and security of remote
monitoring and control of intelligent home environments”, Proceedings-IEEE
Internationals Conference on Systems, Man and Cybrnetics, 2007, pp.1149-1153.

[7] A. Alheraish, “Design and Implemention of Home Automation System,” IEEE


Transactions on Consumer Electronics, vol. 50, no 4, Nov. 2004, pp. 1087-1092.

[8] H. Kanma, N. Wakabayashi, R. Kanazawa, H. Ito, “Home Appliance Control


System over Bluetooth with a Cellular Phone,” IEEE Transactions on Consumer
Electronics, vol.49, no. 4, Nov. 2003, pp. 1049-1053.

[9]. Global System for Mobile Communications Organization. “GSM World”


http://www.gsmworld.com visited on 16/06/2004

[10] Puneet Gupta, SMS: How, what and where, Wireless Development Network

[11] Microchip Technology – PIC 16F7x Data Sheet, Microchip 2001.

[12] Operational Manual, Remote control by Mobile phone kit, MK160, ApogeeKits
Electronic Kits & Tools, UK.

[13] Robert L. Boylestad and Lovis Nashelsky Electronic Devices and Circuit theory,
7th edition. Prefice Hall.

[14] J.B. Gupta, Switchgear protection, Pagerback, January 2007

[15] Technical information (2008, November 11) Network Management &


Development Tools. [Online]. Available at www.activexperts.com/activsms
/smpplist.

69
[16] Technical Information (2008, November 13) Geek Hideout. [Online]. Available at
http://www.geekhideout.com/iodll.shtml

[17] “SMS Remote Control,” available at http://www.serasidis.gr/circuits


smscontrol/smscontroller.htm

[18] Sams Teach Yourself Visual Basic 6 in 24 Hours- By Greg Perry

[19] Programming Microsoft Visual Basic 2005-Publisher: Microsoft Press

[20] Beginning Visual Basic 6- By Peter Wright, Published by Wrox Press, August
1998, Paperback, 900 pages, ISBN 1861001053.

[21] Teach Yourself Visual Basic 6 in 21 Days: Complete Training Kit- By Greg
Perry, Published by Sams, Softcover, Published December 1999, 1060 pages,
ISBN 0672315122

[22] Microsoft Visual Basic 6.0 Deluxe Learning Edition -By Michael Halvorson,
Published by MS Press, 1328 pages w/ CD-ROM, ISBN 1572318732

[23] Visual Basic 6 from the Ground Up -By Gary Cornell, Published by McGraw
Hill, Sept 1998, 932 pages, ISBN 0078825083

[24] Advanced Microsoft Visual Basic 6.0 -By the Mandelbrot Set, Published by MS
Press, November 1998, Paperback, 880 pages, ISBN 1572318937

[25] Hardcore Visual Basic, Second Edition (w/CD) -By Bruce McKinney Published
by Microsoft Press July 1997, Paperback, 730 pages, ISBN 1572314222.

[26] Microsoft Visual Basic Professional 6.0 Step by Step -by Michael Halvorson.

[28] Visual Basic 2008 Programmer's Reference (Programmer to Programmer) by Rod


Stephens.

[29] Microsoft Visual Basic 2005 Express Edition Programming for the Absolute
Beginner by Jr., Jerry Lee Ford

[30] Microsoft Visual Basic 2005 Express Edition Programming for the Absolute
Beginner by Jr., Jerry Lee Ford

[31] Mastering Microsoft Visual Basic 2008 by Evangelos Petroutsos

[32] Visual Basic 2005 Cookbook: Solutions for VB 2005 Programmers (Cookbooks
(O'Reilly)) by Tim Patrick and John Craig

[33] Programming Microsoft Visual Basic 2005: The Language by Francesco Balena

[34] Visual Basic 2005 How to Program (3rd Edition) (How to Program (Deitel)) by
Harvey & Paul) Deitel & Deitel (Paperback - May 18, 2006)

70
Appendix

Codes of Customized Software


Dim b As Integer
Dim str2 As String
Dim str3 As String
Dim str4 As String

Dim str1 As String

Private Sub Combo1_Click()


'Text1.FontName = Combo1
End Sub

Private Sub Form_Load()


Timer1.Interval = 500
'Set objGsmIn = CreateObject("ActiveXperts.GsmIn")
End Sub

Private Sub Timer1_Timer()


Set objGsmIn = CreateObject("ActiveXperts.GsmIn")
Set objConstants = CreateObject("ActiveXperts.SmsConstants")
objGsmIn.Device = "COM3"
objGsmIn.EnterPin ("1234")
objGsmIn.Storage = objConstants.asSTORAGE_DEVICE
'objGsmIn.DeleteAfterReceive = True
objGsmIn.Receive
objGsmIn.GetFirstMessage

While (objGsmIn.LastError = 0)

'Dim lList As ListItem

'Set lList = ListView.ListItems.Add(, , objGsmIn.MessageTime) ' Add data to


list control

'lList.SubItems(1) = objGsmIn.MessageSender
'lList.SubItems(2) = objGsmIn.MessageData

objGsmIn.GetNextMessage

Wend

'objGsmIn.MessageData = "hello"
'For i = 1 To Screen.FontCount - 1
'Combo1.AddItem Screen.Fonts(i)
'Next
'Combo1.ListIndex = 0
Open "c:\kam.Text" For Output As #1

71
Print #1, objGsmIn.MessageData
Print objGsmIn.MessageData
str1 = "Lighton"
str2 = "Lightoff"
str3 = "Fanon"
str4 = "Fanoff"

If (StrComp(str1, objGsmIn.MessageData) = 0) Then Call SetPortBit(888, 0)


If (StrComp(str2, objGsmIn.MessageData) = 0) Then Call ClrPortBit(888, 0)

If (StrComp(str3, objGsmIn.MessageData) = 0) Then Call SetPortBit(888, 1)


If (StrComp(str4, objGsmIn.MessageData) = 0) Then Call ClrPortBit(888, 1)

Close #1

End Sub

Module for the Customized Software:

Public Declare Sub PortOut Lib "IO.DLL" (ByVal Port As Integer, ByVal Data As Byte)
Public Declare Sub PortWordOut Lib "IO.DLL" (ByVal Port As Integer, ByVal Data As
Integer)
Public Declare Sub PortDWordOut Lib "IO.DLL" (ByVal Port As Integer, ByVal Data
As Long)
Public Declare Function PortIn Lib "IO.DLL" (ByVal Port As Integer) As Byte
Public Declare Function PortWordIn Lib "IO.DLL" (ByVal Port As Integer) As Integer
Public Declare Function PortDWordIn Lib "IO.DLL" (ByVal Port As Integer) As Long
Public Declare Sub SetPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As Byte)
Public Declare Sub ClrPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As Byte)
Public Declare Sub NotPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As
Byte)
Public Declare Function GetPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As
Byte) As Boolean
Public Declare Function RightPortShift Lib "IO.DLL" (ByVal Port As Integer, ByVal Val
As Boolean) As Boolean
Public Declare Function LeftPortShift Lib "IO.DLL" (ByVal Port As Integer, ByVal Val
As Boolean) As Boolean
Public Declare Function IsDriverInstalled Lib "IO.DLL" () As Boolean

72

You might also like