Switching assembly, electronic device and method for detecting a switching state

By using a detection method based on the difference in optical signal reflection parameters in the switching component, the problem of interference in the state detection of the switching component is solved, high-precision state recognition is achieved, and the influence of magnetic field interference is avoided.

CN115632646BActive Publication Date: 2026-06-30GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
Filing Date
2022-09-26
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

In existing technologies, the status detection of switch components is easily affected by interference and the detection accuracy is not high. In particular, with the trend of thinner and lighter electronic devices and the increase of cameras, the detection accuracy of Hall sensors has decreased.

Method used

The system uses a transmitting module to send optical signals to the switching unit, and a receiving module to receive the optical signals reflected from the reflective surface. The main control module determines the switching state based on the intensity parameters and uses the difference in the reflection parameters of the optical signals for detection, thus avoiding magnetic field interference.

Benefits of technology

It improves the accuracy of switch component status detection, reduces interference from factors such as magnetic fields, and ensures the precision of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115632646B_ABST
    Figure CN115632646B_ABST
Patent Text Reader

Abstract

This application discloses a switching assembly, an electronic device, and a switching state detection method, including a main control module, a transmitting module, a receiving module, and a switching unit. The main control module is connected to both the transmitting and receiving modules. The transmitting module has a corresponding detection area for transmitting optical signals to the detection area. The switching unit includes at least two switching states and at least two reflective surfaces, with each switching state corresponding to one reflective surface. Different reflective surfaces have different reflection parameters, and the reflective surface located within the detection area differs depending on the switching state of the switching unit. The receiving module receives the optical signals reflected from the reflective surfaces within the detection area. The main control module acquires the intensity parameters corresponding to the optical signals received by the receiving module and determines the current switching state of the switching unit based on the intensity parameters. This application can determine the current switching state based on the intensity parameters corresponding to the received optical signals, improving the accuracy of detecting the current switching state.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of switch technology, and more specifically, to a switch assembly, electronic device, and switch status detection method. Background Technology

[0002] Currently, with the development of electronic information technology, electronic devices are integrating more and more functions. While it's possible to control switching components to different states, current methods for detecting the state of these components are susceptible to interference and lack high accuracy. Summary of the Invention

[0003] This application proposes a switching assembly, electronic device, and switching state detection method to improve the above-mentioned deficiencies.

[0004] In a first aspect, embodiments of this application provide a switching assembly, including a main control module, a transmitting module, a receiving module, and a switching unit. The main control module is connected to both the transmitting module and the receiving module. The transmitting module has a detection area and is used to transmit an optical signal to the detection area. The switching unit includes at least two switching states and at least two reflective surfaces, each switching state corresponding to one reflective surface. The reflection parameters of different reflective surfaces are different, and the reflective surface located within the detection area is different in different switching states of the switching unit. The receiving module is used to receive the optical signal reflected by the reflective surface within the detection area. The main control module is used to obtain the intensity parameter corresponding to the optical signal received by the receiving module and determine the current switching state of the switching unit based on the intensity parameter.

[0005] Secondly, embodiments of this application also provide an electronic device, including: a mid-frame and the switch assembly described in the first aspect, wherein the switch assembly is disposed in the mid-frame.

[0006] Thirdly, embodiments of this application also provide a switch state detection method applied to the switch assembly described in the first aspect. The method includes: controlling the transmitting module to transmit a first signal to the current reflective surface of the switch unit at a first power value; acquiring a second power value of a second signal, the second signal including the first signal received by the receiving module and reflected by the current reflective surface; and determining the current switch state of the switch unit based on the second power value.

[0007] This application provides a switching assembly, electronic device, and a switching state detection method. The switching assembly includes a transmitting module, a main control module, a receiving module, and a switching unit. The transmitting module emits an optical signal into a detection area. Each switching state in the switching unit corresponds to a reflective surface. The reflective surface in the detection area differs depending on the switching state, and each reflective surface has different reflection parameters. The receiving module receives the optical signal reflected by the reflective surface in the detection area. The main control module acquires the intensity parameter corresponding to the optical signal received by the receiving module and determines the current switching state of the switching unit based on the intensity parameter. Because the reflective surface in the detection area differs depending on the switching state of the switching assembly, and each reflective surface has different reflection parameters, the reflective parameters of the reflective surface in the detection area differ when the switching unit is in different switching states. Therefore, the optical signal reflected by the reflective surface in the detection area received by the receiving module will also differ, thus changing the intensity parameter corresponding to the optical signal received by the receiving module and allowing the main control module to determine the current switching state of the switching unit based on the intensity parameter. Furthermore, since optical signals are not easily interfered with by factors such as magnetic fields, the determination of the current switching state of the switching unit in this application has high accuracy.

[0008] Other features and advantages of the embodiments of this application will be set forth in the following description, and will be apparent in part from the description, or may be learned by practicing the embodiments of this application. The objects and other advantages of the embodiments of this application may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings. Attached Figure Description

[0009] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0010] Figure 1 A schematic diagram of a switch state detection principle is shown;

[0011] Figure 2 This paper shows a schematic diagram of the structure of a switch assembly provided in an embodiment of this application;

[0012] Figure 3 This paper shows a schematic diagram of the structure of the transmitting module and the receiving module provided in an embodiment of this application;

[0013] Figure 4 This paper shows a schematic diagram of the structure of a switching unit provided in an embodiment of this application;

[0014] Figure 5 This paper shows a schematic diagram of the structure of another switching unit provided in an embodiment of this application;

[0015] Figure 6 A schematic diagram of another switching unit provided in an embodiment of this application is shown;

[0016] Figure 7 This paper presents a schematic diagram of the structure of an electronic device according to an embodiment of the present invention;

[0017] Figure 8 This paper presents a flowchart of a switch state detection method according to an embodiment of the present invention.

[0018] Figure 9 An incident light irradiance diagram provided in an embodiment of this application is shown;

[0019] Figure 10 A diagram illustrating one embodiment of step S140 is shown;

[0020] Figure 11 This paper shows a structural block diagram of a computer-readable storage medium provided in an embodiment of this application;

[0021] Figure 12 A structural block diagram of a computer program product provided in an embodiment of this application is shown. Detailed Implementation

