Combined application of Jini and Bluetooth technology
With the wide application of embedded systems in various electronic devices, the development of computer technology will enter a stage of Pervasive CompuTIng. The ensuing networking of various electronic devices has become an inevitable trend. Various household appliances that are closely related to human life can be connected into a network and connected to the Internet. People can control various household appliances to work together at any time and any place, which will greatly change and affect people's lives. This article discusses the realization of this universal computer system.
1 Jini technology
Jini technology is a new distributed peer-to-peer computing structure based on the Java language.It is a dynamic automation mechanism that enables various digital devices without configuration, installation, or manual intervention in a temporary device collection (federal, federaTIon) work together. Any device in the federation can manage itself regardless of size, forming a service network, and every member in the federation can share resources and services. The Jini structure provides a mechanism to enable electronic devices and applications to join or withdraw from the Federation at any time.
Jini is composed of three parts: infrastructure, programming model and services. Although these three parts are different but inseparable, the basic structure supports and uses the programming model; the service is embedded in the basic structure, and the service object contains and uses the interface of the programming model to communicate between the services. The infrastructure solves basic issues such as how devices and software connect to the network and register. It consists of components that form a distributed federation, and its smallest core is a distributed security system, discovery and join protocol (discovery and join), service protocol and lookup service (lookup service). The distributed security model and its implementation define the authentication method and operation authority of the software entity; the discovery and joining protocol defines the method for the service to join the Jini system; the search service is the place for service registration, and the service objects that can be used are provided here set. The programming model is also distributed, including three important interfaces: leasing, distributed transaction processing, and event processing. The lease interface defines a time-based resource allocation and release method; the transaction interface introduces an object-oriented protocol that uses voting and submission to unify the related behavior between objects, making an event sequence complete or none at all occur. The event and notification interface extends the event model used in the formation of JavaBean to a distributed event model and supports Jini service event-based communication. Services are the core of the Jini system. Both the infrastructure and the programming model support the submission and registration of services and the discovery of services. The services use the infrastructure to complete the mutual call between services, discover each other, and publish this service to other services. Services appear in the form of objects in the Jini environment. It defines the operations and characteristics that it can provide for other services through interfaces.
Jini uses the discovery protocol (discovery) to search the lookup service (lookup service), obtain the proxy interface of the corresponding lookup service, and then uses the join protocol (join) to register itself to the lookup service, at which time the service can be used by other services. Devices or applications that want to use other services first connect to their neighboring search service. At this time, you can see all the services available in the federation. After using the lookup protocol to download the proxy interface of the service you are interested in, you can directly communicate with the service provider. Also when a search service starts, it also uses the discovery protocol to broadcast its appearance to the service so that the service can register.
Figure 1 depicts the image of the above process: using the discovery protocol to search for a search service, if a URL of a search service has been preset, you can communicate directly; register the service agent object to the search service; The service office is downloaded to the local; use the service object to communicate directly with the service provider and use the service.
2 Bluetooth protocol
Bluetooth is a low-cost technology that can achieve low-power, short-range fixed communication on battery-operated target computers. These target machines include: PDA, wireless phone, portable computer and wireless headset.
In Bluetooth topology, a master device can take multiple slave devices and maintain 7 links. Generally speaking, at any moment, the master device will maintain point-to-point communication with a slave device. Two types of communication can be established: one transmits data asynchronously and the other transmits sound synchronously. The type of communication is determined by the master device and is responsible for establishing the link required for a particular application until the application terminates it. Please note: The master-slave relationship cannot be interchanged. The interchange technology is used in GSM cellular phones. Bluetooth does not support this technology. At the same time, Bluetooth can only support short-range communication, up to 10m. Enhanced standards now can increase the distance to 100m, requiring longer battery life for portable devices. Bluetooth technology does not replace the wireless LAN function proposed in IEEE 802.11. In comparison, Bluetooth can only operate at a data rate of 744Mbps. Of course, IEEE 802.11 LAN is also more expensive.
Bluetooth can support the communication between the wireless host controller (responsible for air link management, modem, voice encoding / decoding) and another host with a protocol stack and application software. If the application software wants to control the wireless host controller, then a link management proxy (link management proxy) module is needed, which can provide an application program interface. This module is not specified in the Bluetooth standard, but if you want to communicate through the host control interface, the protocol stack should include this module. The main function provided by the stack interface is to initialize the discovery process and the connection process. The discovery process sends management information to all Bluetooth devices within 10m in order to obtain a list of available Bluetooth devices; the connection process can establish a connection with one or more available Bluetooth devices. All applications must use these processes. They are part of the GAP (General Access Protocol). Before any application can use the link, the GAP must be connected to the Bluetooth device.
Link security will use the authentication process to confirm whether a device can be interconnected with another device when implementing a subnet. The authentication operation is completed by the wireless host controller, and the authentication command is issued by the security management module. The module will access the previously completed operation process, and can connect with the Bluetooth device database information. These records are stored in the device database, and the security database maintains the service records related to the three security levels provided by the main Bluetooth device. When establishing a connection between two devices, the security management module will respond, query the database of the two devices, and request the wireless controller to start the authentication process or ignore the authentication process. The same is true for data link layer encryption. The stack controller is another module included in the stack software, which can provide an interface to call the stack software, so as to continue to process the sorted or buffered data sent by the host or other Bluetooth devices through the wireless host controller. More importantly, the stack management module manages all internal stack clocks, so it is very easy to use the stack, and it is very easy to port to other operating systems. The remaining modules are classified according to application requirements. This is also the case of actual Bluetooth connection when running the Bluetooth protocol.
3 Combined application scheme of Jini and Bluetooth technology
3.1 Comparison of Jini and Bluetooth technology
Jini and Bluetooth technology are two highly complementary technologies. Bluetooth technology mainly realizes wireless connection of adjacent electronic devices, which is a wireless interconnection protocol of hardware devices; Jini is a software technology that implements distributed software services (including wireless devices). Bluetooth technology is a static description of the interoperability between a fixed set of protocols; Jini's "mobile code" proxy service object can dynamically interoperate. The position of the two in the ISO / OSI architecture is shown in Figure 2. Jini is mainly located in the presentation layer and the conversation layer, and the Bluetooth protocol stack runs through the entire architecture. Jini's discovery protocol and distributed security model strengthen the Bluetooth technology discovery process and security management module.
3.2 Application Scheme
Jini's registration and deregistration services are very similar to Bluetooth devices joining and leaving the network. Jini controls the lease of network services and always keeps the search service up to date. The application examples will be described in detail in the next section, and the program design will be carried out in this section.
There are usually three forms to realize its Jini network function: device implementation based on complete virtual machine, device implementation based on embedded virtual machine and device implementation based on shared virtual machine.
The device based on the implementation of a complete virtual machine refers to a general general-purpose device, which has a network connection, a strong computing storage function, and can run a complete Java virtual machine environment. On this device, all the functions of Jini system can be realized, such as various protocol functions, RMI, lease update function, dynamic code movement function, distributed security mechanism, etc. Jini is a functional layer on top of the operating system and virtual machine. Multiple devices are randomly networked to form a distributed resource sharing system. The network transmission protocol is generally used by the operating system to use TCP / IP protocol wired mode and wireless connection mode based on Bluetooth protocol. Two kinds. This design is based on the wireless connection of the Bluetooth protocol. Figure 3 describes an application scenario. Service clients, devices and network agents are connected via Bluetooth network, and also support TCP / IP protocol. The network contains accessible device databases and search services. The Bluetooth network is responsible for the device joining the network through the SDP protocol, so that the device can query, discover the nearest devices, and access these devices to achieve remote control. The remote control realizes the functions of the Bluetooth network and Jini's search service dialogue, and inquiries about available devices on the network. The search service maintains a dynamic list of all devices running on the network, such as PDAs, phones, and CD players. When a service customer (remote control) requests, all these devices send the relevant drivers to the service customer. When the device is no longer in use, it will warn the network through the termination of the lease. This is the function of Jini, which is mainly implemented by Java RMI. This way of communicating and maintaining service updates allows Jini to integrate well with Bluetooth networks.
4 Application examples
Based on Jini and Bluetooth, a wireless network jukebox JBMP3 was developed. It has the following functions: play songs selected by the client, client graphical interface, and personalize the client playlist. The system structure is shown in Figure 4. It consists of a server program that can play music files (mp3 files), several client programs (remote control) that can control the service program, and a search service that can support Jini services. The operating network is a TCP / IP network.
The application and the drawings are described in detail as follows:
(1) The karaoke device publishes a proxy object owned by the service itself. For example, it is possible to play music files in first-in first-out order.
(2) Client program-universal remote control, asking what services the search service network can provide.
(3) The search service answers the client's query through a copy of the proxy object matching the request.
(4) All requests from the client are sent to the same server (singing server). The request reaches the VOD server through Jini network 5, and the server updates the proxy objects connected to it through their respective links (4). At the same time, the updates of the karaoke machine are displayed in a consistent form.
The design is mainly divided into three parts: remote control interface design, client design, server design.
4.1 Code generated by the remote control interface
import net. Jini. core. lease. *;
public inteRFace RemoteControl {
public String getName ();
public java.awt .Component. getDisplay ();
public Lease lease (long TIme)
throws
java. rmi. RemoteExcepTIon,
LeaseDeniedException,
UnknownLeaseException;
}
getName (): The universal remote control needs to know the name of the service in order to display the correct name of the service on the graphical interface.
getDisplay (): Universal remote control requires a graphical interface to control the different services that have been discovered.
lease (long time): General remote control needs to know how long it is allowed to use a certain service (lease time).
4.2 Client design
The client should only need to do limited operations and let the server do most of the work. Because clients that use very few resources to run on devices with slow processors and small memories are only suitable for handheld devices like PDAs or cellular phones, the client must support some operations here. They are:
(1) The ability to discover services that have been registered on the network. For example, ask about the services available for finding services.
(2) The ability to be notified when a service is available on the network. For example, after issuing a request, the proxy object is received from the lookup service.
(3) Ability to rent server resources for any period of time (non-infinite length). This is done by the client's lease manager.
(4) Ability to receive the proxy object and then display it to the client via the interface. This article is implemented on the Java panel in Universal Remote Control.
The client interface should be able to display the different services provided by the network. The song queue in the current playlist should be automatically updated on the display.
4.3 Server design
Because the client function is not strong, some additional functions must be added on the server. Therefore, the server must at least support the following operations:
(1) Provide a service. Such as proxy objects.
(2) Discover and find services and publish proxy objects on the network.
(3) Write service identity (unique to each agent) object to file.
(4) Renew the lease.
(5) Disconnect the client whose lease has expired.
The above points are the core of the application. These points constitute the basic communication features used to build Jini applications. The server should be able to load the directory and find all mp3 files. The server is a physical jukebox, it should have some kind of hardware to play mp3 audio files.
The combined application of Jini and Bluetooth technology has the following advantages in the communication environment: first, no network cable is required; second, no device driver needs to be installed; again, one device remotely controls another device. These features make the network easier to connect and manage. Although the cost of Bluetooth technology development and production is relatively high, Jini is a free product of SUN company, it is easy to master the application programming interface, and can perform distributed computing. With the release, continuous promotion and integration of Bluetooth technology and Jini technical specifications, the interconnection of various electrical appliances in life will become more and more convenient. Jini's plug-and-play function and Bluetooth wireless networking make the increase in equipment The reduction becomes very simple, so that the construction of the network can be gradually improved in stages without having to be in place at once, which meets the needs of ordinary users. The combination of Jini technology and Bluetooth is bound to further promote the rapid development of information wireless networks and become another important application field of information networks, which will greatly change people's lifestyles and promote the arrival of the era of pervasive computing.
36V Power Battery,Motorcycle Battery Pack,Custom Cruise Lithium Battery,Electric Motorcycle Lithium Battery
Sichuan Liwang New Energy Technology Co. , https://www.myliwang.com