Patent Description:
In recent years, devices having functions both as an access point (AP) of infrastructure communication of wireless local area network (LAN) compliant with IEEE802. <NUM> series, and as a station (STA) which connects and communicates with the AP, have come on the market. Such a device can construct a network as an AP, and also can participate in a network constructed by other APs as an STA.

An example of communication device which can switch the role of the device (base device, slave device) is discussed in <CIT><NUM> and <CIT>.

An example of communication device in which a function of a relay station (access point) and a function of a station are operated at the same time is discussed in <CIT> (<CIT>).

When AP and STA communicate with each other, there are many setting items which need to be set before use. For example, the setting items include communication parameters to perform wireless communication, such as a service set identifier (SSID) as a network identifier, an encryption method, an encryption key, an authentication method, and an authentication key. To set these communication parameters, automatic setting methods for simply setting communication parameters to a wireless communication device are devised by various manufacturers. In these automatic setting methods, communication parameters are automatically set by providing communication parameters from one device to another device using a procedure and a message predetermined between the devices to be connected to each other.

Non Patent Literature <NUM> discusses Wi-Fi protected setup (hereinafter, WPS), which is an industry standard of a communication parameter automatic setting method between AP and STA.

When performing wireless communication between the devices having both functions of the AP function and the STA function, the communication is possible when one device constructs a network as an AP and the other device connects to the network as an STA. When devices, which are in an initial state and operate neither as AP nor as STA, try to communicate with each other, the roles of the devices need to be determined, for example, a device which becomes AP is determined.

In this case, when user's convenience is considered, it is desired that the determination of the roles is automatically performed between the devices. However, a method in which the roles are automatically determined between the devices without requiring user's operation has not been established. Therefore, when the devices have both the AP function and the STA function, the automatic setting processing of communication parameters cannot be performed, so that there is a problem that the devices operating both as AP and as STA cannot easily communicate with each other.

<CIT> describes a device capability attribute regarding a setting on communication parameters, and provision attribute information indicative of whether or not a communication terminal is in a state that it can provide communication parameters to another communication terminal are stored in advance. The communication terminal, where the device capability attribute has at least a provision capability of the communication parameters, is selected as a provision device. In a case where there are plural communication terminals where the device capability attribute has a communication parameter provision capability, a communication terminal where the device capability attribute has the communication parameter provision capability only is preferentially selected. In a case where the device capability attributes of respective communication terminals are equal, a communication terminal storing the provision attribute information indicative of the state that it can provide the communication parameters is selected as a provision device.

<CIT> describes a communication apparatus which searches for another network after a network is created, participates in another network in accordance with a role, in communication parameter setting processing, of a communication apparatus existing in another network, and executes the communication parameter setting processing. After the communication apparatus decides to receive the communication parameters from another communication apparatus, the communication apparatus determines an activation state of a providing function of a provider apparatus of the communication parameters, and requests the provider apparatus to provide the communication parameters in accordance with the determination.

<CIT>) described a frequency-hopped mobile communication system. A mobile wireless station automatically becomes a base station in accordance with the surrounding conditions, thereby automatically reconfiguring a communication network. A control frame is generated by at least one master station, and frequencies are hopped by a plurality of slave stations in accordance with the control frame. Each slave station switches the master thereof to be tracked, in accordance with the receiving conditions of the control frame and the relation between the control frame received from the master station and the status of the slave station and decides in which mode, master station or slave station, the slave station is to operate. The cells are thus automatically reconfigured.

[NPL <NUM>]
Wi-Fi CERTIFIED (TM) for Wi-Fi Protected Setup: Easing the User Experience for Home and Small Office Wi-Fi(R) Networks, http://www. org/wp/wifi-protected-setup.

The invention is defined by the appended independent claims further embodiments are described by the dependent claims.

The accompanying drawings, together with the description, serve to explain the principles of the invention.

Hereinafter, although an example which uses a wireless LAN system compliant with IEEE802. <NUM> series will be described, a communication method is not limited to a wireless LAN compliant with IEEE802.