[0022] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, and not all of them. The components of the embodiments of the present application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of the present application. All other embodiments obtained by those skilled in the art based on the embodiments of the present application without inventive effort are within the scope of protection of the present application.

[0023] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this application, terms such as "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0024] Currently, with the development of electronic information technology, electronic devices are integrating more and more functions. While it's possible to control switching components to different states, current methods for detecting these states are susceptible to interference and lack accuracy. Improving the accuracy of detecting the state of switching components is a problem that urgently needs to be solved.

[0025] Currently, electronic devices are generally equipped with switching components. Users control the electronic device by positioning the switching components in different positions. For example, a mechanical slide switch can be used in current electronic devices; that is, the switching component is a mechanical slide switch. This mechanical slide switch may include a sliding contact and several fixed contacts. When the sliding contact is in direct contact with a fixed contact, the current switching state of the switching component can be obtained by directly reading the corresponding voltage level of the mechanical slide switch at that moment.

[0026] Another example is that current electronic devices can also be equipped with multi-segment slide switches, such as three-segment slide switches. These multi-segment slide switches can correspond to multiple switching states; for example, a three-segment slide switch can correspond to three different switching states. Users can control the slide switch to different switching states. Please refer to [link to relevant documentation]. Figure 1 , Figure 1A schematic diagram illustrating the principle of detecting the switching state of a three-segment slide switch is shown. The three-segment slide switch 110 may include a magnet 111. A first Hall sensor 121 and a second Hall sensor 122 may be mounted on a circuit board 120. The first Hall sensor 121 and the second Hall sensor 122 can interact with an electronic device via the circuit board 120, for example, communicating with the main control module of the electronic device. The three-segment slide switch 110 can have three switching states. When the three-segment slide switch 110 is in different switching states, its position is different; for example, it can be in a first position, a second position, or a third position, respectively. These different positions are obtained by adjusting the sliding direction of the three-segment slide switch 110. Furthermore, since the magnet 111 is mounted on the three-segment slide switch 110, its position changes depending on the position of the three-segment slide switch 110. A magnetic field is generated around the magnet 111, and the first Hall sensor 121 or the second Hall sensor 122 can sense an electrical signal based on the strength of the surrounding magnetic field. The magnetic field strength generated by magnet 111 is inversely related to the distance from magnet 111; that is, the farther away from magnet 111, the weaker the magnetic field strength. Therefore, when the position of magnet 111 changes with the position of the three-stage slide switch 110, the spatial distance between magnet 111 and the first Hall sensor 121, as well as the spatial distance between magnet 111 and the second Hall sensor 122, will change. Consequently, the magnetic field strength sensed by the first Hall sensor 121 and the second Hall sensor 122 will also change. Furthermore, the electrical signals sensed by the first Hall sensor 121 and the second Hall sensor 122 will change depending on the position of magnet 111, thus allowing the detection of different positions of the slide switch 110.

[0027] However, the inventors discovered during their research that for the aforementioned mechanical slide switch, the sliding contact needs to be in direct contact with the fixed contact, making it susceptible to dust, moisture, and other contaminants, leading to false detections of the switch's state. Furthermore, as existing electronic devices increasingly strive for thinner and lighter designs, the internal component layout becomes increasingly limited. Some electronic devices have high demands for imaging capabilities, thus requiring a large number of cameras. Within these limited layout constraints, as the number of cameras increases and the size of each camera grows, the distance between the cameras and the first and second Hall sensors mounted on the circuit board becomes increasingly closer. Since cameras typically integrate multiple magnets, when the distance between the camera and the first or second Hall sensor is small, the magnetic field generated by the magnet inside the camera can interfere with the first or second Hall sensor. Therefore, for the aforementioned method of detecting the position of a three-segment slide switch using the first and second Hall sensors, the first or second Hall sensors may be affected by the magnetic field generated by the magnet inside the camera, resulting in a decrease in the accuracy of the three-segment slide switch position detection. Based on the foregoing analysis, it can be seen that for the method of using a Hall sensor to detect the position of a magnet and thus determine the position of a multi-segment slide switch, since the Hall sensor needs to detect the magnetic field strength, regardless of the number of segments of the multi-segment slide switch, the Hall sensor in the multi-segment slide switch may be interfered with by the magnetic field generated by the magnet inside the camera, which will lead to a decrease in the accuracy of detecting the position of the multi-segment slide switch.

[0028] Therefore, in order to overcome the above-mentioned defects, this application provides a switching component, an electronic device, and a method for detecting switching status.

[0029] For details, please refer to Figure 2 , Figure 2 This application illustrates a switching assembly 200 according to an embodiment of the present application. Specifically, Figure 2 The switch assembly 200 shown includes a main control module 240, a transmitting module 220, a receiving module 230, and a switch unit 210, wherein the main control module 240 is connected to the transmitting module 220 and the receiving module 230 respectively.

[0030] In some implementations, the transmitting module 220 corresponds to a detection area 221, and the transmitting module 220 can transmit optical signals to the detection area 221. Specifically, the transmitting module 220 can transmit optical signals to the detection area 221 under the control of the main control module 240. It is easy to understand that optical signals can generally be divided into visible light signals and invisible light signals. Visible light signals are those with wavelengths in the range of 380nm to 780nm, while invisible light signals are those with wavelengths less than 380nm or greater than 780nm. Light signals with wavelengths less than 380nm are ultraviolet (UV) light signals, and light signals with wavelengths greater than 780nm are infrared (IR) light signals. Furthermore, since the energy and wavelength of an optical signal have an inverse correlation—that is, the longer the wavelength of the optical signal, the lower the corresponding energy, and the shorter the wavelength of the optical signal, the higher the corresponding energy—in one implementation provided in this application, the transmitting module 220 can transmit infrared (IR) signals, thereby reducing power consumption. Furthermore, the transmitting module 220 can transmit optical signals at a specified frequency, that is, the control module can control the transmitting module 220 to transmit optical signals at specified intervals, wherein the specified frequency and the specified duration are reciprocals of each other.

[0031] In some implementations, the switching unit 210 can have different switching states, and the user can control the switching unit 210 to be in different switching states. As an example, the switching unit 210 can have at least two switching states. Furthermore, the main control module 240 can detect the current switching state of the switching unit 210. In other implementations, after determining the current switching state of the switching unit 210, the main control module 240 can also control the electronic device to operate in a target operating state based on the current switching state, wherein the target operating state is determined based on the current switching state. Specific methods can be found in the description of subsequent embodiments.

