M-TICKET – Mobile Booking

General Configuration of AT Commands:

1. AT+CMGF: Message Format

This command is used to select SMS protocol data unit (PDU) mode or SMS Text mode.

Command Possible Responses
+CMGF=[<mode>] OK
+CMGF? +CMGF :< mode>
+CMGF=? +CMGF : ( list of supported<mode>s)

<mode>: 0: PDU mode; 1: text mode;

2. AT+CMGL: List Messages

Command Possible Responses
+CMGL [=<stat>] +CMGL: message…
+CMGL=? +CMGFL : ( list of supported <stat>s)

<stat>: status of messages to be read.

Defined values:

0: received unread

1: received read

2: stored unsent

3: stored sent

4: all

3. AT+CMGR: Read Message

Command Possible Responses
+CMGR [=<index>] +CMGR: message…
+CMGR=? OK

4. AT+CMGS: Send Message

Command Possible Responses
+CMGS =<da>[,<toda>] +CMGS: <mr>
+CMGS=? OK

<da>= Destination Address

5. AT+CMGD: Delete Message

Command Possible Responses
+CMGD =<index> OK
+CMGD=? OK

3.5 MSComm Properties

1. CommEvent Property:

This returns the most recent communication event or error. This property is not available at design time and is read-only at run time.
Syntax:
object.CommEvent
The CommEvent property syntax has these parts:

Part Description
Object An object expression that evaluates to an object in the Applies To list.

Although the OnComm event is generated whenever a communication error or event occurs, the CommEvent property holds the numeric code for that error or event. To determine the actual error or event that caused the OnComm event, you must reference the CommEvent property.

Communication events include the following settings:

Constant Value Description
comEvSend 1 There are fewer than Sthreshold number of characters in the transmit buffer.
comEvReceive 2 Received Rthreshold number of characters. This event is generated continuously until you use the Input property to remove the data from the receive buffer.
comEvCTS 3 Change in Clear To Send line.
comEvDSR 4 Change in Data Set Ready line. This event is only fired when DSR changes from 1 to 0.
comEvCD 5 Change in Carrier Detect line.
comEvRing 6 Ring detected. Some UARTs (universal asynchronous receiver-transmitters) may not support this event.
comEvEOF 7 End Of File (ASCII character 26) character received.

Data Type: Integer

2. CommPort Property:

Sets and returns the communications port number.
Syntax:
object.CommPort [= value ]
The CommPort property syntax has these parts:

Part Description
Object An object expression that evaluates to an object in the Applies To list.
Value An integer value specifying the port number.

Data Type: Integer

We can set value to any number between 1 and 16 at design time (default is 1). However, the MSComm control generates error 68 (Device unavailable) if the port does not exist when attempted to open it with the PortOpen property.

3. InBufferCount Property:

Returns the number of characters waiting in the receive buffer. This property is not available at design time.

Syntax:

object.InBufferCount[ = value ]

The InBufferCount property syntax has these parts:

Part Description
Object An object expression that evaluates to an object in the Applies To list.
Value An integer value specifying the number of characters waiting in the receive buffer.

Data Type: Integer

InBufferCount refers to the number of characters that have been received by the modem and are waiting in the receive buffer to take them out. We can clear the receive buffer by setting the InBufferCount property to 0.

4. InBufferSize Property:

Sets and returns the size of the receive buffer in bytes.

Syntax:

object.InBufferSize [ = value ]

The InBufferSize property syntax has these parts:

Part Description
Object An object expression that evaluates to an object in the Applies To list
Value An integer expression specifying the size of the receive buffer in bytes.

Data Type: Integer

InBufferSize refers to the total size of the receive buffer. The default size is 1024 bytes. Larger the receive buffer, lesser the memory available to our application. However, if the buffer is too small, it runs the risk of overflowing unless handshaking is used. As a general rule, we start with a buffer size of 1024 bytes. If an overflow error occurs, then the buffer size is increased to handle the application’s transmission rate.

5. PortOpen Property

Sets and returns the state of the communications port (open or closed). Not available at design time.
Syntax:
object.PortOpen [ = value ]

The PortOpen property syntax has these parts:

Part Description
Object An object expression that evaluates to an object in the Applies To list.
Value A Boolean expression specifying the state of the communications port.

Settings: The settings for value are

Setting Description
True Port is opened
False Port is closed

Data Type: Boolean

Setting the PortOpen property to True opens the port. Setting it to False closes the port and clears the receive and transmit buffers. The MSComm control automatically closes the serial port when the application is terminated.

It is necessary to make sure the CommPort property is set to a valid port number before opening the port. If the CommPort property is set to an invalid port number when we try to open the port, the MSComm control generates error 68 (Device unavailable).

In addition, the serial port device must support the current values in the Settings property. If the Settings property contains communications settings that our hardware does not support, then the hardware may not work correctly.

If either the DTREnable or the RTSEnable properties is set to True before the port is opened, the properties are set to False when the port is closed. Otherwise, the DTR and RTS lines remain in their previous state.

6. Input Property:

Returns and removes a stream of data from the receive buffer. This property is not available at design time and is read-only at run time.
Syntax:
object.Input
The Input property syntax has these parts:

Part Description
Object An object expression that evaluates to an object in the Applies To list.

Data Type: Variant

The InputLen property determines the number of characters that are read by the Input property. Setting InputLen to 0 causes the Input property to read the entire contents of the receive buffer.

The InputMode property determines the type of data that is retrieved with the Input property. If InputMode is set to comInputModeText then the Input property returns text data in a Variant. If InputMode is comInputModeBinary then the Input property returns binary data in an array of bytes in a Variant.

7. Output Property:

Writes a stream of data to the transmit buffer. This property is not available at design time and is write-only at run time.
Syntax:
object.Output [ = value ]
The Output property syntax has these parts:

Part Description
Object An object expression that evaluates to an object in the Applies To list.
Value A string of characters to write to the transmit buffer.

Data Type: Variant

The Output property can transmit text data or binary data. To send text data using the Output property, we must specify a Variant that contains a string. To send binary data, we must pass a Variant which contains a byte array to the Output property.

Normally, if we are sending an ANSI string to an application, we can send it as text data. If we have data that contains embedded control characters, Null characters, etc., then we may pass it as binary data.

8. OutBufferCount Property:

Returns the number of characters waiting in the transmit buffer. One can also use it to clear the transmit buffer. This property is not available at design time.

Syntax:

object.OutBufferCount [ = value ]

The OutBufferCount property syntax has these parts:

Part Description
Object An object expression that evaluates to an object in the Applies To list.
Value An integer expression specifying the number of characters waiting in the transmit buffer.

Data Type: Integer

We can clear the transmit buffer by setting the OutBufferCount property to 0.

9. OutBufferSize Property:

Sets and returns the size, in bytes, of the transmit buffer.

Syntax:

object.OutBufferSize [ = object ]

The OutBufferSize property syntax has these parts:

Part Description
Object An object expression that evaluates to an object in the Applies To list.
Value An integer expression specifying the size of the transmit buffer.

Data Type: Integer

OutBufferSize refers to the total size of the transmit buffer. The default size is 512 bytes. Larger the receive buffer, lesser the memory available to our application. However, if the buffer is too small, it runs the risk of overflowing unless handshaking is used. As a general rule, we start with a buffer size of 512 bytes. If an overflow error occurs, then the buffer size is increased to handle the application’s transmission rate.

10. NullDiscard Property:

Determines whether null characters are transferred from the port to the receive buffer.

Syntax:

object.NullDiscard [ = value ]

The NullDiscard property syntax has these parts:

Part Description
Object An object expression that evaluates to an object in the Applies To list.
Value A Boolean expression specifying whether null characters are transferred from the port to the receive buffer, as described in Settings.

Settings: The settings for value are:

Setting Description
True Null characters are not transferred from the port to the receive buffer.
False (Default) Null characters are transferred from the port to the receive buffer.

Data Type: Boolean

A null character is defined as ASCII character 0, Chr$(0).

11. Settings Property:

Sets and returns the baud rate, parity, data bit, and stop bit parameters.
Syntax:
object.Settings [ = value ]
The Settings property syntax has these parts:

Part Description
Object An object expression that evaluates to an object in the Applies To list.
Value A string expression representing the communications port settings, as described below.

Data type: String

If value is not valid when the port is opened, the MSComm control generates error 380 (Invalid property value).

Value is composed of four settings and has the following format:

“BBBB, P, D, S”

Where BBBB is the baud rate, P is the parity, D is the number of data bits, and S is the number of stop bits. The default value of value is:

“9600, N, 8, 1”

Settings:

  • The valid baud rates are: 110, 300, 600, 1200, 2400, 9600(Default), 14400, 19200, 28800, 38400, 56000, 128000, and 256000.
  • The valid parity values are: E (Even), M (Mark), N (None) (Default), O (Odd) and S (Space).
  • The valid data bit values are: 4, 5, 6, 7, 8 (Default).
  • The valid stop bit values are: 1 (Default), 1.5, 2.
Chitra
Chitra

27 thoughts on “M-TICKET – Mobile Booking

  1. Hi Chitra,
    I like this project and I hope you don’t mind shearing.
    Please send code as an attachemt to my email.

    thanks for sharing.

  2. i very much interested to get more details about this M ticket booking .

    ourself is event marketting firm from oman. our requirement is to book tickets and purchace through mobile sms sytem and send soft copy of tickets to their moble .After this at the entrance they can show their tickets on their moble itself and can entry to the location and also they can reserve seat also .

  3. I am an M.Cs student…
    I am trying to do this project but for the local train ticket
    so can you give me the source code of the project.
    plz really it is very helpful to me…
    Thanks

  4. INTERESTING, I’VE BEEN CONTEMPLATING A PROJECT IN SAME DOMAIN AS WELL AS FOR TAXI BOOKING. IS IT POSSIBLE FOR US TO RUN A PILOT/ EVALUATION OF YOUR PROJECT IN OUR TERRITORY? I’D LOVE TO COLLABORATE, KINDLY SEND ME MORE DETAILS BY EMAIL

  5. please.can i get the code for this program? I’m doing a similar project. thanks

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the latest updates on your inbox

Be the first to receive the latest updates from Codesdoc by signing up to our email subscription.

    StudentProjects.in