<FIG> is a hardware block diagram illustrating a configuration example of devices described below according to an exemplary embodiment to which the present invention can be applied. The device <NUM> is an entire device. A control section <NUM> controls the entire device by executing a control program stored in a storage section <NUM>. The control section <NUM> performs a communication parameter setting control between the device and another device. A storage section <NUM> stores the control program executed by the control section <NUM> and various information such as a communication parameter. Various operations described below are performed when the control section <NUM> executes the control program stored in the storage section <NUM>. A wireless section <NUM> is for performing wireless communication. A display section <NUM> displays various information and has a function of outputting visible information as a liquid crystal display (LCD) and a light-emitting diode (LED) and a function of outputting audio information as a speaker.

A setting button <NUM> is a button to provide a trigger to start communication parameter setting processing. When the control section <NUM> detects an operation of the setting button <NUM> by a user, the control section <NUM> performs processing described below. An antenna control section <NUM>, and an antenna <NUM> are illustrated in <FIG>. An input section <NUM> is a section for a user to input various information.

<FIG> is a block diagram illustrating an example of a configuration of software function blocks performed by the devices in the communication parameter setting processing described below. A device <NUM> is an entire device. A packet receiving section <NUM> is a section for receiving packets of various communication. Beacon (notification signal) is received by the packet receiving section <NUM>. Also, a device search signal such as a probe request is received by the packet receiving section <NUM>. The probe request can be treated as a network search signal for searching a desired network. A probe response which is a response signal to the probe request is also received by the packet receiving section <NUM>.

A packet transmitting section <NUM> is a section for transmitting packets of various communication. Transmission of beacon is performed by the packet transmitting section <NUM>. The probe request and the probe response which is a response signal to the probe request are also transmitted by the packet transmitting section <NUM>. Various information (self-information) of a transmission source device is added to the device search signal and the response signal thereto. An AP control section is a section for controlling an access point (AP) communication function. An operation as an access point (AP) described below is performed by using the AP control section <NUM> (base station means). The AP is a base station (base device, master station) which performs various controls of wireless network. The AP is a device which establishes a network by itself when performing communication and performs various controls in response to a connection request from a station (STA). The AP transmits a beacon periodically when performing communication, and when receiving a connection request signal transmitted from an STA, the AP transmits a connection request response signal to the STA to connect with the STA.

An STA control section <NUM> (station means) is a section for controlling an STA communication function. An operation as a station (STA) described below is performed by using the STA control section <NUM>. The STA is a slave station (slave device, mobile device) in a wireless network, and connects to the AP when performing communication. When performing communication, the STA transmits a connection request signal to an AP, receives a connection request response signal from the AP to connect with the AP, and performs communication under the control of the AP. As described in a second exemplary embodiment, wireless LAN ad-hoc communication in which two STAs communicate with each other directly can be performed by using the STA control section <NUM>.

A network detection section <NUM> is a section for detecting a network present in surrounding areas. A device can detect a network present in surrounding areas by receiving a beacon or a probe response from a device in surrounding areas via the packet receiving section <NUM>. It is also possible to detect an AP, which is constructing a network, by using the network detection section <NUM>. An AP detection operation described below is performed by using the network detection section <NUM>. A communication parameter providing section <NUM> is a section for providing a communication parameter to a device on the other side of communication. Communication parameter automatic setting described below is provided by the communication parameter providing section <NUM>. The communication parameter providing section <NUM> provides communication parameters necessary for performing wireless communication, such as an SSID as a network identifier, an encryption method, an encryption key, an authentication method, and an authentication key. A communication parameter receiving section <NUM> is a section for receiving a communication parameter from the device on the other side of communication. Communication parameter automatic setting described below is received by the communication parameter receiving section <NUM>.

A role determination section <NUM> is a section for determining a device which manages network when performing communication between devices. Role determination processing described below is performed by the role determination section <NUM>. By the role determination processing, either role of "management device" or "terminal device" is provided to each device. A device to which the role of management device is provided operates as an AP by using the AP control section <NUM>, and provides communication parameters to the terminal by the parameter providing section <NUM>. On the other hand, a device to which the role of the terminal device is provided operates as an STA by using the STA control section <NUM>, and receives communication parameters from the AP by the parameter receiving section <NUM>.