[0032] Furthermore, each different switching state of the switching unit 210 can correspond to a reflective surface. Therefore, for the switching unit 210 described above, which has at least two switching states, there should be at least two reflective surfaces corresponding to these at least two switching states. The reflective surface can be used to reflect the incident light signal. The light signal incident on the reflective surface can be called the incident light signal; after being reflected by the reflective surface, it forms a reflected light signal. The intensity parameter of the reflected light signal is less than or equal to the intensity parameter of the incident light signal. The intensity parameter can be used to characterize the energy intensity of the light signal, for example, it can be a power value. It is easy to understand that the reflective surface has a reflection parameter, which is an inherent parameter used to characterize the degree to which the reflective surface reflects the incident light signal. Wherein, with the incident light signal remaining constant, the reflection parameter and the intensity parameter are positively correlated; that is, the larger the reflection parameter, the stronger the reflection of the incident light signal by the reflective surface, and therefore the larger the intensity parameter of the reflected light signal; conversely, the smaller the reflection parameter, the weaker the reflection of the incident light signal by the reflective surface, and therefore the smaller the intensity parameter of the reflected light signal. For example, the reflection parameter can be reflectivity; the higher the reflectivity, the closer the power values ​​of the reflected light signal and the incident light signal. Therefore, different switching states can be set, corresponding to different reflection parameters of the reflective surface. That is, by emitting a light signal with the same intensity parameter to the reflective surface, reflected light signals with different intensity parameters can be obtained, thereby determining the current switching state of the switching unit 210. For specific methods, please refer to the description of the following embodiments.

[0033] Furthermore, as the foregoing analysis shows, the transmitting module 220 can transmit light signals to the detection area 221. To ensure that the light signals transmitted by the transmitting module 220 to the detection area 221 are incident on the reflective surface corresponding to the current switching state of the switching unit 210, the reflective surface within the detection area 221 can have different reflectivities depending on the switching state of the switching unit 210. This allows the light signals emitted by the transmitting unit to be reflected by reflective surfaces with different reflection parameters under different switching states. For example, the switching states of the switching unit 210 can include a first state, a second state, and a third state, where the first state corresponds to the first reflective surface 211, the second state corresponds to the second reflective surface 212, and the third state corresponds to the third reflective surface 213. When the current switching state of the switching unit 210 is the first state, the reflective surface located in the detection area 221 is the first reflective surface 211, and the light signal emitted by the transmitting module 220 can be reflected by the first reflective surface 211. When the current switching state of the switching unit 210 is the second state, the reflective surface located in the detection area 221 is the second reflective surface 212, and the light signal emitted by the transmitting module 220 can be reflected by the second reflective surface 212. When the current switching state of the switching unit 210 is the third state, the reflective surface located in the detection area 221 is the third reflective surface 213, and the light signal emitted by the transmitting module 220 can be reflected by the third reflective surface 213.

[0034] In some implementations, the receiving module 230 can be used to receive optical signals. In the implementation provided in this application, the receiving module 230 can be used to receive the optical signals reflected by the reflective surface within the detection area 221. It is easy to understand that the main control module 240 generally cannot directly receive optical signals. Therefore, the receiving module 230 can convert the received optical signals into electrical signals, for example, by using a photoelectric converter to convert the received optical signals into electrical signals, and then send the electrical signals to the main control module 240. The main control module 240 then processes and organizes the electrical signals to determine the intensity parameters corresponding to the optical signals received by the receiving module 230. Based on these intensity parameters, the current switching state of the switching unit 210 can be determined.

[0035] It should be noted that since the optical signal received by the receiving module 230 is related to the optical signal emitted by the transmitting module 220, the wavelength of the optical signal that the receiving module 230 can receive should match the wavelength of the optical signal emitted by the transmitting module 220. As described above, the optical signal emitted by the transmitting module 220 can be an infrared (IR) signal; therefore, the receiving module 230 should be a module capable of receiving infrared (IR) signals. As an example, the transmitting module 220 can be an infrared (IR) emitting diode, and the receiving module 230 can be an infrared (IR) receiving diode.

[0036] Furthermore, the transmitting module 220 and the receiving module 230 can be two separate modules, such as the infrared IR emitting diode and the infrared IR receiving diode mentioned above. Alternatively, they can be two modules in a single unit, for example, the infrared IR emitting diode and the infrared IR receiving diode can both be included in the infrared light sensor.

[0037] Optionally, the transmitting module 220 may also include multiple infrared (IR) emitting diodes, and the receiving module 230 may also include multiple infrared (IR) receiving diodes, thereby improving the reliability of the operation of the transmitting module 220 and the receiving module 230.

[0038] For an example, please refer to Figure 3 , Figure 3 A schematic diagram of a transmitting module and a receiving module is shown. Specifically, the positive terminal of the infrared (IR) emitting diode 220 is connected to the power supply terminal 224, and the negative terminal is connected to the ground terminal 225. The driving circuit 222 is connected to the register 223 and the negative terminal of the infrared (IR) emitting diode 220. The register 223 is also connected to the power supply terminal 224 and the analog-to-digital converter (ADC) module 228. The ADC module 228 is also connected to an infrared (IR) receiving diode 230, a crystal oscillator 227, the power supply terminal 224, and a reference voltage 226. The transmission parameters of the infrared (IR) emitting diode 220, such as transmission power and transmission frequency, can be set through the register 223. Specifically, the register 223 controls the infrared (IR) emitting diode 220 through the driving circuit 222. Furthermore, the crystal oscillator 227 provides a clock signal to the ADC module 228, and the reference voltage 226 provides a reference voltage value to the ADC module 228. The infrared (IR) receiving diode 230 receives the light signal and transmits it to the ADC module 228.

[0039] It should be noted that the above-mentioned transmitting module 220 and receiving module 230 are only examples. Other components can also be used to drive the transmitting module 220 to transmit optical signals and the receiving module 230 to receive optical signals.

