Optical communication method, electronic device, and system
By processing optical signals through reverse differential encoding and exclusive-OR encoding, and reducing them with light intensity sensors, the problem of poor optical communication effect under light occlusion is solved, and efficient and accurate data transmission is achieved.
Patent Information
- Application Number
- PCT/CN2024/116107
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-02-22
- Filing Date
- 2024-08-30
- Publication Date
- 2025-08-28
AI Technical Summary
In visible light communication, when the optical signals between electronic devices are blocked, the receiver cannot fully collect the optical signals from the transmitting end, resulting in poor data transmission.
The data is processed by a combination of reverse differential encoding and exclusive OR encoding, and the light intensity sensor is used to restore the data to ensure that the data can still be accurately identified under light occlusion.
It improves the efficiency and accuracy of optical communication, avoids the problems of high energy consumption and user intervention, and realizes stable data transmission in light occlusion environment.
Smart Images

Figure CN2024116107_28082025_PF_FP_ABST
Abstract
Description
Optical communication method, electronic equipment and system
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on February 22, 2024, with application number 202410208394.3 and application name “An optical communication method, electronic device and system”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The embodiments of the present application relate to the field of communication technology, and in particular to an optical communication method, electronic equipment, and system. Background Art
[0003] Visible light communication technology refers to a communication method that uses visible light as an information carrier to directly transmit optical signals in the air.
[0004] Visible light communication technology can rapidly establish a secure information space that is resistant to interference and interception. Modulating visible light emission enables data transmission and precise indoor positioning, and VLC technology can be deeply integrated with existing lighting infrastructure. Based on these advantages, VLC is expected to interact and integrate with other communication technologies, including wireless networks and cellular networks, achieving increasingly widespread application in areas such as the Internet of Things, smart cities (homes), aviation, maritime transport, subways, high-speed rail, indoor navigation, and underground operations.
[0005] However, there are also some problems in the practical application of visible light communication technology. For example, when electronic devices communicate with each other through visible light, if the visible light is blocked, the electronic device at the receiving end cannot collect the complete visible light emitted by the electronic device at the sending end, and thus cannot fully obtain the data that the electronic device at the sending end intends to transmit, resulting in poor optical communication effect.
[0006] Summary of the Invention
[0007] In order to solve the above-mentioned technical problems, the embodiments of the present application provide an optical communication method, electronic device and system. The technical solution provided by the embodiments of the present application is that the first electronic device processes the first data to be transmitted according to a first preset method, and then transmits the processed data to the second electronic device through an optical signal. The second electronic device uses a light intensity sensor to collect the optical signal, and restores the received optical signal according to a second preset method, so that the second electronic device can identify the first data that the first electronic device intends to transmit. This solves the technical problem that the current optical communication technology has poor communication effect in the case of light obstruction.
[0008] In order to achieve the above technical objectives, this application provides the following technical solutions:
[0009] In a first aspect, an optical communication method is provided, including: applying to a first electronic device, the first electronic device including a light-emitting device with adjustable brightness; the method comprising: obtaining first data in response to a first instruction; processing the first data according to a first preset method to obtain second data, the second data being a first light intensity sequence arranged in a first order; and controlling the light-emitting device to transmit an optical signal according to the first light intensity sequence, the optical signal being used to instruct a second electronic device to obtain the first data after processing the optical signal according to a second preset method.
[0010] According to a first aspect, a first preset method includes an encoding process and a mapping process, the encoding process including reverse differential encoding, and processing first data according to the first preset method to obtain second data, including: performing the encoding process on the first data to obtain fourth data; and performing the mapping process on the fourth data to map the fourth data to the second data.
[0011] According to the first aspect, or any implementation of the first aspect above, the encoding process further includes XOR encoding.
[0012] According to the first aspect, or any implementation of the first aspect above, performing an encoding process on the first data to obtain fourth data includes: segmenting the first data according to a preset length to obtain segmented first data; and encoding the segmented first data to obtain fourth data.
[0013] In some examples, the first electronic device may first segment the first data according to a preset length to obtain segmented first data, where the segmented first data is data with a more regular arrangement.
[0014] In this way, the first electronic device can segment the first data to facilitate encoding of the first data, thereby increasing encoding accuracy.
[0015] According to the first aspect, or any implementation of the first aspect above, the second data includes a preset identifier, and the preset identifier is used to indicate the start of optical communication.
[0016] In some examples, after mapping the fourth data into a second light intensity sequence for controlling the light-emitting device, the first electronic device adds a preset identifier to the second light intensity sequence to obtain the second data. Optionally, the preset identifier can be a preamble code agreed upon in advance by the first and second electronic devices to initiate optical communication.
[0017] In this way, the first electronic device adds a preset identifier to the second light intensity sequence, which can facilitate the second electronic device to start optical communication with the first electronic device and identify the first data sent by the first electronic device.
[0018] In a second aspect, an optical communication method is provided, applied to a second electronic device, the second electronic device including a light intensity sensor. The method comprises: collecting, using the light intensity sensor, a light signal transmitted by a first electronic device to obtain third data, where the third data is part or all of second data corresponding to the light signal transmitted by the first electronic device, where the second data is a first light intensity sequence arranged in a first order. The third data is restored according to a second preset method to obtain the first data, where the second data is data obtained after processing the first data according to the first preset method, where the second preset method corresponds to the first preset method.
[0019] According to the second aspect, the second preset method includes a decoding process, which includes reverse differential coding analysis. According to the second preset method, restoring the third data to obtain the first data includes: performing a decoding process on the third data to obtain fifth data, where the fifth data is a sequence of light intensity change rates arranged in the second order; and concatenating the fifth data to obtain the first data.
[0020] In some examples, the fifth data obtained by the second electronic device after decoding corresponds to the first data segmented by the first electronic device. In this case, the second electronic device needs to splice the fifth data to obtain the first data.
[0021] According to the second aspect, or any implementation of the second aspect above, the decoding process further includes XOR encoding analysis.
[0022] According to the second aspect, or any implementation method of the above second aspect, the light signal sent by the first electronic device is collected by the light intensity sensor to obtain the third data, including: collecting the light signal by the light intensity sensor, identifying the preset identifier, determining to start the optical communication between the first electronic device and the first electronic device that sends the light signal, and obtaining the third data.
[0023] According to the second aspect, or any implementation of the second aspect above, the third data is restored according to the second preset method to obtain the first data, including: stripping the preset identifier in the third data.
[0024] In a third aspect, an optical communication system is provided, comprising a first electronic device and a second electronic device, wherein the first electronic device comprises a light-emitting device with adjustable brightness, and the second electronic device comprises a light intensity sensor. The first electronic device is configured to: obtain first data in response to a first instruction. The first data is processed according to a first preset method to obtain second data, where the second data is a first light intensity sequence arranged in a first order. The light-emitting device is controlled to transmit a light signal according to the first light intensity sequence. The second electronic device is configured to: collect light signals via the light intensity sensor to obtain third data corresponding to the first electronic device, where the third data is part or all of the second data. The third data is restored according to a second preset method to obtain the first data.
[0025] In some examples, the second preset mode corresponds to the first preset mode. The first instruction is used to instruct the first electronic device to send the first data to the second electronic device via optical communication. The first data can be request information, instruction information, or status information.
[0026] In this manner, the first electronic device processes the first data to be transmitted according to the first preset method, and then transmits the processed data to the second electronic device via an optical signal. The second electronic device collects the optical signal using a light intensity sensor and restores the received optical signal according to the second preset method, allowing the second electronic device to identify the first data intended to be transmitted by the first electronic device.
[0027] In addition, the second electronic device can collect the third data through the light intensity sensor to solve the technical problems of poor user experience such as high energy consumption, excessive collection of user information and requirement of user intervention in the existing collection of light signals through cameras.
[0028] According to a third aspect, the first preset method includes an encoding process and a mapping process, wherein the encoding process includes reverse differential encoding. The first electronic device is configured to: perform the encoding process on the first data to obtain fourth data; and perform the mapping process on the fourth data to map the fourth data into the second data.
[0029] In this way, after the first electronic device performs reverse differential encoding processing on the first data, even if the second electronic device cannot receive the complete light signal, it can restore the first data by differentially encoding the received light signal (third data) into the light intensity change rate.
[0030] According to the third aspect, or any implementation of the third aspect above, the encoding process further includes XOR encoding.
[0031] In some examples, the first electronic device first performs XOR encoding on the first data and then performs reverse differential encoding on the XOR-encoded data. It should be understood that the first electronic device may also first perform reverse differential encoding on the first data and then perform XOR encoding on the reverse differential-encoded data.
[0032] In this way, the first electronic device performs XOR encoding on the first data, and then the second electronic device can obtain the complete first data through XOR encoding analysis after receiving the optical signal even if the received optical signal is incomplete.
[0033] According to the third aspect, or any implementation of the third aspect above, the second preset method includes a decoding process, wherein the decoding process includes reverse differential coding analysis. The second electronic device is configured to: perform the decoding process on the third data to obtain fifth data, where the fifth data is a sequence of light intensity change rates arranged in the second order; and concatenate the fifth data to obtain the first data.
[0034] In some examples, the first electronic device encodes the first data using reverse differential encoding. Accordingly, when decoding the acquired third data, the second electronic device decodes the third data using reverse differential encoding parsing. For example, the second electronic device performs reverse differential encoding parsing on the third data to obtain fifth data. The fifth data is then concatenated to obtain the first data.
[0035] In some scenarios, light obstruction may cause the third data received by the second electronic device to be part of the second data. In other scenarios, if the second electronic device is located in an environment with a high light intensity from other light sources (such as natural light sources), after the first electronic device emits a light signal with varying brightness, the light intensity in the light signal received by the second electronic device will not change significantly, resulting in the second electronic device being unable to accurately restore the first data.
[0036] In this way, when the first electronic device performs reverse differential encoding on the first data, even if the received optical signal is incomplete, the second electronic device can still obtain the light intensity change rate sequence corresponding to the first data that the first electronic device intends to send based on the received optical signal, and then restore the complete first data based on the light intensity change rate sequence, thereby overcoming the technical problem that the second electronic device cannot completely restore the first data due to the above-mentioned light obstruction or other light source influences.
[0037] According to the third aspect, or any implementation of the third aspect above, the decoding process further includes XOR encoding analysis.
[0038] In some examples, the first electronic device encodes the first data using XOR encoding and reverse differential encoding. Accordingly, when decoding the acquired third data, the second electronic device decodes the third data using XOR encoding parsing and reverse differential encoding parsing. The second electronic device performs reverse differential encoding parsing on the third data to obtain initial fifth data. The initial fifth data is then subjected to XOR encoding parsing to obtain the fifth data.
[0039] In this way, even if the second electronic device cannot receive the entire optical signal sent by the first electronic device, it can still derive the fifth data (the complete segmented first data) based on the initial fifth data converted from the received optical signal. This eliminates the need for multiple transmissions and recognitions of the first data between the first and second electronic devices, overcoming the problem of the second electronic device being unable to recognize the first data due to poor optical communication, thereby improving the efficiency and accuracy of optical communication.
[0040] In a fourth aspect, a first electronic device is provided. The first electronic device includes: a processor, a memory, and a light-emitting device with adjustable brightness. The memory and the light-emitting device with adjustable brightness are coupled to the processor. The memory is used to store computer program code. The computer program code includes computer instructions. When the processor reads the computer instructions from the memory, the first electronic device executes: in response to the first instruction, obtain first data. The first data is processed according to a first preset method to obtain second data. The second data is a first light intensity sequence arranged in a first order. According to the first light intensity sequence, the light-emitting device is controlled to send a light signal. The light signal is used to instruct the second electronic device to obtain the first data after processing the light signal according to the second preset method.
[0041] According to a fourth aspect, the first preset method includes an encoding process and a mapping process, the encoding process includes reverse differential encoding, and processing the first data according to the first preset method to obtain the second data includes: performing the encoding process on the first data to obtain fourth data; and performing the mapping process on the fourth data to map the fourth data to the second data.
[0042] According to the fourth aspect, or any implementation of the fourth aspect above, the encoding process also includes XOR encoding.
[0043] According to the fourth aspect, or any implementation of the fourth aspect, performing an encoding process on the first data to obtain the fourth data includes: segmenting the first data according to a preset length to obtain segmented first data; and encoding the segmented first data to obtain the fourth data.
[0044] According to the fourth aspect, or any implementation of the fourth aspect above, the second data includes a preset identifier, and the preset identifier is used to indicate the start of optical communication.
[0045] In a fifth aspect, a second electronic device is provided. The second electronic device includes: a processor, a memory, and a light intensity sensor. The memory and the light intensity sensor are coupled to the processor. The memory is used to store computer program code. The computer program code includes computer instructions. When the processor reads the computer instructions from the memory, the second electronic device executes: collecting a light signal sent by the second electronic device through the light intensity sensor to obtain third data. The third data is part or all of the second data corresponding to the light signal sent by the second electronic device. The second data is a first light intensity sequence arranged in a first order. The third data is restored according to a second preset method to obtain the first data. The second data is data obtained after processing the first data according to the first preset method. The second preset method corresponds to the first preset method.
[0046] According to a fifth aspect, the second preset method includes a decoding process, which includes reverse differential coding analysis. According to the second preset method, restoring the third data to obtain the first data includes: performing a decoding process on the third data to obtain fifth data, where the fifth data is a sequence of light intensity change rates arranged in the second order; and concatenating the fifth data to obtain the first data.
[0047] According to the fifth aspect, or any implementation of the fifth aspect above, the decoding process also includes XOR encoding analysis.
[0048] According to the fifth aspect, or any implementation method of the above fifth aspect, the light signal sent by the second electronic device is collected by the light intensity sensor to obtain the third data, including: collecting the light signal by the light intensity sensor, identifying the preset identifier, determining to start the optical communication between the light signal and the second electronic device that sends the light signal, and obtaining the third data.
[0049] According to the fifth aspect, or any implementation of the fifth aspect, the third data is restored according to the second preset method to obtain the first data, including: stripping the preset identifier in the third data.
[0050] In a sixth aspect, a chip system is provided, comprising at least one processor and at least one interface circuit, wherein the at least one interface circuit is configured to perform transceiver functions and send instructions to the at least one processor, and when the at least one processor executes the instructions, the at least one processor executes the method of the second aspect or any one of the embodiments of the second aspect. Alternatively, the at least one processor executes the method of the third aspect or any one of the embodiments of the third aspect.
[0051] In a seventh aspect, a computer-readable storage medium is provided. The computer-readable storage medium stores a computer program (also referred to as instructions or code). When the computer program is executed by an electronic device, the electronic device executes the method of the second aspect or any one of the embodiments of the second aspect. Alternatively, the electronic device executes the method of the third aspect or any one of the embodiments of the third aspect.
[0052] In an eighth aspect, a computer program product is provided. When the computer program product is executed on an electronic device, the electronic device executes the method of the second aspect or any one of the embodiments of the second aspect. Alternatively, the electronic device executes the method of the third aspect or any one of the embodiments of the third aspect.
[0053] In a ninth aspect, a circuit system is provided, the circuit system including a processing circuit, the processing circuit being configured to execute the method of the second aspect or any one of the embodiments of the second aspect. Alternatively, the processing circuit being configured to execute the method of the third aspect or any one of the embodiments of the third aspect.
[0054] The technical effects of the aforementioned aspects can be referenced with each other and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] FIG1 is a flow chart of an optical communication method according to an embodiment of the present application;
[0056] FIG2 is a schematic diagram of a communication system to which the optical communication method provided in an embodiment of the present application is applied;
[0057] FIG3 is a schematic diagram of the hardware structure of a second electronic device provided in an embodiment of the present application;
[0058] FIG4 is a second flow chart of the optical communication method provided in an embodiment of the present application;
[0059] FIG5 is a third flow chart of the optical communication method provided in an embodiment of the present application;
[0060] FIG6 is a fourth flow chart of the optical communication method provided in an embodiment of the present application;
[0061] FIG7 is a fifth flow chart of the optical communication method provided in an embodiment of the present application;
[0062] FIG8 is a sixth flow chart of the optical communication method provided in an embodiment of the present application;
[0063] FIG9 is a schematic structural diagram of a first electronic device provided in an embodiment of the present application;
[0064] FIG10 is a schematic structural diagram of a second electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0065] The technical solutions in the embodiments of the present application are described below in conjunction with the drawings in the embodiments of the present application. Among them, in the description of the embodiments of the present application, the terms used in the following embodiments are only for the purpose of describing specific embodiments, and are not intended to be used as limitations on the present application. As used in the specification and claims of the present application, the singular expressions "one", "a kind of", "above", "the" and "this" are intended to include expressions such as "one or more", unless there is a clear indication to the contrary in the context. It should also be understood that in the following embodiments of the present application, "at least one", "one or more" refer to one or more (including two).
[0066] References to "one embodiment" or "some embodiments" etc. described in this specification mean that the specific features, structures or characteristics described in conjunction with the embodiment are included in one or more embodiments of the present application. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. appearing in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in another way. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in another way. The term "connected" includes direct and indirect connections, unless otherwise stated. "First" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated.
[0067] In the embodiments of this application, words such as "exemplarily" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "exemplarily" or "for example" in the embodiments of this application should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplarily" or "for example" is intended to present the relevant concepts in a concrete manner.
[0068] In some scenarios, as shown in Figure 1, when the electronic device at the sending end (hereinafter referred to as the first electronic device) and the electronic device at the receiving end (hereinafter referred to as the second electronic device) transmit data through optical communication, the first electronic device emits a light signal with varying brightness through a light-emitting device (such as a light-emitting diode or a display screen with adjustable brightness, etc.), and the second electronic device needs to turn on the camera to collect the light signal with varying brightness, and then parse the data sent by the first electronic device. In this process, if the light signal transmitted between the first electronic device and the second electronic device is blocked, the second electronic device cannot recognize the data sent by the first electronic device because it cannot collect the complete light signal. In addition, the energy consumption generated by turning on the camera of the second electronic device to shoot is large, and since turning on the camera to shoot may collect more spatial data, the user may need to intervene in the shooting process (such as the user starting the camera, etc.). In one possible implementation method, the first electronic device and the second electronic device can only restore the complete data intended to be transmitted by the first electronic device through multiple sending, receiving and restoration processes, but this method has a high transmission cost, low transmission efficiency, and cannot guarantee accuracy.
[0069] For example, the first electronic device is an air conditioner with an adjustable-brightness light-emitting device (e.g., an adjustable-brightness light-emitting diode). The second electronic device is, for example, a mobile phone with a camera. During the cooling process, the air conditioner detects that the ambient temperature is very low, determines that the preset temperature condition is met, and determines that it needs to trigger optical signal transmission to adjust the air conditioner temperature. The air conditioner then uses optical communication, using an adjustable-brightness light-emitting diode (LED) to emit a light signal that varies in brightness, sending the data "Can the air conditioner be turned off?" to the mobile phone (control center). When optical communication is unobstructed, the mobile phone can capture the varying light signal through its camera and recover the data sent by the air conditioner. However, when light is blocked, the mobile phone may not be able to capture the complete light signal sent by the air conditioner and, therefore, cannot parse the data sent by the air conditioner. In some examples, if the air conditioner transmits the data multiple times, the mobile phone may be able to recover the data by combining the multiple received light signals, but the transmission efficiency is low and the accuracy is poor.
[0070] Therefore, an embodiment of the present application provides an optical communication method, in which a first electronic device processes first data to be transmitted according to a first preset method, and then transmits the processed data to a second electronic device via an optical signal. The second electronic device uses a light intensity sensor to collect the optical signal and restores the received optical signal according to a second preset method, so that the second electronic device can identify the first data intended to be transmitted by the first electronic device. This solves the technical problem that current optical communication technology has poor communication performance in light-blocking conditions.
[0071] Figure 2 is a schematic diagram of a communication system to which the optical communication method provided in an embodiment of the present application is applied. As shown in Figure 2 , the communication system includes a first electronic device 100 and a second electronic device 200 .
[0072] Optionally, the first electronic device 100 or the second electronic device 200 can be an IoT device such as a mobile phone, a computer, a robot, a wearable device, an electrical appliance, or a smart city (home) device. The embodiments of the present application do not limit the specific types of the first electronic device 100 and the second electronic device 200. In some examples, the first electronic device 100 is a device for sending light signals; the second electronic device 200 is a device for collecting light signals. For example, the first electronic device 100 is configured with a light-emitting device with adjustable brightness, which is used to send light signals. The second electronic device 200 is configured with a light intensity sensor, which is used to receive light signals.
[0073] In some examples, the first electronic device 100 and the second electronic device 200 in the embodiments of the present application may be implemented by different devices, and the different devices may have the same, similar, or somewhat different hardware structures, such as the hardware structure shown in Figure 2.
[0074] For example, the hardware structure of the second electronic device 200 shown in FIG3 is taken as an example to illustrate the hardware structure shown in FIG3. FIG3 shows a schematic structural diagram of the second electronic device 200.
[0075] The second electronic device 200 may include a processor 110, an external memory interface 120, an internal memory 121, a power management module 141, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, a sensor module 180, a camera 193, a light-emitting device 194, a display 194A, and a subscriber identification module (SIM) card interface 195. When the second electronic device acts as a transmitter of optical communication, the second electronic device 200 may further include a sensor module 180, wherein the sensor module 180 may include an ambient light sensor 180L, etc.
[0076] It should be understood that the structures illustrated in the embodiments of the present application do not constitute a specific limitation on the second electronic device 200. In other embodiments of the present application, the second electronic device 200 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0077] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.
[0078] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.
[0079] The wireless communication function of the second electronic device 200 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0080] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in second electronic device 200 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In other embodiments, the antennas can be used in conjunction with a tuning switch.
[0081] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the second electronic device 200. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0082] The light emitting device 194 can emit light that changes in brightness by adjusting the brightness of the light, such as an LED lamp or a backlight display screen. In the embodiment of the present application, when the second electronic device 200 acts as a transmitter of optical communication, it can communicate with other electronic devices by emitting light that changes in brightness through the light emitting device 194.
[0083] The display screen 194A can be used to display images, videos, etc. The display screen 194A includes a display panel. The display panel can be manufactured using a liquid crystal display (LCD), for example, an organic light-emitting diode (OLED), an active matrix organic light-emitting diode or an active matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Mini-LED, Micro-LED, Micro-oled, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the second electronic device 200 may include 1 or N display screens 194A, where N is a positive integer greater than 1. In the embodiment of the present application, the display screen 194A can be used as a light-emitting device to display light with varying brightness, and the second electronic device can communicate optically with other electronic devices through the brightness changes of the display screen.
[0084] The second electronic device 200 can implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194A, and an application processor.
[0085] The camera 193 is used to capture images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP for conversion into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the second electronic device 200 may include 1 or N cameras 193, where N is a positive integer greater than 1. In an embodiment of the present application, the second electronic device can use the camera 193 to capture the light emitted by other electronic devices that changes in brightness and darkness to identify the light signals sent by other electronic devices.
[0086] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the second electronic device 200. The external memory card communicates with the processor 110 via the external memory interface 120 to implement data storage. For example, files such as music and videos can be stored on the external memory card. Alternatively, data transmitted via optical communication can be stored on the external memory card.
[0087] The internal memory 121 can be used to store computer executable program codes, and the executable program codes include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the second electronic device 200 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the second electronic device 200 by running instructions stored in the internal memory 121 and / or instructions stored in a memory provided in the processor.
[0088] In the embodiment of the present application, the second electronic device can obtain data such as its own state (such as motion state, positioning), environmental information, etc. through the sensor module 180.
[0089] The ambient light sensor 180L is used to sense the brightness of the ambient light. The second electronic device 200 can adaptively adjust the brightness of the display screen 194A according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the second electronic device 200 is in a pocket to prevent accidental touch. In an embodiment of the present application, the ambient light sensor 180L can be used as a light intensity sensor to sense the light of other electronic devices. The second electronic device can sense the light of other electronic devices through the ambient light sensor 180L and obtain the light signals sent by other electronic devices.
[0090] Exemplarily, as shown in FIG4 , the method includes S401-S405. It should be noted that the process is not limited to the specific order shown in FIG4 and below. It should be understood that in other embodiments, the order of some steps in the process can be interchanged according to actual needs, or some steps can be omitted or deleted. The process includes the following steps:
[0091] S401: The first electronic device obtains first data in response to a first instruction.
[0092] In some embodiments, the first instruction is used to instruct the first electronic device to send the first data to the second electronic device by means of optical communication. The first data may be request information, indication information, or status information, etc. For example, in the optical communication process of the Internet of Vehicles, the traffic lights and vehicles on the road are equipped with LED lights and light intensity sensors. The vehicle sends the vehicle status information to the traffic light by means of optical communication, and the traffic light uploads it to the remote information center. For another example, the traffic light sends the indication information to the vehicle by means of optical communication. For another example, in a smart home system, the electrical appliance is equipped with an LED light, and the control center (such as a mobile phone) is equipped with a light intensity sensor. The electrical appliance sends a request information for requesting to turn on a certain function or requesting to turn off a certain function to the control center by means of optical communication.
[0093] Exemplarily, the first electronic device is, for example, an air conditioner in a home with an LED light with adjustable brightness, and the second electronic device is a mobile phone with an ambient light sensor. The air conditioner is preset with a preset temperature condition. When the air conditioner detects that the ambient temperature exceeds the preset temperature condition, the air conditioner generates a first instruction, which is used to instruct the air conditioner to send a request message (first data) to the control center (mobile phone) via optical communication to request to turn off the cooling or heating operation of the air conditioner. For example, during the cooling process, the air conditioner recognizes that the ambient temperature is very low. When the air conditioner confirms that the ambient temperature reaches the preset temperature condition, it generates a first instruction, which is used to instruct the air conditioner to send a first data (such as a binary string corresponding to "Can the air conditioner be turned off?") to the mobile phone via optical communication. The air conditioner obtains the first data corresponding to the first instruction.
[0094] S402: The first electronic device processes the first data according to a first preset method to obtain second data, where the second data is a first light intensity sequence arranged in a first order.
[0095] In some embodiments, in the absence of light obstruction, the second electronic device can completely receive the optical signal sent by the first electronic device. However, in the presence of light obstruction, the second electronic device can only receive a portion of the optical signal sent by the first electronic device. In the presence of light obstruction, if the second electronic device parses the received partial optical signal, it cannot restore the first data. Therefore, in an embodiment of the present application, the first electronic device processes the first data in accordance with the first preset method, so that the second electronic device can restore the first data regardless of whether it can receive the complete optical signal sent by the first electronic device.
[0096] In some embodiments, the first preset method includes an encoding process and a mapping process. The first electronic device processes the first data according to the first preset method to obtain the second data, including: the first electronic device performs an encoding process on the first data to obtain fourth data; and the first electronic device performs a mapping process on the fourth data to map the fourth data to the second data.
[0097] The first electronic device may perform encoding on the first data in a variety of ways.
[0098] For example, if a first electronic device performs reverse differential encoding on the first data intended for transmission, and then a second electronic device performs reverse differential encoding on the received light intensity, this can solve the problem of the second electronic device being unable to recognize the first data due to an incomplete received light signal. Therefore, the encoding process includes reverse differential encoding.
[0099] For example, to improve the efficiency and accuracy of the second electronic device's restoration of the first data, the first electronic device can also add an XOR encoding process to the first data during the encoding process. This allows the second electronic device to not only identify the first data based on the received data when the received data is incomplete, but also improves the robustness of the transmission. Therefore, the encoding process includes XOR encoding and reverse differential encoding.
[0100] The following describes in detail the two processes of processing the first data in the first preset manner through the process examples in FIG5 and FIG6 .
[0101] Method 1: The encoding process includes reverse differential encoding.
[0102] Exemplarily, as shown in FIG5 , the first data processing process corresponding to S402 includes the following S4021 - S4023 .
[0103] S4021: The first electronic device divides the first data into segments according to a preset length to obtain segmented first data.
[0104] In some embodiments, to facilitate encoding of the first data and increase encoding accuracy, the first electronic device may first segment the first data to obtain segmented first data, where the segmented first data is more neatly arranged. Optionally, the first electronic device segments the first data according to a preset length. The preset length may be an experimental or empirical value, for example.
[0105] For example, the first data is a binary string with a preset length of 4 bits. The first electronic device segments the first data every four bits, starting from the first bit. If the number of bits in the first data is not an integer multiple of four, the last digits less than four are padded with "0" to obtain the segmented first data. For example, the first data is the binary string "001110110010000001001100101000010100001011010010". The first electronic device segments the first data to obtain the segmented first data "0011 1011 0010 0000 0100 1100 1010 0001 0100 0010 1101 0010" (the corresponding decimal values are "3,-3,2,0,4,-4,-2,1,4,2,-5,2"; the first digit of each data in the segmented first data indicates positive or negative, and the last three digits indicate the value).
[0106] S4022: The first electronic device performs reverse differential encoding on the segmented first data to obtain fourth data.
[0107] In some embodiments, the reverse differential encoding process is the reverse process of the differential encoding process. To facilitate understanding of the reverse differential encoding process, the following example introduces the differential encoding process.
[0108] Exemplarily, the first electronic device converts the segmented first data into fourth data through reverse differential coding. Correspondingly, the first electronic device performs differential coding on the fourth data to obtain the segmented first data. For example, the first electronic device performs reverse differential encoding on the segmented first data "0011 1011 0010 0000 0100 1100 1010 0001 0100 0010 1101 0010" (whose corresponding decimal value is "3,-3,2,0,4,-4,-2,1,4,2,-5,2") to obtain the fourth data "0000 0011 0000 0010 0010 0110 0010 0000 0001 0101 0111 0010 0100" (whose corresponding decimal value is "0,3,0,2,2,6,2,0,1,5,7,2,4"). The conversion process from the fourth data in the above example to the segmented first data satisfies the differential encoding process. For example, the electronic device subtracts the previous digit "0010" from the last digit "0100" in the fourth data, and obtains "0010" as the last digit of the first data after segmentation, and so on, until the second digit "0011" in the fourth data is subtracted from the first digit "0000", and obtains "0011" as the first digit of the first data after segmentation, thereby completing the differential encoding of the fourth data.
[0109] In this way, after the first electronic device performs reverse differential encoding processing on the first data, even if the second electronic device cannot receive the complete light signal, it can restore the first data by differentially encoding the received light signal (third data) into the light intensity change rate.
[0110] Method 2: The encoding process includes XOR encoding and reverse differential encoding.
[0111] In some examples, the first electronic device first performs XOR encoding on the first data and then performs reverse differential encoding on the XOR-encoded data. It should be understood that the first electronic device may also first perform reverse differential encoding on the first data and then perform XOR encoding on the reverse differential-encoded data.
[0112] Exemplarily, as shown in FIG6 , S4022 includes the following S4022a - S4022b .
[0113] S4022a: The first electronic device performs XOR encoding on the segmented first data to obtain initial fourth data.
[0114] In some embodiments, during the XOR encoding process, if two corresponding bits of two values involved in the operation are the same, the XOR result of the bit is 0, otherwise it is 1.
[0115] In some embodiments, when the first electronic device performs XOR encoding on the segmented first data to obtain the initial fourth data, the first electronic device performs XOR encoding on a portion of the segmented first data to generate a portion of the data in the initial fourth data. For example, the first electronic device obtains the data for the corresponding bit in the initial fourth data based on the XOR calculation result of the portion of the segmented first data. Furthermore, the first electronic device may also directly use the portion of the segmented first data as the data for the corresponding bit in the initial fourth data without performing XOR encoding. Subsequently, after receiving the optical signal, the second electronic device may parse the data obtained by XOR encoding based on the data that was not XORed during the encoding process, thereby obtaining the entire segmented first data. For example, the XOR encoding process will be described using the example of the first electronic device performing XOR encoding on the segmented first data "0011 1011 0010 0000 0100 1100" shown in 701 of FIG. 7 to obtain the initial fourth data shown in 702 of FIG. 7. The six numbers in the first data after segmentation are referred to as SEG1, SEG2, SEG3, SEG4, SEG5, and SEG6 from left to right.
[0116] For example, let's take the example of a first electronic device performing an XOR operation on SEG1 and SEG3 to obtain C3. Because the first three bits in SEG1 and SEG3 are identical, the XOR result of these bits is "0," and the first three bits in C3 generated by the first electronic device are "0." Because the fourth bits in SEG1 and SEG3 are different, the XOR result of the fourth bit is "1," and the fourth bit in C3 generated by the first electronic device is "1." Thus, the first electronic device XORs SEG1 "0011" and SEG3 "0010," generating C3 "0001."
[0117] For another example, let's take the example of a first electronic device performing an XOR operation on SEG3 and SEG4 to obtain C4. Because the first two bits and the last bit in SEG3 and SEG4 are the same, the XOR result of these three bits is "0", and these three bits in C4 generated by the first electronic device are "0". Because the third bits in SEG3 and SEG4 are different, the XOR result of the third bit is "1", and the third bit in C4 generated by the first electronic device is "1". In this way, the first electronic device performs an XOR operation on SEG3 "0010" and SEG4 "0000", generating C4 "0010".
[0118] For another example, let's take the example of a first electronic device performing an XOR operation on SEG2, SEG4, and SEG6 to obtain C6. Because the second bits of SEG2 and SEG4 are the same, the XOR result of the second bits of SEG2 and SEG4 is "0." The first electronic device then XORs the second bit "0" with the second bit "1" of SEG6. Because the XOR result of "0" and "1" is "1," the second bit of C6 generated by the first electronic device is "1." Because the first, third, and fifth bits of SEG2 and SEG4 are different, the XOR results of these three bits of SEG2 and SEG4 are all "1." The first electronic device then XORs these three bits "1," "1," and "1" with the three bits "1," "0," and "0" of SEG6, resulting in XOR results of "0," "1," and "1." The three bits of C6 generated by the first electronic device are "0," "1," and "1," respectively. In this way, the first electronic device performs XOR encoding on SEG2 "1011", SEG4 "0000", and SEG6 "1100", and generates C6 as "0111".
[0119] For another example, let's take the example of the first electronic device performing an XOR operation on SEG4 and SEG6 to obtain C7. Because the first two bits in SEG4 and SEG6 are the same, the XOR result of the first two bits is "0", and the first two bits in C7 generated by the first electronic device are "0". Because the last two bits in SEG4 and SEG6 are different, the XOR result of the last two bits is "1", and the last two bits in C7 generated by the first electronic device are "1". In this way, the first electronic device performs an XOR operation on SEG4 "0000" and SEG6 "1100", generating C7 "1100".
[0120] For another example, the first electronic device directly uses SEG1 "0011", SEG2 "1011", and SEG5 "0100" as C1, C2, and C5 in the initial fourth data. Finally, the first electronic device performs XOR encoding on the segmented first data to obtain the initial fourth data composed of C1, C2, C3, C4, C5, C6, and C7. The binary code of the initial fourth data is "0011 1011 0001 0010 0100 0111 1100", and its corresponding decimal value is "3, -3, 1, 2, 4, 7, -4". Subsequently, when the second electronic device does not receive the optical signal corresponding to SEG3, it can infer SEG3 based on C3 and SEG1, or it can infer SEG3 based on C4 and SEG4. When the second electronic device does not receive the optical signals corresponding to SEG5 and SEG6, it can infer SEG6 based on C6, SEG2 and SEG4, and then infer SEG5 based on C7 and SEG6.
[0121] In this way, the first electronic device performs XOR encoding on the first data, and then the second electronic device can obtain the complete first data through XOR encoding analysis after receiving the optical signal even if the received optical signal is incomplete.
[0122] S4022b: The first electronic device performs reverse differential encoding on the initial fourth data to obtain fourth data.
[0123] Illustratively, the first electronic device performs reverse differential encoding on the initial fourth data "3, -3, 1, 2, 4, 7, -4" according to the reverse differential encoding method shown in S4022 to obtain fourth data "0, 3, 0, 1, 3, 7, 14, 10".
[0124] As described above, after the first electronic device performs the encoding process on the first data, it performs the mapping process on the encoded fourth data. That is, after S4022 (or S4022b), the following S4023 is also included.
[0125] S4023: The first electronic device performs a mapping process on the fourth data, mapping the fourth data into second data.
[0126] In some embodiments, the first electronic device obtains the encoded fourth data through the encoding process of the above example, and then needs to process the fourth data to convert the fourth data into an optical signal that can be transmitted via optical communication.
[0127] In some embodiments, the first electronic device maps the fourth data into a second light intensity sequence for controlling the light emitting device to emit light according to the light intensity level of the light emitting device.
[0128] Exemplarily, the fourth data is a string of 4-bit binary digits. The first electronic device determines a mapping relationship between data in the fourth data and the light intensity level of the light emitting device based on the maximum and minimum values of the binary digits and the light intensity level of the light emitting device.
[0129] In some examples, the first electronic device determines a linear mapping relationship between the binary digits in the fourth data and the illumination intensity levels. For example, if the maximum and minimum values of the binary digits in the fourth data differ by 8, and the illumination intensity of the light-emitting device has eight levels, the first electronic device determines that the data in the fourth data and the illumination intensity levels have a one-to-one mapping relationship. If the maximum and minimum values of the binary digits in the fourth data differ by 15, and the illumination intensity of the light-emitting device has eight levels, the second electronic device determines that every two consecutive values between the maximum and minimum values in the fourth data are mapped to the same illumination intensity level, i.e., the mapping relationship is that two values correspond to the same illumination intensity level.
[0130] For example, if the fourth data is "0,3,0,2,2,6,2,0,1,5,7,2,4" (decimal representation of the binary string), the maximum value "7" and the minimum value "0" have a numerical span of 8, and the light-emitting device includes 8 light intensity levels from 0 to 7, the first electronic device maps the fourth data one by one into the light intensity sequence "0,3,0,2,2,6,2,0,1,5,7,2,4" according to the one-to-one mapping relationship between numerical values and light intensity levels. For another example, if the fourth data is "0,3,0,1,3,7,14,10" (decimal representation of the binary string), the maximum value "14" and the minimum value "0" have a numerical span of 15, and the light-emitting device includes 8 light intensity levels from 0 to 7, the first electronic device maps the fourth data into the light intensity sequence "0,1,0,0,1,3,7,5" according to the mapping relationship that two numerical values correspond to the same light intensity level.
[0131] In some embodiments, the second data includes a preset identifier that indicates the initiation of optical communication. To facilitate the initiation of optical communication between the second electronic device and the first electronic device, the first electronic device identifies the first data sent by the first electronic device. After mapping the fourth data into a second light intensity sequence for controlling the light-emitting device, the first electronic device adds the preset identifier to the second light intensity sequence to obtain the second data.
[0132] Exemplarily, the preset identifier can be an agreed preamble code for starting optical communication agreed in advance by the first electronic device and the second electronic device. The first electronic device adds an agreed preamble code as an identifier to the second light intensity sequence to obtain the second data. For example, the second light intensity sequence is "0,3,0,2,2,6,2,0,1,5,7,2,4", and the first electronic device adds the agreed preamble code "7,3,7,3,7,3,7" to the second light intensity sequence to obtain the first light intensity sequence "7,3,7,3,7,3,7,0,3,0,2,2,6,2,0,1,5,7,2,4" arranged in the first order, that is, the second data. In this way, when the second electronic device receives the optical signal and recognizes that the preset identifier "7,3,7,3,7,3,7" is included in the optical signal, it can determine that the optical signal sent by the first electronic device is recognized. Then, the second electronic device can collect the optical signal to identify the data transmitted by the first electronic device.
[0133] Based on the above steps, the first electronic device obtains the second data, which is the first light intensity sequence. Then, the first electronic device can control the light-emitting device to emit light according to the first light intensity sequence through S403 and send the light signal to the second electronic device.
[0134] S403: The first electronic device controls the light-emitting device to send a light signal according to the first light intensity sequence.
[0135] The first illumination intensity sequence includes a plurality of illumination intensities arranged in a first order.
[0136] In some embodiments, the first electronic device controls the light-emitting device to emit light in accordance with the light intensity corresponding to the first order in the first light intensity sequence to achieve the transmission of the light signal. Optionally, during the light signal transmission process, the light emission time corresponding to each light intensity is the same or different. For example, the first electronic device transmits the corresponding light intensity according to a preset light emission time (e.g., 10 milliseconds) to achieve the transmission of the light signal.
[0137] Exemplarily, the first illumination intensity sequence is, for example, "7, 3, 7, 3, 7, 3, 7, 0, 3, 0, 1, 3, 7, 14, 10". Each number in the above sequence represents a light intensity, the first order refers to the order of the light intensities in the sequence, and the preset light-emitting duration is, for example, 10 milliseconds. For example, the first electronic device first controls the light-emitting device to emit light according to the first light intensity "7" in the light intensity sequence. After the light-emitting device maintains emitting light at the light intensity level 7 for 10 milliseconds (preset light-emitting duration), the first electronic device controls the light-emitting device to emit light according to the second light intensity "3" in the light intensity sequence, and maintains it for 10 milliseconds. Until the first electronic device controls the light-emitting device to emit light according to the last light intensity "10" in the light intensity sequence, and maintains it for 10 milliseconds. The first electronic device completes a round of light-emitting process of controlling the light-emitting device to emit light according to the second data. The curve diagram shown in S403 in Figure 5 is a schematic diagram of the light signal sent by the first electronic device to control the light-emitting device to complete a round of light-emitting process according to the second data, wherein the first electronic device completes the transmission of the light signal according to the different light intensities indicated by the light intensity sequence.
[0138] In some examples, in order for the second electronic device to fully identify the first data that the first electronic device intends to transmit, the first electronic device may control the light-emitting device to perform more than one round of light-emitting process according to the light intensity corresponding to the first light intensity sequence arranged in the first order.
[0139] The above steps S401-S403 describe the process of the first electronic device processing the first data according to the first preset method and sending the optical signal. The following describes in detail the process of the second electronic device receiving the optical signal and analyzing the optical signal.
[0140] S404: The second electronic device collects the light signal sent by the first electronic device through the light intensity sensor to obtain third data.
[0141] The light intensity sensor is, for example, the ambient light sensor 180L shown in FIG3 . Alternatively, the light intensity sensor may also be other sensors configured in the second electronic device.
[0142] It should be understood that the light intensity sensor in the embodiment of the present application is a light intensity sensor in a broad sense, and any sensor that can be used to detect light signals can be included in the protection scope of the embodiment of the present application. For example, the light intensity sensor is a special sensor for detecting light signals, or the light intensity sensor is a sensor with the ability to detect light signals. Alternatively, the second electronic device can also collect the light signal sent by the first electronic device through other modules with the function of collecting light signals. For example, the second electronic device collects the light signal through a camera. In some examples, the second electronic device collects the light signal sent by the first electronic device as shown in S404 in Figure 5, that is, the third data, through the light intensity sensor. The light signal is the same or similar to the light signal sent by the first electronic device as shown in S403 in Figure 5, such as light signal fluctuations caused by interference such as poor optical communication.
[0143] In some embodiments, the third data is part or all of the second data corresponding to the optical signal sent by the first electronic device. For example, in the absence of light obstruction, the second electronic device can completely receive the optical signal sent by the first electronic device, that is, the third data received by the second electronic device is all of the second data. However, in the presence of light obstruction, the second electronic device can only receive part of the optical signal sent by the first electronic device, that is, the third data received by the second electronic device is part of the second data.
[0144] In some embodiments, the second electronic device may start collecting the third data in response to a user operation, or may start collecting the third data spontaneously.
[0145] For example, the second electronic device is an intelligent robot in a factory workshop. The intelligent robot can respond to the worker's operation and start collecting light signals sent by other electronic devices in the workshop, and then cooperate with other electronic devices to complete work tasks. For another example, the intelligent robot does not perform work tasks at night. At a preset time point in the morning before the workers go to work, it starts to automatically detect whether other electronic devices in the workshop are in place or can be turned on and work normally by optical communication. For example, the intelligent robot can automatically start collecting status information sent by other electronic devices in the workshop via light signals at 6 o'clock in the morning, so as to determine that all electronic devices in the workshop can work normally before the workers go to work. For another example, the light intensity sensor of the intelligent robot is in a long-on state. After the intelligent robot detects a change in light intensity corresponding to a preset identifier through the light intensity sensor, it confirms that the first electronic device is sending data to the intelligent robot, and the intelligent robot starts collecting third data.
[0146] In some embodiments, when the second electronic device detects a light signal in the environment corresponding to a preset identifier via a light intensity sensor, it may determine to initiate optical communication with the first electronic device and begin collecting third data. For example, the second electronic device may begin collecting third data after detecting a change in light intensity in the environment corresponding to the preset identifier "7, 3, 7, 3, 7, 3, 7" via the light intensity sensor.
[0147] In some examples, when the second electronic device detects a light signal corresponding to a preset identifier in the environment twice through a light intensity sensor, it can be determined that the light signal sent by the first electronic device has been collected, that is, the third data has been collected.
[0148] In some examples, if the light intensity sensor of the second electronic device is in a long-on state, the second electronic device collects light signals continuously or according to a preset period. If no light signal corresponding to the preset identifier is detected, the second electronic device will discard the collected light signal. In some scenarios, the second electronic device collects the third data through the light intensity sensor to solve the existing technical problems of poor user experience such as high energy consumption, excessive collection of user information, and the need for user intervention in collecting light signals through cameras. For example, the second electronic device is a mobile phone, and the mobile phone collects the third data of the first electronic device based on the ambient light sensor built into the mobile phone. It consumes little energy, does not collect images or videos in the environment, and does not require the user to turn on the camera or perform other operations.
[0149] S405: The second electronic device restores the third data according to the second preset method to obtain the first data.
[0150] In some embodiments, the second preset method corresponds to the first preset method. In some examples, the second preset method includes a decoding process. The second electronic device performs a decompression process on the third data according to the second preset method to obtain the first data, including: the second electronic device performs a decoding process on the third data to obtain fifth data, where the fifth data is a sequence of light intensity change rates arranged in the second order. The second electronic device recombines the fifth data to obtain the first data.
[0151] Optionally, the processing process of the third data includes a decoding process and a reassembly process. The decoding process is first introduced below.
[0152] In some examples, corresponding to the first method described above, the first electronic device encodes the first data using reverse differential encoding. Accordingly, when the second electronic device decodes the acquired third data, it decodes the third data using reverse differential encoding parsing. For example, as shown in FIG5 , S405 includes the following steps S4051-S4052.
[0153] S4051: The second electronic device performs reverse differential coding analysis on the third data to obtain fifth data.
[0154] In some embodiments, the second electronic device obtains a light intensity change rate sequence (fifth data) arranged in a second order according to the light intensity indicated by the received third data, thereby achieving reverse differential coding analysis of the third data.
[0155] Optionally, the illumination intensity change rate in the illumination intensity change rate sequence is the product of a difference between the average illumination intensity of a subsequent time window and the average illumination intensity of a previous time window collected by the illumination intensity sensor and a preset coefficient.
[0156] For example, the second electronic device can obtain the illumination intensity change rate sequence (fifth data) arranged in the second order according to the illumination intensity indicated by the received third data by the following formula: diffIntensity = [AVG(Intensity[T1:T2]) - AVG(Intensity[T0:T1])] * C
[0157] Where diffIntensity represents the rate of change of light intensity, and "AVG(Intensity[T1:T2]) - AVG(Intensity[T0:T1])" represents the difference between the average light intensity of the subsequent time window and the average light intensity of the previous time window. T0, T1, and T2 represent the time points at which light intensities are collected. Each time window separates T0 from T1, and T1 from T2. This time window can be, for example, 50 milliseconds. C is a preset coefficient.
[0158] Illustratively, the second electronic device converts the third data into fifth data “-4, 4, -4, 4, -4, 4, -7, 3, -3, 2, 0, 4, -4, -2, 1, 4, 2, -5, 2” by using the formula.
[0159] In some embodiments, the third data received by the second electronic device includes an optical signal corresponding to a preset identifier. The preset identifier is a sign agreed in advance by the first electronic device and the second electronic device to start optical communication, and is not the content of the first data that the first electronic device intends to transmit to the second electronic device. Therefore, the second electronic device needs to strip the preset identifier from the third data.
[0160] In some examples, the fifth data obtained by the second electronic device according to decoding of the third data includes a preset identifier. The second electronic device needs to strip the preset identifier from the fifth data to obtain the fifth data stripped of the preset identifier.
[0161] For example, the preset identifier is the agreed leading code "-4,4,-4,4,-4,4,-7", and the fifth data is "-4,4,-4,4,-4,4,-7,3,-3,2,0,4,-4,-2,1,4,2,-5,2". The second electronic device strips the agreed leading code "-4,4,-4,4,-4,4,-7" from the fifth data to obtain the fifth data "3,-3,2,0,4,-4,-2,1,4,2,-5,2" (decimal expression) stripped of the preset identifier, and its binary string is "0011 1011 0010 0000 0100 1100 1010 0001 0100 0010 1101 0010".
[0162] In some scenarios, light obstruction may cause the third data received by the second electronic device to be part of the second data. In other scenarios, if the second electronic device is located in an environment with a high light intensity from other light sources (such as natural light sources), after the first electronic device emits a light signal with varying brightness, the light intensity in the light signal received by the second electronic device will not change significantly, resulting in the second electronic device being unable to accurately restore the first data.
[0163] Through the method shown in S4051, when the first electronic device performs reverse differential encoding on the first data, the second electronic device can still obtain the light intensity change rate sequence corresponding to the first data that the first electronic device intends to send based on the received light signal, even if the received light signal is incomplete, and then restore the complete first data based on the light intensity change rate sequence, thereby overcoming the technical problem that the second electronic device cannot completely restore the first data caused by the above-mentioned light obstruction or other light source influences.
[0164] In other examples, corresponding to the second method described above, the first electronic device encodes the first data using XOR encoding and reverse differential encoding. Accordingly, when the second electronic device decodes the acquired third data, it decodes the third data using XOR encoding parsing and reverse differential encoding parsing. For example, as shown in FIG6 , the method includes S4051a-S4051b.
[0165] S4051a: The second electronic device performs reverse differential coding analysis on the third data to obtain initial fifth data.
[0166] In some embodiments, during the encoding process based on the first preset method, the first electronic device first performs XOR encoding on the first data, and then performs reverse differential encoding. Correspondingly, during the decoding process based on the second preset method, the second electronic device first performs reverse differential encoding and parsing on the acquired third data, and then performs XOR encoding and parsing.
[0167] The process of the second electronic device performing reverse differential encoding and parsing on the third data may refer to the relevant content described in S4051 above.
[0168] Illustratively, the second electronic device obtains the initial fifth data “0011 1011 0001 0010 0100 0111 1100” according to the method shown in S4051.
[0169] S4051b: The second electronic device performs XOR coding on the initial fifth data to obtain fifth data.
[0170] In some embodiments, when optical communication is smooth, the initial fifth data obtained by the second electronic device after reverse differential encoding and parsing is the same as the initial fourth data obtained by the first electronic device after XOR encoding the segmented first data. In the case of light obstruction, the optical signal received by the second electronic device from the first electronic device is missing, and the initial fifth data is missing some data compared to the initial fourth data. Therefore, the second electronic device needs to perform XOR encoding and parsing on the initial fifth data to obtain the fifth data.
[0171] In some embodiments, the second electronic device performs XOR encoding and parsing on the initial fifth data. In the process of obtaining the fifth data, the second electronic device parses the data obtained by XORing during the encoding process included in the initial fifth data based on the data included in the initial fifth data that was not XORed during the encoding process, thereby obtaining the fifth data.
[0172] As an example, the following describes the process of the second electronic device performing XOR encoding and parsing on the initial fifth data in conjunction with FIG8 . As shown in 801 in FIG8 , the data in the initial fifth data "0011 1011 0001 0010 0100 0111 1100" are sequentially represented by C1, C2, C3, C4, C5, C6, and C7. As shown in 802 in FIG8 , the data in the fifth data "0011 1011 0010 0000 0100 1100" are sequentially represented by SEG1, SEG2, SEG3, SEG4, SEG5, and SEG6. C1 and C2 in the initial fifth data do not participate in the XOR operation. Based on C1 and C2, the second electronic device can obtain SEG1 = C1 = 0011 and SEG2 = C2 = 1011 in the fifth data. In the initial fifth data, C3 is obtained by XOR encoding SEG1 and SEG3. The second electronic device can obtain SEG3=0010 based on SEG1=0011 and C3=0001. In the initial fifth data, C4 is obtained by XOR encoding SEG3 and SEG4. The second electronic device can obtain SEG4=0000 based on C4=0000 and SEG3=0010. In this way, the second electronic device obtains the fifth data "0011 1011 0010 0000 0100 1100" as shown in 802 of Figure 8. This fifth data is the same as the first data after segmentation shown in 701 of Figure 7. Subsequently, the second electronic device reorganizes the fifth data to restore the first data intended to be sent by the first electronic device.
[0173] In this way, even if the second electronic device cannot receive the entire optical signal sent by the first electronic device, it can still derive the fifth data (the complete segmented first data) based on the initial fifth data converted from the received optical signal. This eliminates the need for multiple transmissions and recognitions between the first and second electronic devices, overcoming the problem of the second electronic device being unable to recognize the first data due to poor optical communication, thereby improving the efficiency and accuracy of optical communication.
[0174] As described above, after the second electronic device decodes the third data, it splices the fifth data obtained after decoding to restore the first data. That is, after S4051 (or S4051b), the following S4052 is also included.
[0175] S4052: The second electronic device splices the fifth data to obtain first data.
[0176] In some embodiments, the fifth data obtained by the second electronic device after decoding corresponds to the first data after segmentation. Then, the second electronic device needs to splice the fifth data to obtain the first data.
[0177] Illustratively, the second electronic device concatenates the fifth data "0011 1011 0010 0000 0100 1100 1010 0001 0100 0010 1101 0010" to obtain the first data "001110110010000001001100101000010100001011010010". Accordingly, if the first electronic device pads the positions with less than 4 bits with 0 when splitting the first data into the split first data, the second electronic device deletes the padded 0 at the positions when splicing the fifth data into the first data to restore the original first data.
[0178] The technical solutions provided in the embodiments of this application enable the second electronic device to fully acquire the first data intended to be transmitted by the first electronic device even under adverse conditions such as light obstruction, resolving the technical issue of poor communication performance in current optical communication technologies under light obstruction. Furthermore, the use of a light intensity sensor instead of a camera to collect light signals consumes less energy, improving communication efficiency and user experience.
[0179] The optical communication method provided by the embodiment of the present application is described in detail above with reference to Figures 4 to 8. The first electronic device and the second electronic device provided by the embodiment of the present application are described in detail below with reference to Figures 9 and 10.
[0180] In one possible design, Figure 9 is a schematic diagram of the structure of a first electronic device provided in an embodiment of the present application. As shown in Figure 9, the first electronic device 900 may include: a transceiver unit 901 and a processing unit 902. The first electronic device 900 may be used to implement the functions of the first electronic device involved in the above method embodiment.
[0181] Optionally, the transceiver unit 901 is used to support the first electronic device 900 to execute S401 and S403 in Figure 4; and / or, support the first electronic device 900 to execute S401 and S403 in Figure 5; and / or, support the first electronic device 900 to execute S401 and S403 in Figure 6.
[0182] Optionally, the processing unit 902 is used to support the first electronic device 900 to execute S401-S403 in Figure 4; and / or, support the first electronic device 900 to execute S4021-S4023 in Figure 5; and / or, support the first electronic device 900 to execute S4022a and S4022b in Figure 6.
[0183] The transceiver unit may include a receiving unit and a transmitting unit, and may be implemented by a transceiver or transceiver-related circuit components, and may be a transceiver or a transceiver module. The transmitting unit includes a light-emitting device with adjustable brightness. The operations and / or functions of each unit in the first electronic device 900 are respectively to implement the corresponding processes of the optical communication method in the above-mentioned method embodiment. All relevant contents of each step involved in the above-mentioned method embodiment can be referred to the functional description of the corresponding functional unit. For the sake of brevity, they are not repeated here.
[0184] Optionally, the first electronic device 900 shown in FIG9 may further include a display unit (not shown in FIG9 ). Optionally, the first electronic device 900 shown in FIG9 may further include a storage unit (not shown in FIG9 ) storing a program or instruction. When the transceiver unit 901 and the processing unit 902 execute the program or instruction, the first electronic device 900 shown in FIG9 may perform the optical communication method in the above-described method embodiment.
[0185] The technical effects of the first electronic device 900 shown in FIG9 can refer to the technical effects of the optical communication method in the above-mentioned method embodiment, and will not be repeated here. In addition to the form of the first electronic device 900, the technical solution provided in this application can also be a functional unit or chip in the first electronic device, or a device used in conjunction with the first electronic device.
[0186] In one possible design, Figure 10 is a schematic diagram of the structure of a second electronic device provided in an embodiment of the present application. As shown in Figure 10, the second electronic device 1000 may include: a transceiver unit 1001 and a processing unit 1002. The second electronic device 1000 may be used to implement the functions of the second electronic device involved in the above method embodiment.
[0187] Optionally, the transceiver unit 1001 is used to support the second electronic device 1000 to execute S404 in Figure 4; and / or, support the second electronic device 1000 to execute S404 in Figure 5; and / or, support the second electronic device 1000 to execute S404 in Figure 6.
[0188] Optionally, the processing unit 1002 is used to support the second electronic device 1000 to execute S405 in Figure 4; and / or support the second electronic device 1000 to execute S4051 and S4052 in Figure 5; and / or support the second electronic device 1000 to execute S4051a and S4051b in Figure 6.
[0189] The transceiver unit may include a receiving unit and a transmitting unit, and may be implemented by a transceiver or transceiver-related circuit components, and may be a transceiver or a transceiver module. The receiving unit includes a light intensity sensor, such as an ambient light sensor. The operations and / or functions of each unit in the second electronic device 1000 are respectively to implement the corresponding processes of the optical communication method in the above-mentioned method embodiment. All relevant content of each step involved in the above-mentioned method embodiment can be referred to the functional description of the corresponding functional unit. For the sake of brevity, it is not repeated here.
[0190] Optionally, the second electronic device 1000 shown in FIG10 may further include a display unit (not shown in FIG10 ). Optionally, the second electronic device 1000 shown in FIG10 may further include a storage unit (not shown in FIG10 ) storing a program or instruction. When the transceiver unit 1001 and the processing unit 1002 execute the program or instruction, the second electronic device 1000 shown in FIG10 may perform the optical communication method in the above-described method embodiment.
[0191] The technical effects of the second electronic device 1000 shown in FIG10 can refer to the technical effects of the optical communication method in the above method embodiment, and will not be repeated here. In addition to the form of the second electronic device 1000, the technical solution provided by this application can also be a functional unit or chip in the second electronic device, or a device used in conjunction with the second electronic device.
[0192] An embodiment of the present application also provides a chip system, including: a processor and a memory, where the processor is coupled to the memory, and the memory is used to store programs or instructions. When the program or instruction is executed by the processor, the chip system implements the method in any of the above method embodiments.
[0193] Optionally, there may be one or more processors in the chip system. The processor may be implemented in hardware or software. When implemented in hardware, the processor may be a logic circuit, an integrated circuit, etc. When implemented in software, the processor may be a general-purpose processor implemented by reading software code stored in a memory.
[0194] Optionally, the memory in the chip system may be one or more. The memory may be integrated with the processor or may be provided separately from the processor, which is not limited in the embodiments of the present application. For example, the memory may be a non-transient processor, such as a read-only memory (ROM), which may be integrated with the processor on the same chip or provided on different chips. The embodiments of the present application do not specifically limit the type of memory or the configuration of the memory and the processor.
[0195] Exemplarily, the chip system may be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SoC), a central processor unit (CPU), a network processor (NP), a digital signal processor (DSP), a microcontroller unit (MCU), a programmable logic device (PLD) or other integrated chips.
[0196] It should be understood that each step in the above method embodiment can be completed by hardware integrated logic circuits in a processor or by software instructions. The method steps disclosed in the embodiments of the present application can be directly embodied as being executed by a hardware processor, or by a combination of hardware and software modules in a processor.
[0197] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer program is run on a computer, the computer executes the above-mentioned related steps to implement the optical communication method in the above-mentioned embodiment.
[0198] An embodiment of the present application further provides a computer program product. When the computer program product is run on a computer, the computer is caused to execute the above-mentioned related steps to implement the optical communication method in the above-mentioned embodiment.
[0199] In addition, embodiments of the present application further provide a device. Specifically, the device may be a component or module, and may include one or more processors and a memory connected to each other. The memory is configured to store a computer program. When the computer program is executed by one or more processors, the device performs the optical communication method described in each of the aforementioned method embodiments.
[0200] The apparatus, computer-readable storage medium, computer program product, or chip provided in the embodiments of the present application are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects of the corresponding methods provided above, and will not be repeated here.
[0201] The steps of the method or algorithm described in conjunction with the disclosure of the embodiments of the present application can be implemented in a hardware manner or can be implemented by a processor executing software instructions. The software instructions can be composed of corresponding software modules, and the software modules can be stored in a random access memory (RAM), a flash memory, a read-only memory (ROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a register, a hard disk, a mobile hard disk, a read-only compact disc (CD-ROM) or any other form of storage medium known in the art. An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and can write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC).
[0202] Through the description of the above embodiments, those skilled in the art will clearly understand that for the sake of convenience and brevity, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed; that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The specific working processes of the above-mentioned systems, devices, and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0203] In the several embodiments provided in this application, it should be understood that the disclosed methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation; for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of modules or units, which can be electrical, mechanical or other forms.
[0204] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0205] Computer-readable storage media include, but are not limited to, any of the following: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and other media that can store program code.
[0206] The above are only specific embodiments of the present application, but the scope of protection of the present application is not limited thereto. Any changes or replacements within the technical scope disclosed in this application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. An optical communication system, characterized in that: The system includes a first electronic device and a second electronic device, wherein the first electronic device includes a light emitting device with adjustable brightness, and the second electronic device includes a light intensity sensor. The first electronic device is used for: In response to the first instruction, obtaining first data; Processing the first data according to a first preset manner to obtain second data, where the second data is a first light intensity sequence arranged in a first order; controlling the light emitting device to transmit a light signal according to the first light intensity sequence; The second electronic device is used for: collecting the light signal sent by the first electronic device through the light intensity sensor to obtain third data, where the third data is part or all of the second data; According to a second preset method, the third data is restored to obtain the first data.
2. The system according to claim 1, wherein: The first preset manner includes an encoding process and a mapping process, and the encoding process includes reverse differential encoding; The first electronic device is used to: Performing the encoding process on the first data to obtain fourth data; The mapping process is performed on the fourth data to map the fourth data into the second data.
3. The system according to claim 2, characterized in that The encoding process also includes XOR encoding.
4. The system according to any one of claims 1 to 3, characterized in that: The second preset method includes a decoding process, and the decoding process includes reverse differential coding analysis; The second electronic device is configured to: Performing the decoding process on the third data to obtain fifth data, where the fifth data is a sequence of light intensity change rates arranged in the second order; The fifth data is spliced to obtain the first data.
5. The system according to claim 4, characterized in that The decoding process also includes XOR encoding analysis.
6. An optical communication method, characterized in that: Applied to a first electronic device, the first electronic device includes a light-emitting device with adjustable brightness, and the method includes: In response to the first instruction, obtaining first data; Processing the first data according to a first preset manner to obtain second data, where the second data is a first light intensity sequence arranged in a first order; According to the first light intensity sequence, the light emitting device is controlled to send a light signal, where the light signal is used to instruct the second electronic device to obtain the first data after processing the light signal in a second preset manner.
7. The method according to claim 6, characterized in that The first preset manner includes an encoding process and a mapping process, the encoding process includes reverse differential encoding, and the processing of the first data according to the first preset manner to obtain the second data includes: Performing the encoding process on the first data to obtain fourth data; The mapping process is performed on the fourth data to map the fourth data into the second data.
8. The method according to claim 7, characterized in that The encoding process also includes XOR encoding.
9. The method according to claim 7 or 8, characterized in that The performing the encoding process on the first data to obtain fourth data includes: Segmenting the first data according to a preset length to obtain segmented first data; The segmented first data is encoded to obtain fourth data.
10. The method according to any one of claims 6 to 9, characterized in that: The second data includes a preset identifier, and the preset identifier is used to indicate starting optical communication.
11. An optical communication method, characterized in that: Applied to a second electronic device, the second electronic device includes a light intensity sensor, and the method includes: The light intensity sensor collects the light signal sent by the first electronic device to obtain third data, wherein the third data is Part or all of the second data corresponding to the optical signal sent by the first electronic device, the second data being a first light intensity sequence arranged in a first order; According to a second preset method, the third data is restored to obtain the first data. The second data is the data obtained after the first data is processed according to the first preset method. The second preset method corresponds to the first preset method.
12. The method according to claim 11, characterized in that The second preset method includes a decoding process, and the decoding process includes reverse differential coding analysis; The method of restoring the third data according to the second preset method to obtain the first data includes: Performing the decoding process on the third data to obtain fifth data, where the fifth data is a sequence of light intensity change rates arranged in the second order; The fifth data is spliced to obtain the first data.
13. The method according to claim 12, characterized in that The decoding process also includes XOR encoding analysis.
14. The method according to any one of claims 11 to 13, characterized in that: The step of collecting the light signal sent by the first electronic device through the light intensity sensor to obtain the third data includes: The light signal is collected by the light intensity sensor, a preset identifier is identified, and it is determined to start optical communication with the first electronic device that sends the light signal to obtain the third data.
15. The method according to claim 14, characterized in that The method of restoring the third data according to the second preset method to obtain the first data includes: The preset identifier is stripped from the third data.
16. A first electronic device, characterized in that: include: A processor, a memory and a light-emitting device with adjustable brightness, wherein the memory and the light-emitting device with adjustable brightness are coupled to the processor, the memory is used to store computer program code, and the computer program code includes computer instructions. When the processor reads the computer instructions from the memory, the first electronic device executes the method described in any one of claims 6 to 10.
17. A second electronic device, characterized in that: include: A processor, a memory and a light intensity sensor, wherein the memory and the light intensity sensor are coupled to the processor, the memory is used to store computer program code, and the computer program code includes computer instructions. When the processor reads the computer instructions from the memory, the second electronic device executes the method described in any one of claims 11 to 15.
18. A chip system, characterized in that: include: A processor, the processor is coupled to a memory, the memory is used to store programs or instructions, when the program or instructions are executed by the processor, the chip system implements the method as described in any one of claims 6-10, and / or the method as described in any one of claims 11-15.
19. A computer-readable storage medium, characterized in that The computer-readable storage medium includes a computer program. When the computer program is run on an electronic device, the electronic device executes the method according to any one of claims 6 to 10 and / or the method according to any one of claims 11 to 15.
20. A computer program product, characterized in that When the computer program product is run on a computer, the computer is enabled to perform the method according to any one of claims 6 to 10 and / or the method according to any one of claims 11 to 15.
Citation Information
Patent Citations
Error correction method and device based on visible light communication
CN102957513A
UPSOOK modulation method with forward error correction based on mobile phone camera
CN114285472A
Data transmission method and device, equipment and medium
CN115173951A
Optical domain amplitude phase parasitic modulation method, system and device and storage medium
CN115694655A
Rental method of golf watch
KR102066375B1