A switching section <NUM> is a section for switching between operating as an AP using the AP control section <NUM>, and operating as an STA using the STA control section <NUM>, and selects the switched operation. The switching section <NUM> performs a first switching according to a role determined by the role determination section <NUM>, a second switching according to a detection result detected by the network detection section <NUM>, and the like.

A selection section <NUM> is a section for selecting between operating as a providing device which provides a communication parameter using the communication parameter providing section <NUM>, and operates as a receiving device using the communication parameter receiving section <NUM>. The selection section <NUM> performs a selection according to the role determined by the role determination section <NUM>.

<FIG> are diagrams illustrating network constructions of a communication device-A <NUM> (hereinafter, device A) and a communication device-B <NUM> (hereinafter, device B). These devices have configurations illustrated in <FIG>.

When the device A and the device B operate as an AP, the device A and the device B respectively establish a network-A <NUM> (hereinafter, network A) and a network-B <NUM> (hereinafter, network B) (<FIG>). After the device A and the device B detect each other, one of the devices participates in a network established by the other device, and the devices exchange messages for determining the management device. At this time, all communication parameters are not set, but some communication parameters by which the messages for determining the role can be exchanged are set. More specifically, a network identifier is stored in a signal (beacon, probe request, and probe response) used for device detection processing.

A device which tries to participate in the network sets a network identifier of the network in which the device tries to participate, and thereafter performs participation processing. The encryption method and the encryption key have not been set yet. The device which becomes the management device as a result of the exchange of the messages establishes a network <NUM> as an AP, and provides communication parameters to the STA by automatic setting of communication parameters (<FIG>).

The STA which has received the communication parameters participates in the network by using the received communication parameters. The communication parameter providing processing (receiving processing) is performed by, for example, a communication parameter automatic setting procedure such as Wi-Fi Protected Setup between devices. The communication parameter automatic setting procedure is a communication procedure by which the providing device provides communication parameters to the receiving device and the receiving device receives the communication parameters from the providing device. This procedure is performed by exchanging predetermined messages between the devices.

<FIG> is a flowchart illustrating an example of an operation flow of communication processing performed between the device A and the device B when the setting button <NUM> is pressed. This operation is performed when the control section <NUM> reads the control program stored in the storage section <NUM> and controls the wireless section <NUM> or the like. Hereinafter, a control performed by both devices will be described along the flowchart.

In the device in which the setting button <NUM> is pressed, the control section <NUM> starts the role determination section <NUM>. In step S501, the role determination section <NUM> performs processing to search an access point (AP) present in surrounding areas by using the network detection section <NUM>. In step S502, the role determination section <NUM> checks information included in a received beacon or probe response, and checks whether there is an AP which is performing the roll determination processing.

In step S510, when there is at least one AP which is performing the roll determination processing, the role determination section <NUM> checks whether there is one AP or more than one APs which are performing the roll determination processing. In step S512, when more than one APs which are performing the roll determination processing are detected, an error notification informing a user of an error is displayed on the display section <NUM>, and the role determination section <NUM> ends the processing due to an error.

In step S511, when there is one AP which is performing the roll determination processing, the role determination section <NUM> connects to the network constructed by the detected AP using the STA control section <NUM>.

In step S503, when there is no AP which is performing the roll determination processing, the role determination section <NUM> starts an access point operation using the AP control section <NUM>. When the AP control section <NUM> starts the access point operation, the AP control section <NUM> adds self-information indicating that the AP control section itself is performing the role determination processing, to a beacon and a probe response, and transmits the beacon and the probe response.

In step S504, the role determination section <NUM> exchanges arbitration messages with the device on the other side, and determines which device becomes the management device. As an example of the determination processing in step S504, it is possible to use a method of including information indicating a priority of the management device in the arbitration message and transmitting the arbitration message. In this case, by comparing the priority included in the arbitration message received from the device on the other side and the priority of the device itself, a device having a higher priority is determined to be the management device. The priority of the management device is determined based on information such as a device type of the device, a remaining battery level, manufacturer information, universally unique identifier (UUID), and media access control (MAC) address.