[0040] Furthermore, the main control module 240 can be used to control the transmitting module 220 to transmit optical signals, for example, by controlling the transmitting module 220 to transmit optical signals at specified time intervals. The main control module 240 can also process the optical signals reflected from the reflective surface within the detection area 221 received by the receiving module 230, thereby obtaining the intensity parameters of the optical signals reflected from the reflective surface within the detection area 221. As an example, the main control module 240 can process the acquired signal received by the receiving module 230 to obtain the power value of the signal received by the receiving module 230. Furthermore, the main control module 240 can also determine the current state of the control switch using this power parameter. Specific methods for obtaining the control switch state can be found in subsequent embodiments.

[0041] The main control module 240 can be implemented using at least one of the following hardware forms: Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), Programmable Logic Array (PLA), and Microcontroller Unit (MCU).

[0042] Please see Figure 4 , Figure 4 This application illustrates a switching unit 210 provided in an embodiment of the present application. Specifically, Figure 4 The switch unit 210 shown includes a sliding component 218 and a reflective component 219.

[0043] In some implementations, the reflective component 219 can be disposed on the sliding component 218, so the reflective component 219 can move along with the sliding component 218, that is, the sliding component 218 can drive the reflective component 219 to move. As can be seen from the foregoing embodiments, the switching unit 210 can include at least two switching states, and the user can control the switching unit 210 to be in different switching states. For details, please continue reading. Figure 4 The sliding component 218 is provided with a slider 217, which allows the user to slide the switch unit 210 to different switching states.

[0044] Furthermore, since the user needs to slide the switch unit 210 to put it into different switching states, for a switch unit 210 with at least two switching states, the sliding component 218 corresponds to at least two travel positions, each travel position corresponding to one switching state, and the number of travel positions should be greater than or equal to the number of switching states. For example, if there are three switching states, the sliding component 218 corresponds to at least three travel positions.

[0045] Furthermore, the reflective assembly 219 may include multiple reflective surfaces. As described in the foregoing embodiments, the switching state of the switching unit 210 should correspond to the reflective surfaces; therefore, the number of reflective surfaces included in the reflective assembly 219 should be the same as the number of switching states of the switching unit 210. For example, if the switching unit 210 has three switching states, then the reflective assembly 219 should include three reflective surfaces. Please refer to [link to relevant documentation]. Figure 4 The reflective component 219 includes a first reflective surface 211, a second reflective surface 212, and a third reflective surface 213.

[0046] As can be seen from the foregoing embodiments, in order to reflect the light signal emitted by the transmitting unit through reflective surfaces with different reflection parameters under different switching states, it is necessary that when the sliding component 218 is at different travel positions, i.e., when the switching unit 210 is in different switching states, the different reflective surfaces of the reflective component 219 are located within the detection area 221. Please refer to the following: Figure 4 , Figure 5 as well as Figure 6 , Figure 4 , Figure 5 as well as Figure 6 The shown switch unit 210 includes three switching states, specifically, a first state, a second state, and a third state. The first state corresponds to the first reflective surface 211, the second state corresponds to the second reflective surface 212, and the third reflective surface 213 corresponds to the third reflective surface 214. Therefore, the travel positions of the sliding component 218 can be the first position, the second position, and the third position. For an example, please refer to [reference needed]. Figure 4 When the sliding component 218 is in the first position, the switching unit 210 can be in the first state, at which time the first reflective surface 211 corresponding to the first state is located within the detection area 221. Please continue reading. Figure 5 When the sliding component 218 is in the second position, the switching unit 210 can be in the second state, at which time the second reflective surface 212 corresponding to the second state is located within the detection area 221. Please continue reading. Figure 6 When the sliding component 218 is in the third position, the switch unit 210 can be in the third state, and the third reflective surface 213 corresponding to the third state is located in the detection area 221.

[0047] In some implementations, the reflection parameters of the first reflective surface 211, the second reflective surface 212, and the third reflective surface 213 are different. As an example, the reflection parameters of the first reflective surface 211, the second reflective surface 212, and the third reflective surface 213 can be increased sequentially. When the reflection parameter is reflectivity, that is, the reflectivity of the first reflective surface 211, the second reflective surface 212, and the third reflective surface 213 can be increased sequentially.

[0048] It should be noted that, in some other implementations, the reflection parameters of the first reflective surface 211, the second reflective surface 212, and the third reflective surface 213 may also decrease sequentially or have other relationships.

[0049] Optionally, since reflective surfaces of different colors can have different reflectivities, the first reflective surface 211, the second reflective surface 212, and the third reflective surface 213 can achieve different reflectivities by setting different colors. Specifically, the black reflective surface has a lower reflectivity, the white reflective surface has a higher reflectivity, and the reflectivity of the gray reflective surface is generally between that of the white reflective surface and the black reflective surface. As an example, the first reflective surface 211 can be a black reflective surface, the second reflective surface 212 can be a gray reflective surface, and the third reflective surface 213 can be a white reflective surface.

[0050] Optionally, reflective surfaces of different shapes can have different reflectivities. Therefore, the first reflective surface 211, the second reflective surface 212, and the third reflective surface 213 can have different shapes, such as convex, concave, or planar. As an example, the first reflective surface 211 can be concave, the second reflective surface 212 can be convex, and the third reflective surface 213 can be planar.

[0051] Optionally, the first reflective surface 211, the second reflective surface 212, and the third reflective surface 213 can be made of the same material, which can be a material with high transmittance and low reflectance. Then, a coating is applied to each reflective surface, for example, a reflective film, to improve the reflectivity of each reflective surface. Specifically, the reflectivity of different reflective surfaces can be adjusted by changing the reflectivity of the reflective film, thereby achieving different reflectivities for reflective surfaces corresponding to different switching states. For example, if the reflectivity of the uncoated reflective surface is 10%, a reflective film with a lower reflectivity can be coated on the first reflective surface 211, thereby slightly increasing the reflectivity of the first reflective surface 211. For example, the reflectivity of the first reflective surface 211 after coating with the reflective film is 20%. A reflective film with a higher reflectivity can be coated on the second reflective surface 212, thereby significantly increasing the reflectivity of the second reflective surface 212. For example, the reflectivity of the second reflective surface 212 after coating with the reflective film is 40%. A reflective film with a very high reflectivity can be coated on the third reflective surface 213, thereby significantly increasing the reflectivity of the third reflective surface 213. For example, the reflectivity of the third reflective surface 213 after coating with the reflective film is 60%.

