This series helps beginners learn about the development of a telephone ordering system based on a multi-layer C/S structure. Profit
Simplified some specific requirements for beginners. Hope to be useful to new users and hope for deficiencies
Please note.
Main functions of the system: (1) Use the incoming call display box to display the customer information. The system automatically determines the correspondence between the current number and the customer, displays the customer information, and quickly adds the customer file to the new customer number, fast food ordering (2) Customer Management (3) Order Management (4) money management (5) report generation, such as accounting of the Statistical Analysis Commission of food delivery personnel and customer information (6) permission management. other auxiliary functions include system maintenance, basic information, data maintenance, and system logs.
This time I mainly talked about the use of the incoming call display Modem, which was bought by Zhongsheng technology. The details are as follows:
Features
1. supports both DTMF and NTP.
2. Strong anti-interference, fast response, and parallel connection with telephone lines have no impact on the quality of calls.
3. Simple protocols facilitate programming. The automatic incoming call data format is:
NUM = XXXXXXX
OK
4, interface mode: Serial Port (ZS201-1C), do not need to install the driver; USB (ZS201-1U), need to install the driver.
5. Input voltage: DC5V (Note: external power supply is not required for the USB interface ).
6. Support for the telephone external line and telephone distribution line.
Protocol description:
1. Communication parameter: baud rate: 1200, data bit: 8, stop bit: 1, parity: None
2. data uploaded after a call:
"R" n (note: "r" n is the carriage return line break, and the hexadecimal value is 0D0A)
NUM = XXXXXX
"R" n
"R" n
OK
"R" n
Procedure:
(1) install the USB incoming call display box driver
(2) Configure communication parameters
(3) connect to the incoming call display box.
Note: The call display service must be activated for the phone number you are testing. Otherwise, no result is returned.
Use DEMO in C #
Http://blog.csdn.net/zh2305/archive/2008/01/12/2039372.aspx
Implementation in the system: (consider this function to write directly to the main window once)
Declare global variables:
Private SerialPort Sp = new SerialPort ();
Private delegate void HandleInterfaceUpdataDelegate (string text );
Private HandleInterfaceUpdataDelegate interfaceUpdataHandle;
Read data (CALL) information from the serial port:
Public void Sp_DataReceived (object sender, System. IO. Ports. SerialDataReceivedEventArgs e)
{
Byte [] readBuffer = new byte [Sp. ReadBufferSize];
Sp. Read (readBuffer, 0, readBuffer. Length );
// Call the interfaceUpdataHandle delegate dynamically
This. Invoke (interfaceUpdataHandle, new string [] {Encoding. UTF8.GetString (readBuffer )});
}
When the read cache of the serial port has data (that is, incoming calls) Arrival Processing:
Private void Ordering (string text)
{
String newtext = text. Substring (4); // truncation "NUM =" four characters
FrmOrderAdd frmorderadd = new frmOrderAdd (newtext); // Add the order window (Pass in the obtained phone number)
Frmorderadd. MdiParent = this;
Frmorderadd. Show ();
}
Code in the initialization window:
Public void frmInit ()
{
InterfaceUpdataHandle = new HandleInterfaceUpdataDelegate (Ordering); // instantiate the delegate object
Sp. PortName = "COM4"; // It depends on the port of your host.
Sp. BaudRate = 1200;
Sp. Parity = Parity. None;
Sp. StopBits = StopBits. One;
// Trigger the DataReceived event when data in the read cache of the serial port arrives.
Sp. DataReceived + = new SerialDataReceivedEventHandler (Sp_DataReceived); // register the event handler
Sp. ReceivedBytesThreshold = 1; // The DataReceived event is triggered when one data entry is read from the cache by the serial port.
Try
{
Sp. Open ();
MessageBox. Show ("Port" + "opened successfully! ");
}
Catch
{
MessageBox. Show ("Port" + "failed to open! ");
}
}
This analysis is complete. If you have any questions about this explanation, contact qq: 344927817 (Note: blog Park)
To be continued...