When the device itself is operating as an access point, a priority higher than a case where it is operating as a station, may be set. Also, the priority information may be set based on connectivity to other networks, such as whether the device itself can be connected to the Internet. Further, when the priority of the device on the other side and the priority of the device itself are the same, by comparing information unique to a device such as UUID and MAC address, a device which satisfies a predetermined condition may be determined to be the management device.

In step S505, after determining the role, the control section <NUM> checks whether the determined role of the device itself is the management device. In step S506, when the device itself is determined to be the management device, the control section <NUM> checks whether the device itself is operating as an AP. If operating as an AP, the processing proceeds to step S509. If not operating as an AP, the control section <NUM> separates from the network connected by the STA control section <NUM> in step S507. In step S508, after separating from the network, the control section <NUM> starts an access point operation by using the AP control section <NUM>. In step S509, thereafter, the control section <NUM> starts processing to provide communication parameters to the receiving device using the communication parameter providing section <NUM>. The communication parameter providing processing is performed by performing the communication parameter automatic setting procedure between the providing device and the receiving device.

If the device itself is determined to be the terminal device as a result of the role determination, the control section <NUM> checks whether the device itself is operating as an AP in step S513. If not operating as an AP, the processing proceeds to step S515. If operating as an AP, the control section <NUM> stops the access point operation in step S514. In step S515, after stopping the access point operation, the control section <NUM> operates as a receiving device using the communication parameter receiving section <NUM>, and starts processing to receive the communication parameters from the providing device.

In step S516, after starting the processing, the control section <NUM> performs a search of an AP using the network detection section <NUM>. As a result of the search, if more than one APs which are performing the communication parameter providing processing are detected in step S517, the processing proceeds to step S512, displays an error notification informing a user of an error on the display section <NUM>, and ends the process due to an error. If there is one AP which is performing the communication parameter providing processing in step S517, the control section <NUM> connects to the AP in step S518, and, as a receiving device which receives the communication parameters from a providing device, the control section <NUM> performs a predetermined communication parameter automatic setting procedure with the AP.

<FIG> and <FIG> are an example of a processing sequence in which the setting button <NUM> is pressed in the device A and the device B, and the communication parameter automatic setting processing is performed between the device A and the device B.

<FIG> is an example illustrating a processing sequence in which the setting button <NUM> is pressed in the device A and the device B, the roles are determined between the device A and the device B, and the device B becomes the management device to perform the communication parameter automatic setting processing.

When the setting button <NUM> of the device B is pressed, the device B performs the processing of <FIG>. The device B transmits a device search signal (probe request), and checks whether there is an AP which is performing the roll determination processing in areas around the device B (F601). In this case, since there is no AP which is performing the roll determination processing in areas around the device B, the device B starts the access point operation to construct a network B (F602).

Thereafter, when the setting button <NUM> of the device A is pressed, the device A performs the processing of <FIG>. The device A transmits a device search signal, and checks whether there is an AP which is performing the roll determination processing in areas around the device A (F603). The device search signal, which is an AP performing the roll determination processing, transmits a device search response signal (probe response) responding to the device search signal transmitted from the device A (F604). The device A receives the device search response signal from the device B, and recognizes that the device B is an AP which is performing the roll determination processing by checking the additional information in the signal. After recognizing that, the device A transmits a connection request signal to the device B, which is an AP performing the roll determination processing (F605).

The device B returns a connection request response signal indicating connection permission to the device A (F606). When the device A receives the connection request response signal from the device B, the device A connects to the device B and exchanges role arbitration messages to determine the management device (F607, F608). Each device refers to the other device's priority information included in the role arbitration message, and determines the management device by comparing the priority information with priority information of its own. In this case, it is assumed that the device B becomes the management device.