[0052] Optionally, since transmittance and reflectance are inversely related for the same reflective surface, an antireflective coating can be deposited on a material with high reflectance to increase transmittance and thus reduce reflectance. Therefore, in the example above, the same material for the first reflective surface 211, the second reflective surface 212, and the third reflective surface 213 can also be a material with low transmittance and high reflectance. Then, a coating, such as an antireflective coating, is applied to each reflective surface to reduce its reflectance. Specifically, the reflectance of different reflective surfaces can be adjusted by changing the antireflective coating, thereby achieving different reflectances for reflective surfaces corresponding to different switching states. For example, if the reflectivity of the uncoated reflective surface is 90%, an antireflective film with higher transmittance can be coated on the first reflective surface 211, thereby increasing the transmittance of the first reflective surface 211 more and decreasing its reflectivity more. For example, the reflectivity of the first reflective surface 211 after coating with the antireflective film is 20%. An antireflective film with generally high transmittance can be coated on the second reflective surface 212, thereby increasing the transmittance of the second reflective surface more and decreasing its reflectivity more. For example, the reflectivity of the second reflective surface 212 after coating with the antireflective film is 40%. An antireflective film with lower transmittance can be coated on the third reflective surface 213, thereby increasing the transmittance of the first reflective surface less and decreasing the reflectivity of the second reflective surface 212 less. For example, the reflectivity of the second reflective surface 212 after coating with the antireflective film is 60%.

[0053] Optionally, the first reflective surface 211, the second reflective surface 212, and the third reflective surface 213 may also be made of different materials, and the reflective surfaces made of different materials may have different reflectivities. For example, the first reflective surface 211 may be made of a first material and have a low reflectivity, such as 20%; the second reflective surface 212 may be made of a second material and have a general reflectivity, such as 40%; and the third reflective surface 213 may be made of a third material and have a high reflectivity, such as 60%.

[0054] The switching assembly provided in this application includes a transmitting module, a main control module, a receiving module, and a switching unit. The transmitting module emits light signals to a detection area. Each switching state in the switching unit corresponds to a reflective surface. The reflective surface located within the detection area differs depending on the switching state of the switching unit, and the reflection parameters of these different reflective surfaces are different. The receiving module receives the light signals reflected by the reflective surfaces within the detection area. The main control module acquires the intensity parameters corresponding to the light signals received by the receiving module and determines the current switching state of the switching unit based on these intensity parameters. Since the reflective surfaces within the detection area differ depending on the switching state of the switching assembly, and these different reflective surfaces have different reflection parameters, the reflective parameters of the reflective surfaces in the detection area differ when the switching unit is in different switching states. Therefore, the light signals reflected by the reflective surfaces within the detection area received by the receiving module will also differ, thus changing the intensity parameters corresponding to the light signals received by the receiving module and allowing the main control module to determine the current switching state of the switching unit. Furthermore, since light signals are not easily interfered with by factors such as magnetic fields, the determination of the current switching state of the switching unit in this application has high accuracy.

[0055] Please see Figure 7 , Figure 7 This diagram illustrates the structure of an electronic device 300 according to an embodiment of this application. The electronic device 300 includes a mid-frame 310 and a switch assembly 200.

[0056] Specifically, the switch assembly 200 may include a main control module 240, a transmitting module 220, a receiving module 230, and a switch unit 210. The switch unit 210 may include a sliding component 218 and a reflective component 219, which are connected. Therefore, the reflective component 219 can move along with the sliding component 218, and the sliding component 218 can drive the reflective component 219 to move. Furthermore, a slider 217 may be provided on the sliding component 218, and the sliding component 218 may be exposed on the surface of the middle frame 310. In some embodiments, the slider 217 on the sliding component 218 may be exposed on the surface of the middle frame 310, thereby allowing the user to move the sliding component 218 by sliding the slider 217, thus placing the switch unit in different switching states, and simultaneously driving the reflective component 219 to move.

[0057] In one embodiment provided in this application, the sliding component 218 can have three corresponding travel positions, and the reflective component 219 can include three reflective surfaces: a first reflective surface 211, a second reflective surface 212, and a third reflective surface 213. Each travel position corresponds to a switching state of the switching unit 210, and therefore each switching state can correspond to a reflective surface. When the switching unit 210 is in different switching states, the reflective surfaces within the detection area 221 are different. Since different reflective surfaces have different reflection parameters, the light signals reflected by the reflective surfaces within the detection area 221 received by the receiving module 230 will also be different, thus changing the intensity parameters corresponding to the light signals received by the receiving module 230 and acquired by the main control module 240. Therefore, the current switching state of the switching unit 210 can be determined based on the intensity parameters.

[0058] The specific functions of the main control module 240, the transmitting module 220, the receiving module 230, and the switching unit 210 can be found in the descriptions in the foregoing embodiments, and will not be repeated here.

[0059] Please continue reading. Figure 7The middle frame 310 can form a cavity 311, within which a transmitting module 220, a receiving module 230, and a reflector 219 can be installed. Specifically, the cavity 311 can include a first cavity 3111 and a second cavity 3112, where the reflector 219 can be located within the first cavity 3111, and the transmitting module 220 and the receiving module 230 can be located within the second cavity 3112. Furthermore, since the transmitting module 220 can transmit optical signals—specifically, the reflector 219 can transmit optical signals—the optical signals transmitted by the transmitting module 220 need to be transmitted from the second cavity 3112 to the first cavity 3111. Therefore, an optical channel 3113 can also exist between the second cavity 3112 and the first cavity 3111, whereby the optical channel 3113 can be used to transmit optical signals. Furthermore, the light signal emitted by the transmitting module 220 located in the second cavity 3112 can enter the first cavity 3111 through the optical channel 3113. Specifically, it can be incident on the reflector 219 located in the first cavity 3111, and after being reflected by the reflector 219, it enters the second cavity 3112 through the optical channel 3113 and is received by the receiving module 230 located in the second cavity 3112.

