Introduction
With the continuous progress and development of science and technology, people have put forward higher requirements for the quality of life. As a new body, home network is getting closer and closer to people's lives. It joins the family unit as a node into the big family of the network. Among them, the home gateway, as a bridge connecting the home and the Internet, plays a pivotal role. The main functions of the embedded gateway are as follows:
Remote control: customers can access the server of the home network through the browser of any PC connected to the Internet; the status of the equipment in the home network will be displayed in the client's browser in the form of HTML files; customers can realize remote control of the equipment in the home network by clicking on the corresponding equipment on the HTML page, and the result of the operation will also refresh the client's browser in the form of HTML pages.
Remote monitoring: customers can access the server of the home network through the browser of any PC connected to the Internet, and realize the automatic download of video tools and automatic playback of the required video files by clicking the control button on the HTML page, so as to display the video information of multiple cameras.
Remote maintenance: when the background database of HomeNetServer needs to be maintained, or the HTML description file of the equipment in the home network is updated, or even the network management system of the system needs to be upgraded to a new version, the administrator can remotely maintain and update the server in the home network through the Internet.
Based on these basic requirements and the limited resources of the embedded system itself, the system selected the S3C4510 chip and expanded its peripheral circuits as shown in Figure 1:
Figure 1 Peripheral expansion circuit block diagram
Among them: Flash/ROM is used to store the embedded operating system, HTTP server, CGI gateway program, home network server and file system required for various services in the home gateway. The entire home gateway software platform is stored in Flash. When the system starts, the Bootloader will be run from Flash, the operating system will be decompressed and moved into SDRAM.
Ethernet: S3C4510 has an integrated network control interface and provides a DMA channel dedicated to network communication. Through the Ethernet module, S3C4510 can connect to the Internet. The Ethernet module completes the isolation of the chip from the network and the transmission and reception of data.
System: Other peripheral circuits required by S3C4510 include: power supply circuit, external clock (50MHZ) circuit, switch and reset circuit and JTAG debugging interface circuit.
The embedded operating system selected is uClinux operating system, which is specially designed for processors without MMU. The system mostly uses Romfs file system, which is a relatively simple file system that takes up less space. Under UCLINUX, there are three main WEB servers: httpd, thttpd and boa. httpd is the simplest WBE server with simple functions and does not support authentication and CGI. Both thttpd and boa support authentication and CGI and are rich in functions. Among them, boa1 is a single-task http server with open source code, high performance and less system resource occupation. When receiving a request, the boa server does not start multiple service processes to handle multiple requests, but processes all service requests in one process. For CGI programs, a new process will be generated to handle them. Considering the limited resources of the embedded system itself and the limited number of processes of the home gateway, the system chooses the boa server in the uCLinux system.
Since the current uCLinux does not support dynamic web page technologies such as ASP and PHP, the CGI2 technology is used to connect WEB pages and local programs under uCLinux to provide dynamic and interactive features.
Figure 2 System overall design diagram
1 Configure boa server
CGI program can not run smoothly just by putting it on the server. If you want it to run smoothly on the server and accurately process user requests, you must make necessary settings on the server used.
Boa configuration file boa.conf: boa is configured in boa.conf. Most of these configurations use default values. In this system, the root of the WEB server specified by Document Root is changed to /boas.
When configuring the kernel, select boa program and cgi.
Overwrite cgi.c and makefile in the cgi_generic folder to /usr/cgi_generic/ in the program package.
Overwrite hash.c in the boa folder to /usr/boa/src in the program package.
Overwrite the rc file to /vendor/Miectek/4510 in the program package.
The files in the ucLinux system in this system use ROMFS and EXT2 running in RAM. In order to update the web page through tools such as FTP, the rc file creates a folder cgi_bin under /boas, then copies index.html, boa.conf and mine.type to /boas, and copies the CGI program to /boas/cgi_bin. So far, the basic environment for boa operation has been established. You can run boa using the command ">boa c/boas/&".
2 System Design Description
In the design of the embedded gateway, the gateway program and the HTTP server of the home network and the internal server of the home network are located on the same physical device (based on the hardware platform of S3C4510), which is responsible for connecting the HTTP server with the background database and completing the information exchange between the HTTP server and HomeNetServer.
In the design of the home gateway, according to the functional description, the gateway should be able to provide remote monitoring, remote control, and remote maintenance functions. The internal workflow of the gateway is as follows:
● If the HTTP request sent by the client is received and parsed by the HTTP server, and it is learned that the device status information is required, the HTTP server takes the device status from the static file storing the device status information, and encapsulates it into an HTTP response message and sends it back to the client.
● If the HTTP request sent by the client is received and parsed by the HTTP server, and it is found that the requested message is for the setting (operation) of the device, the CGI function will convert the message content into the home network protocol and pass it to the home network server, which will manage and control the internal devices in the home, and pass the processing results in the form of messages to the CGI program, which will be encapsulated in the form of HTTP response messages and sent back to the client.
● If the HTTP request sent by the client is received and parsed by the HTTP server, and it is found that the requested page is to provide real-time video services, the HTTP server will call the CGI function to send a message to the video data processing module, and control the video compression card through the video data processing module to complete the functions of video data acquisition, compression and transmission.
● If the HTTP request sent by the client is received and parsed by the HTTP server, and it is found that the request message contains control commands for the pan-tilt device and lens, the HTTP server will directly send control instructions to the pan-tilt decoder through the CGI function to control the pan-tilt and lens.
Figure 3: Home gateway software structure diagram
3 Design of real-time video transmission
The HTTP-based boa server is responsible for receiving and responding to HTTP requests from the client. When the request is for video information, this request sends a message to the video data processing module through the CGI function, thereby sending an event to the video device to allow the real-time video sending task to enter the running queue. The
video data processing module mainly includes real-time capture of video images (completed with the help of MPEG-4 video compression card), dynamic storage and real-time playback. The real-time playback of images can be carried out simultaneously with the real-time capture and storage of images.
Initialize the video compression card:
M878Object*pObject=NULL;
For(int i=0;i
If(!pObjectGetDataFormFile())
pObject->InitData();
m_obArray.Add(pObject);
}
Data acquisition:
for(i=0;i
OpenDev(i); //Open the device with the specified card number and allocate corresponding system resources
pObject=(M878Object*)m_obArray[i];
OutMpegBuff(i,OnMpeg4Write); //Collect video data stream
RegisterViSaveExceptionProc(i,(ViSaveErrCallBack) ViErrCallBack);
pObject->SetParamToDevice(); //Set parameters
}
Stop device:
When the device is no longer used, call ViUnInit() to shut down the video compression capture card and unload system resources.
Data sending module:
OutMpegBuff(i, OnMpeg4Write);
Void CALLBACK OnMpge4Write(DWORD dwCard, BYTE *pbuff, DWORD dwSize,
BOOL isKeyFrom)
{
if(dwCard>=g_dwDevice)
return;
g_VStrmInfo[dwCard]+=dwSize/26;
MTAWriteVideo((BYTE)dwCard, pbuff, (LONG)dwSize, isKeyFrm)
}
The sending module is responsible for sending the encoded real-time video data to the address in the address table and modifying the information in the address table. The address table is used to save the IP address of the user requesting real-time video service. The video sending task sends the video packet according to the address in the address table.
Data receiving module:
This module mainly completes the reception, decoding and display of video data. Users monitor remote devices through browsers, and the information returned by the server is displayed through browsers. The browser can be Microsoft's Internet Explorer or Netscape's Netscape Navigator. Ordinary browsers can display ordinary text and pictures in GIF, JPEG and other formats supported by HTML files. However, for real-time video data, first of all, unlike HTTP links, it is received using datagram sockets instead of stream sockets, and then it needs to be decoded and displayed, which cannot be done by browsers. In order to enable users to watch videos through browsers, this system uses ActiveX controls embedded in WEB pages, and the ActiveX controls complete the reception, decoding and display of video data. An important aspect of ActiveX Internet technology is the safe downloading and installation of ActiveX controls and required supporting files. Microsoft Internet Explore automatically downloads and installs ActiveX controls by using the Internet Component Download method in HTML documents3.
(1) Embedding of client controls
Embed ActiveX properties in the HTML file of the WEB server. For the IE browser that is most commonly used by clients, the MFCControl control that can be used in the HTML code is as follows:
The ID tag names the control and provides the HTML code to access the control. The CLASSID tag is a unique UUID that assigns a value to the control, telling IE which object to load. To achieve automatic download of controls in HTML pages, use the CODEBASE attribute of the
Previous article:LCD programming design based on ARM processor
Next article:Research on DVB-S2 Set-Top Box Solution Based on ARM9
Recommended ReadingLatest update time:2024-11-16 19:37
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- [RVB2601 Creative Application Development] LoRa Gateway Wireless Host Computer
- Newcomer Report
- There is a program with a total of 10 feeders
- Funny point, STM32 settings
- Why can't DSP connect? TMS320C6416T+seed-XDS510 PLUS
- Application of TI's high-performance charging and discharging solution in battery test equipment (Battery Test System)
- About the multi-channel link problem of sim7600ce
- Smart network desk lamp, project submission
- We are looking for positions such as speaker R&D and manufacturing engineers.
- Serial communication-What is the reason for the decrease of impedance to ground?