After determining the role, the device B starts the communication parameter providing processing (F609). On the other hand, the device A starts the communication parameter receiving processing (F610). Since the device A has already connected to the device B, the device A transmits a message indicating a start of the communication parameter setting to the device B (F613). Then, the communication parameter setting processing is performed by exchanging protocol messages for the automatic setting procedure between the device A which is a receiving device and the device B which is a providing device (F614). As a result, communication parameters are transmitted from the device B to the device A, and the device B transmits a message indicating the completion of the communication parameter setting to the device A (F615).

In this way, the communication parameter setting processing is completed. The device A sets the communication parameters (a network identifier (SSID), an encryption method, an encryption key, an authentication method, and an authentication key) received from the device B, and performs the communication connection processing again on the device B (F616). The communication protocol processing of the communication parameter setting processing can be realized by using communication protocol processing specified by industry standard communication parameter setting processing as discussed in Non Patent Literature <NUM>.

Next, a case in which a device operating as an STA during the role determination processing becomes the management device and provides communication parameters will be described.

<FIG> is an example of a processing sequence in which the setting button <NUM> is pressed in the device A and the device B, the roles are determined between the device A and the device B, and the device A becomes the management device to perform the communication parameter automatic setting processing.

When the setting button <NUM> of the device B is pressed, the device B performs the processing of <FIG>. The device B transmits the device search signal, and checks whether there is an AP which is performing the roll determination processing in areas around the device B (F701). In this case, since there is no AP which is performing the roll determination processing in areas around the device B, the device B starts the access point operation to construct a network B (F702).

Thereafter, when the setting button <NUM> of the device A is pressed, the device A performs the processing of <FIG>. The device A transmits a device search signal (probe request), and checks whether there is an AP which is performing the roll determination processing in areas around the device A (F703). The device B, which is an AP performing the roll determination processing, transmits a device search response signal (probe response) responding to the device search signal transmitted from the device A (F704).

The device A receives the device search response signal from the device B, and recognizes that the device B is an AP which is performing the roll determination processing by checking the additional information in the signal. After recognizing that, the device A connects to the device B (F705, F706), and exchanges role arbitration messages to determine the management device (F707, F708). Each device compares the other device's priority information included in the role arbitration message with the priority information of its own, and determines the management device. In this case, it is assumed that the device A becomes the management device.

After determining the role, the device A starts the access point operation and constructs a network A (F709). After starting the access point operation, the device A starts the communication parameter providing processing (F710). On the other hand, the device B stops the access point operation (F711), and starts the communication parameter receiving processing (F712). The device B transmits a connection request signal to the device A which is the management device and the AP (F713). The device A returns a connection request response signal indicating connection permission to the device B (F714).

When the device B receives the connection request response signal from the device A, the device B connects to the device A and transmits a message indicating a start of the communication parameter setting (F715), and the communication parameter setting processing is performed between the device B which is the receiving device and the device A which is the providing device (F716). As a result, communication parameters are transmitted from the device A to the device B, and the device A transmits a message indicating the completion of the communication parameter setting to the device B (F717). In this way, the communication parameter setting processing is completed. The device B sets the communication parameters (i.e., a network identifier (SSID), an encryption method, an encryption key, an authentication method, and an authentication key) received from the device A, and performs the communication connection processing again to the device A (F718).

As described above, even a device having both functions of a base station and a slave station can determine a device that operates as a base station and a device that operates as a slave station. The device can also determine a device that operates as a communication parameter providing device and a device that operates as a communication parameter receiving device. Therefore, even when using a device having both functions of a base station and a slave station, if a user performs an operation such as pressing the setting button <NUM>, the communication parameter setting processing can be performed between devices. Further, by performing the communication parameter setting processing, setting shared communication parameters, and performing authentication processing between devices, it is possible to perform encrypted wireless communication.

The part of the description referring to <FIG> and <FIG> does not describe part of the claimed invention. A case in which the role determination processing is performed by wireless LAN ad-hoc communication will be described. The ad-hoc communication is wireless communication performed directly between stations without using an access point. The device configuration is the same as that in <FIG>.