[0060] Optionally, a plate 320 is further disposed between the first cavity 3111 and the second cavity 3112. The plate 320 can be disposed within the middle frame 310. The plate 320 has a through hole 321, with the first cavity 3111 and the second cavity 3112 connected to its two sides respectively. Therefore, in some embodiments, the through hole 321 can serve as an optical channel 3113 for transmitting optical signals between the first cavity 3111 and the second cavity 3112. The area where the through hole 321 extends vertically to the reflective component 219 serves as a detection area 221. Therefore, the optical signal emitted by the transmitting module 220 towards the detection area 221 can be incident on the reflective surface within the detection area 221. An exemplary embodiment... Figure 7 In the illustrated electronic device 300, the reflective surface within the detection area 221 is the second reflective surface 212. Therefore, the light signal emitted by the transmitting module 220 into the detection area 221 can be incident on the second reflective surface 212 within the detection area 221, and then reflected by the second reflective surface 212 before being received by the receiving module 230.

[0061] Optional, please continue reading Figure 7 , Figure 7In the illustrated electronic device 300, a circuit board 3114 may also be disposed within the second cavity 3112, wherein both the transmitting module 220 and the receiving module 230 are mounted on the circuit board 3114. In some embodiments, the main control module 240 may also be mounted on the circuit board 3114, thereby enabling the main control module 240 to be connected to both the transmitting module 220 and the receiving module 230 via the circuit board 3114. As an example, the circuit board 3114 may be a flexible printed circuit (FPC).

[0062] Optionally, to enable the transmitting module 220 to transmit optical signals to the detection area 221 and the receiving module 230 to receive optical signals reflected from the reflective surface of the detection area 221, a light guide post can be provided between the transmitting module 220 and the receiving module 230 and the detection area 221. This allows the optical signals emitted by the transmitting module 220 to be coupled into the detection area 221 through the light guide post, and the optical signals reflected from the reflective surface of the detection area 221 to be coupled into the receiving module 230 through the light guide post. For details, please refer to [further details]. Figure 7 , Figure 7 In the illustrated electronic device 300, a light guide post 330 can be disposed on the end face 321 of the plate 320 facing the second cavity 3112. The light guide post 330 includes a first light-transmitting area 331 and a second light-transmitting area 332, both of which allow light signals to pass through without attenuating the power parameters of the light signal. Furthermore, the first light-transmitting area 331 and the second light-transmitting area 332 are spaced apart and both located at the through-hole 321. The area of ​​the light guide post other than the first and second light-transmitting areas 331 and 332 is a light-shielding area; that is, the area between the first and second light-transmitting areas 331 and 332 is also a light-shielding area. The light-shielding area cannot allow light signals to pass through.

[0063] Therefore, the light signal emitted by the transmitting module 220 can sequentially pass through the first light-transmitting area 331 and the light channel 3113 into the first cavity 3111. The light signal reflected by the reflective component 219 in the first cavity 3111 is the light signal reflected by the reflective surface of the reflective component 219 located in the detection area 221. Then, it is received by the receiving module 330 through the light channel 3113 and the second light-transmitting area 332.

[0064] Furthermore, to prevent moisture or dust in the air from entering the switch assembly 200 through the middle frame 310, thereby affecting the transmission and detection of the optical signal and further impacting the accuracy of detecting the switching state of the switch unit, please refer to [further details needed]. Figure 7Waterproof adhesive 340 can also be filled between the end face 321 of the plate 320 facing the second cavity 3112 and the light guide post 330.

[0065] Furthermore, to ensure that the optical signal emitted by the transmitting module 220 is reflected by the reflector 219 before being received by the receiving module 230, instead of a portion of the optical signal being directly coupled into the receiving module 230 when the transmitting module 220 emits an optical signal, an optical isolation module 350 can be provided within the second cavity 3112 between the transmitting module 220 and the receiving module 230. The optical isolation module 350 can prevent the receiving module 230 from directly coupling the optical signal emitted by the transmitting module 220, thereby improving the accuracy of determining the current switching state of the switching unit based on the optical signal reflected from the reflective surface within the detection area 221 received by the receiving module.

[0066] Please see Figure 8 , Figure 8 A flowchart of a switch state detection method provided in this application is shown. This switch state detection method can be applied to the main control module in the switch assembly in the foregoing embodiments. The switch assembly further includes a transmitting module, a receiving module, and a switching unit. The main control module is connected to the transmitting module and the receiving module, respectively. Specifically, the switch state detection method includes steps S110 to S140.

[0067] Step S110: Control the transmitting module to transmit a first signal to the current reflective surface of the switching unit at a first power value.

[0068] In some implementations, the main control module controls the transmitting module to emit a first signal after the electronic device is powered on. As described above, this first signal can be an optical signal, such as an infrared (IR) light signal. Specifically, the control module can automatically control the transmitting module to emit the first signal after the electronic device is powered on. As an example, the control module can control the transmitting module to emit the optical signal at a specified frequency, where the specified frequency can be flexibly set as needed, and this application does not limit the specific frequency.

[0069] Furthermore, the light signal emitted by the transmitting module is incident on the current reflective surface, which is the reflective surface corresponding to the current switching state of the switching unit. The switching unit includes at least two switching states, each corresponding to a reflective surface, and each reflective surface has different reflection parameters. For details, please refer to the description in the aforementioned embodiments, which will not be repeated here. For the same first signal, the first signal reflected by reflective surfaces with different reflectivities will be different; therefore, the current switching state of the switching unit can be determined based on the first signal reflected by the current reflective surface.

[0070] Specifically, each time the first signal is transmitted, the first signal can be transmitted with a first power value, thereby measuring the power value of the first signal reflected by the current reflective surface. Based on the difference between the measured power value and the first power value, the current reflective surface can be determined, and the current switching state of the switching unit can be determined based on the current reflective surface.

[0071] Step S120: Obtain the second power value of the second signal, the second signal including the first signal received by the receiving module and reflected by the current reflective surface.

[0072] After the transmitting module emits the first signal, the receiving module can receive the second signal, which is the first signal reflected by the current reflective surface; that is, the second signal is also an optical signal. Further, as the above analysis shows, to determine the current reflective surface, it is necessary to obtain the second power value of the second signal. In some implementations, the second power value can be calculated using an optical power measurement module. For example, after receiving the second signal, the receiving module can send it as an optical signal to the optical power measurement module. This module can receive the second signal, calculate the second power value, and then send the second power value to the main control module as an electrical signal. In other implementations, after receiving the second signal, the receiving module can generate a third signal using an analog-to-digital converter (ADC) module. This third signal represents the second signal as an electrical signal, and is then sent to the main control module. The main control module then calculates the power value of the third signal based on a pre-set algorithm, where the power value of the third signal is the second power value corresponding to the second signal. For an example, please refer to [link to example]. Figure 9 The main control module can generate based on the third signal. Figure 9 The incident light irradiance diagram shown is as follows, in which, Figure 9 The x-axis represents the range of the photosensitive element in the receiving module for receiving the second signal in the first direction, and the y-axis represents the range of the photosensitive element in the receiving module for receiving the second signal in the second direction. When x is positive, it represents the position of the photosensitive element offset by x in the first direction; when x is negative, it represents the position of the photosensitive element offset by x in the opposite direction. Similarly, when y is positive, it represents the position of the photosensitive element offset by y in the second direction; when y is negative, it represents the position of the photosensitive element offset by y in the opposite direction. For example, when both the x-axis and y-axis coordinates are 0, the corresponding point is the center point of the photosensitive element. The units for both the x-axis and y-axis are millimeters. The coordinate graph defined by the x-axis and y-axis also includes multiple points, each of which can have a color, such as red, green, or blue. Different colors correspond to different irradiance levels, where the unit of irradiance is watts per square meter (W / m²). 2Irradiance can be used to characterize the amount of power per unit area. For example, irradiance can be represented by changing from red to blue, indicating a decrease from high to low, where red represents irradiance of 1000 W / m². 2 The blue color represents an irradiance of 3.16228 x 10⁻⁶. -7 W / m2. Therefore, all points in the coordinates represented by the x-axis and y-axis correspond to the optical signals of the second signal received by the receiving module. Furthermore, the main control module can be based on... Figure 9 For each point, the second power value of the second signal is calculated. As exemplarily, as described above, the reflection parameters of the first, second, and third reflective surfaces can increase sequentially. Therefore, in the embodiments shown in this application, for the same first power value, the second power of the second signal obtained after reflection from the first reflective surface should be the lowest, the second power of the second signal obtained after reflection from the second reflective surface should be moderate, and the second power of the second signal obtained after reflection from the third reflective surface should be the highest. For example, the second power obtained after reflection from the first reflective surface is 1.07 nW, the second power obtained after reflection from the second reflective surface is 7.48 nW, and the second power obtained after reflection from the third reflective surface is 10.38 nW, where nW is the unit of power, nanowatt.

[0073] Step S130: Determine the current switching state of the switching unit based on the second power value.

[0074] In some implementations, after obtaining the second power value, the reflective surface currently reflecting the first signal can be determined based on the difference between the second power value and the first power value, and then the corresponding switching state can be determined according to the reflective surface. Specifically, the reflection parameters of the first reflective surface, the second reflective surface, and the third reflective surface can be predetermined, for example, 20%, 40%, and 60% respectively, and the first reflective surface can be determined to correspond to the first state, the second reflective surface to the second state, and the third reflective surface to the third state. Then, after obtaining the second power value, the ratio of the second power value to the first power value can be obtained. When the ratio is 20%, it can be determined that the second signal is the first signal reflected by the first reflective surface, and thus the current switching state of the switching component can be determined to be the first state. When the ratio is 40% or 60%, the determination method is similar, and will not be described in detail here.

[0075] In other implementations, at least two threshold ranges can be predetermined, each corresponding to a switching state. The switching state of the current switching component can then be determined based on the threshold range in which the second power value falls. It is readily understood that the number of threshold ranges should be roughly equivalent to the number of switching states. For example, in the embodiments provided in this application, if there are three switching states, then there should be three threshold ranges, such as a first threshold range, a second threshold range, and a third threshold range.

[0076] Specifically, the electronic device can be pre-controlled to enter a setting mode to set a threshold range. Once in setting mode, the switching unit can be controlled to sequentially enter different switching states. In each switching state, the transmitting module is controlled to transmit a first signal at a first power value, and then the second power values ​​of multiple second signals are acquired. For example, when the switching unit is in the first state, the first signal can be transmitted at the first power value, and the second power value of the second signal can be acquired. The specific acquisition method can be found in the previous description and will not be repeated here; for example, it could be 1nW. At this point, a specified deviation value can be set based on the current second power value, such that the second power value deviates from the specified deviation range, which is the first threshold range. For example, if the specified deviation range is set to 0.1nW, then the first threshold range can be determined to be 0.9nW to 1.1nW. Similarly, the second and third threshold ranges can be determined, which will not be repeated here. After determining the first, second, and third threshold ranges, the setting mode can be exited.

[0077] Furthermore, if the currently acquired second power value is within the first threshold range, the current switching state of the switching unit can be determined to be the first state; similarly, when the second power value is within the second threshold range, the current switching state of the switching unit can be determined to be the second state; when the second power value is within the third threshold range, the current switching state of the switching unit can be determined to be the third state.

[0078] Step S140: Based on the current switching state of the switching unit, control the electronic device to operate in the target working state.

[0079] Optionally, after determining the current switching state of the switching unit, in some other implementations, the electronic device can also be controlled to operate in a target operating state based on the current switching state. For example, the target operating state could be maximum display brightness or a silent state, etc. For details, please refer to... Figure 10 , Figure 10 A diagram illustrating one embodiment of step S140 is shown, including steps S141 to S143.

[0080] Step S141: If the current switching state of the switching unit is the first state, control the electronic device to operate in the ringing state.

[0081] Step S142: If the current switching state of the switching unit is the second state, control the electronic device to operate in the vibration state.

[0082] Step S143: If the current switching state of the switching unit is the third state, control the electronic device to operate in the silent state.

[0083] In some implementations, the target operating state may include a ringing state, a vibration state, or a silent state. It can be pre-set that when the current switching state of the switch unit is the first state, the electronic device is controlled to operate in the ringing state; when the current switching state of the switch unit is the second state, the electronic device is controlled to operate in the vibration state; and when the current switching state of the switch unit is the third state, the electronic device is controlled to operate in the silent state. Therefore, the user can quickly control the electronic device to operate in a target state by controlling the switch assembly to place the switch unit in different switching states.

[0084] It is easy to understand that the target operating state mentioned above can also include other states, and the correspondence between the target operating state and the switch state can also be flexibly set as needed.