In the device in which the setting button <NUM> is pressed, the control section <NUM> starts the role determination section <NUM>. In step S801, the device constructs an ad-hoc network by using the STA control section <NUM>. When the STA control section <NUM> constructs the ad-hoc network, the STA control section <NUM> adds self-information indicating that the STA control section itself is performing the role determination processing, to a beacon and a probe response.

After constructing the ad-hoc network, in step S802, the role determination section <NUM> performs processing to search an ad-hoc network present in surrounding areas by using the network detection section <NUM>. In step S803, the role determination section <NUM> checks information included in a received beacon or a probe response, and checks whether there is an ad-hoc network which is performing the roll determination processing. In step S804, when there is at least one ad-hoc network which is performing the roll determination processing, the role determination section <NUM> checks whether there is one ad-hoc network or more than one ad-hoc networks which are performing the roll determination processing.

In step S813, when there are more than one ad-hoc networks which are performing the roll determination processing, an error notification informing a user of an error is displayed on the display section <NUM>, and the processing ends due to an error. In step S805, when there is one ad-hoc network which is performing the roll determination processing, the role determination section <NUM> participates in the ad-hoc network by using the STA control section <NUM>. When it participates in the network, the role determination section <NUM> stops the ad-hoc network constructed in step S801. After participating in the ad-hoc network, the role determination section <NUM> exchanges arbitration messages with the device on the other side in step S806, and determines which device becomes the management device in step S807.

In step S811, when there is no ad-hoc network which is performing the roll determination processing, the role determination section <NUM> waits for an role arbitration message transmitted from another device on the ad-hoc network constructed by the role determination section <NUM> itself. In step S802, when the role determination section <NUM> does not receive an role arbitration message in step S811, the role determination section <NUM> searches an ad-hoc network present in surrounding areas by using the network detection section <NUM> again.

When receiving a role arbitration message in step S811, the role determination section <NUM> transmits a role arbitration message to the transmission source device of the received role arbitration message in step S812, and determines which device becomes the management device in step S807. As an example of the determination processing, it is possible to use a method of including priority information of the management device in the arbitration message and transmitting the arbitration message. In this case, by comparing the priority included in the arbitration message received from the device on the other side and the priority of the device itself, a device having a higher priority is determined to be the management device.

The priority of the management device is determined based on information such as a device type including a printer, a camera, and the like, service information included in the device itself, manufacturer information, UUID, and MAC address. The priority information may also be set based on a remaining battery level. Also, the priority information may be set based on connectivity to other networks, such as whether the device itself can be connected to the Internet. When the priority of the device on the other side and the priority of the device itself are the same, the management device may be determined based on device unique information such as UUID and MAC address.

After determining the role, in step <NUM>, the control section <NUM> checks whether the determined role of itself is the management device. In step S809, when the control section <NUM> determines itself to be the management device, the control section <NUM> starts an access point operation by using the AP control section <NUM>. Thereafter, in step S810, the control section <NUM> starts processing to provide communication parameters to the receiving device by using the communication parameter providing section <NUM>. When the receiving device is connected, as a providing device, the control section <NUM> performs a predetermined communication parameter automatic setting procedure with the receiving device, and performs the communication parameter providing processing.

After the check in step S808, when the control section <NUM> determines itself to be the terminal device, the control section <NUM> starts processing to receive the communication parameters from the providing device using the communication parameter receiving section <NUM> in step S814. Then, in step S815, the control section <NUM> searches an access point by using the network detection section <NUM>. As a result of the search, in step <NUM>, when more than one APs which are performing the communication parameter providing processing are detected, the processing proceeds to step S813, displays an error notification informing a user of an error on the display section <NUM>, and ends the process due to an error.

When there is one AP which is performing the communication parameter providing processing in step S816, the control section <NUM> connects to the AP in step S817, and, as a receiving device which receives the communication parameters from a providing device, the control section <NUM> performs a predetermined communication parameter automatic setting procedure together with the AP which is the providing device.

<FIG> is an example illustrating a processing sequence in which the setting button <NUM> is pressed in the device A and the device B, the roles are determined between the device A and the device B, and thereafter the device A becomes the management device to perform the communication parameter automatic setting processing.

When the setting button <NUM> of the device B is pressed, the device B performs the processing of <FIG>. The device B constructs an ad-hoc network B (F901), transmits a device search signal (probe request) (F902), searches a device which is performing the roll determination processing in surrounding areas, and searches an ad-hoc network in surrounding areas.

When the setting button <NUM> of the device A is pressed, the device A performs the processing of <FIG>. The device A constructs an ad-hoc network A (F903), transmits a device search signal (F904), searches a device which is performing the roll determination processing in surrounding areas, and searches an ad-hoc network in surrounding areas. The device B transmits a device search response signal (probe response) responding to the device search signal transmitted from the device A (F905). The device A receives the device search response signal from the device B, and recognizes that the device B is performing the roll determination processing by checking the additional information in the signal.

After recognizing that, the device A stops the network A and participates in the network B (F906), and then transmits a role arbitration message to determine the management device, to the device B (F907). The device B, which receives the role arbitration message from the device A, transmits a role arbitration message to the device A (F908). Each device refers to the other device's priority information included in the role arbitration message, and determines the management device. In this case, it is assumed that the device A becomes the management device.

After determining the role, the device A starts the access point operation and constructs a network C (F909). After constructing the network, the device A starts the communication parameter providing processing (F910). On the other hand, the device B stops the network B (F911), and starts the communication parameter receiving processing (F912). The device B searches a network in surrounding areas, searches an AP which is performing the communication parameter providing processing, and detects the device A. The device B transmits a connection request signal to the device A to request a connection (F913).

When the device A receives the connection request signal from the device B, the device A returns a connection request response signal indicating connection permission to the device B (F914). When receiving the response signal, the device B connects to the device A, transmits a message indicating a start of the communication parameter setting to the device A (F915), and requests to start the communication parameter automatic setting processing. Then, the communication parameter setting processing is performed between the device B which is the receiving device and the device A which is the providing device (F916). As a result, communication parameters are transmitted from the device A to the device B, and the device A transmits a message indicating the completion of the communication parameter setting to the device B (F917). In this way, the communication parameter setting processing is completed.

The device B sets the communication parameters (i.e., a network identifier (SSID), an encryption method, an encryption key, an authentication method, and an authentication key) received from the device A, and performs the communication connection processing again on the device A (F918).

Claim 1:
A communication device (<NUM>, <NUM>) comprising:
a base station unit (<NUM>) configured to operate as a base station that establishes a wireless local area network, LAN, compliant with IEEE802.<NUM>;
a station unit (<NUM>) configured to operate as a station that connects to a base station that establishes a wireless LAN compliant with IEEE802.<NUM>;
a providing unit (<NUM>) configured to operate as a providing device that provides a communication parameter;
a receiving unit (<NUM>) configured to operate as a receiving device that receives a communication parameter from a providing device; and
a determination unit (<NUM>) configured to determine whether a role of the communication device (<NUM>, <NUM>) is a first role or a second role based on a comparison of a first priority of the communication device (<NUM>, <NUM>) with a second priority received from another communication device;
wherein, the first priority set by the communication device depends on information associated with the communication device,
wherein, in a case where the determination unit (<NUM>) determines that the role of the communication device (<NUM>, <NUM>) is the first role, the communication device (<NUM>, <NUM>) operates the base station unit (<NUM>) and the providing unit (<NUM>), causes the providing unit (<NUM>) to provide a communication parameter for communicating in the wireless LAN compliant with IEEE802.<NUM> to be established by the base station unit (<NUM>) to the other communication device, and communicates with the other communication device by setting the communication parameter provided by the providing unit (<NUM>), and
wherein, in a case where the determination unit (<NUM>) determines that the role of the communication device (<NUM>, <NUM>) is the second role, the communication device (<NUM>, <NUM>) operates the station unit (<NUM>) and the receiving unit (<NUM>), causes the receiving unit (<NUM>) to receive a communication parameter for communicating in the wireless LAN compliant with IEEE802.<NUM> to be established by the other communication device from the other communication device, and communicates with the other communication device by setting the communication parameter received by the receiving unit (<NUM>).