[0085] The switch state detection method provided in this application can be applied to the main control module of the switch assembly in the aforementioned embodiments. This switch assembly further includes a transmitting module, a receiving module, and a switch unit. First, the transmitting module is controlled to transmit a first signal to the current reflective surface of the switch unit at a first power value. Then, a second power value of the second signal is acquired. Finally, based on the second power value, the current switch state of the switch unit is determined. Since the reflective surface in the detection area differs under different switch states of the switch assembly, and different reflective surfaces have different reflection parameters, the reflection parameters of the reflective surface in the detection area differ when the switch unit is in different switch states. Therefore, the second signal reflected by the reflective surface in the detection area received by the receiving module will also differ, thus changing the second power value acquired by the main control module. Therefore, the current switch state of the switch unit can be determined based on the second power value. Furthermore, since optical signals are not easily interfered with by factors such as magnetic fields, determining the switch state through the second power value of the second signal has high accuracy.

[0086] Please refer to Figure 11 This diagram illustrates a structural block diagram of a computer-readable storage medium provided in an embodiment of this application. The computer-readable medium 1100 stores program code that can be called by a processor to execute the methods described in the above method embodiments.

[0087] The computer-readable storage medium 1100 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. Optionally, the computer-readable storage medium 1100 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 1100 has storage space for program code 1110 that performs any of the method steps described above. This program code can be read from or written to one or more computer program products. The program code 1110 may, for example, be compressed in a suitable form.

[0088] Please refer to Figure 12 The diagram illustrates a structural block diagram 1200 of a computer program product provided in an embodiment of this application. The computer program product 1200 includes a computer program / instructions 1210, which, when executed by a processor, implements the steps of the aforementioned method.

[0089] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A switching assembly, characterized in that, It includes a main control module, a transmitting module, a receiving module, and a switching unit, wherein the main control module is connected to both the transmitting module and the receiving module. The transmitting module has a corresponding detection area and is used to transmit optical signals to the detection area. The switching unit includes at least two switching states, a sliding component, and a reflective component. Each switching state corresponds to a reflective surface, and different reflective surfaces have different reflection parameters. The reflective surface located within the detection area is different in different switching states. The sliding component is used to move the reflective component. The sliding component has at least two travel positions, and each travel position corresponds to a switching state. The reflective component includes multiple reflective surfaces, and each reflective surface is independent of the others. At different travel positions, the different reflective surfaces of the reflective component are all located within the detection area. The reflection parameter is reflectivity, and different reflective surfaces have different reflectivities. The receiving module is used to receive the light signal reflected by the reflective surface in the detection area; The main control module is used to obtain the intensity parameter corresponding to the optical signal received by the receiving module, and determine the current switching state of the switching unit based on the intensity parameter. The intensity parameter is a power value, and the power value is positively correlated with the reflectivity.

2. The switching assembly according to claim 1, characterized in that, Both the switch state and the reflective surface are three in number, and the three reflective surfaces are a black reflective surface, a gray reflective surface, and a white reflective surface.

3. An electronic device, characterized in that, include: The middle frame and the switch assembly as described in claim 1 or 2, wherein the switch assembly is disposed in the middle frame.

4. The electronic device according to claim 3, characterized in that, The switching unit includes a sliding component and a reflective component. The sliding component is connected to the reflective component and is used to drive the reflective component to move. The transmitting module, the receiving module, and the reflective component are installed in the cavity formed by the middle frame, and the sliding component is exposed on the surface of the middle frame.

5. The electronic device according to claim 4, characterized in that, The cavity formed by the middle frame includes a first cavity and a second cavity. An optical channel is provided between the first cavity and the second cavity. The reflective component is located in the first cavity, and the transmitting module and the receiving module are located in the second cavity. The light signal emitted by the transmitting module enters the first cavity through the optical channel, is reflected by the reflective component in the first cavity, and is received by the receiving module through the optical channel.

6. The electronic device according to claim 5, characterized in that, A plate is provided between the first cavity and the second cavity. The plate is provided with a through hole, which serves as the light channel. The through hole extends vertically to the area of ​​the reflective component, which serves as the detection area.

7. The electronic device according to claim 6, characterized in that, A circuit board is disposed inside the second cavity. The transmitting module and the receiving module are both mounted on the circuit board. A light guide post is disposed on the end face of the circuit board facing the second cavity. The light guide post includes a first light-transmitting area and a second light-transmitting area. The first light-transmitting area and the second light-transmitting area are spaced apart and are both located at the through hole. The area of ​​the light guide post other than the first light-transmitting area and the second light-transmitting area is a light-blocking area. The light signal emitted by the transmitting module passes through the first light-transmitting area and the light channel in sequence and enters the first cavity. The light signal reflected by the reflective component in the first cavity passes through the light channel and the second light-transmitting area in sequence and is received by the receiving module.

8. The electronic device according to claim 7, characterized in that, Waterproof adhesive is used to fill the space between the end face of the plate facing the second cavity and the light guide post.

9. The electronic device according to claim 8, characterized in that, An optical isolation module is provided between the transmitting module and the receiving module. The optical isolation module is used to prevent the receiving module from directly coupling the optical signal emitted by the transmitting module.

10. A method for detecting switch status, characterized in that, Applied to the switching assembly as described in claim 1 or 2, the method includes: The transmitting module is controlled to transmit a first signal to the current reflective surface of the switching unit at a first power value; Obtain a second power value of a second signal, the second signal including the first signal received by the receiving module and reflected by the current reflective surface; Based on the second power value, the current switching state of the switching unit is determined.

11. The method according to claim 10, characterized in that, Also includes: Based on the current switching state of the switching unit, the electronic device is controlled to operate in the target working state.

12. The method according to claim 11, characterized in that, The current switching state of the switching unit includes a first state, a second state, or a third state; the target operating state includes a ringing state, a vibration state, or a silent state; and controlling the electronic device to operate in the target operating state based on the current switching state of the switching unit includes: If the current switching state of the switching unit is the first state, control the electronic device to operate in the ringing state; If the current switching state of the switching unit is the second state, control the electronic device to operate in the vibration state; If the current switching state of the switching unit is the third state, the electronic device is controlled to operate in the silent state.