WO2021110117A1 - 事件订阅方法及电子设备 - Google Patents

事件订阅方法及电子设备 Download PDF

Info

Publication number
WO2021110117A1
WO2021110117A1 PCT/CN2020/133787 CN2020133787W WO2021110117A1 WO 2021110117 A1 WO2021110117 A1 WO 2021110117A1 CN 2020133787 W CN2020133787 W CN 2020133787W WO 2021110117 A1 WO2021110117 A1 WO 2021110117A1
Authority
WO
WIPO (PCT)
Prior art keywords
event
event source
subscription
information
electronic device
Prior art date
Application number
PCT/CN2020/133787
Other languages
English (en)
French (fr)
Inventor
李若昆
杨启彬
余涛
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2021110117A1 publication Critical patent/WO2021110117A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W8/00Network data management
    • H04W8/18Processing of user or subscriber data, e.g. subscribed services, user preferences or user profiles; Transfer of user or subscriber data
    • H04W8/20Transfer of user or subscriber data
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L5/00Arrangements affording multiple use of the transmission path

Definitions

  • This application relates to the field of terminal technology, and in particular to an event subscription method and electronic equipment.
  • the event mechanism is to distribute the events generated by the event producer to interested consumers for processing, so as to achieve the purpose of decoupling the producer and the consumer.
  • the addition and deletion of consumers does not affect the producer.
  • the addition and deletion of users does not affect consumers.
  • Event producers are also called event sources or publishers, and consumers are also called subscribers.
  • subscribers in the applications often need to pay attention to a large number of events.
  • the logical channel for transmitting events between the event source and the subscriber depends on the physical channel of the entity.
  • the embodiments of the present invention provide an event subscription method and electronic device, which are intended to solve the technical problem that a large number of physical channels of an event mechanism consume too many system resources in related technologies.
  • an embodiment of the present invention provides an event subscription method, including: querying the IPC information of the event source in the event source information set; establishing a logical channel with the event source based on the IPC information; When the connection mode of is the non-direct connection mode, the logical channel is set on the first physical channel, and the first physical channel is subscribed to the event by subscribers other than the current subscriber in the subscriber process The physical channel used by the event of the source; send subscription information to the event source through the logical channel established on the first physical channel; through the logical channel established on the first physical channel Channel, receiving the event fed back by the event source for the subscription information.
  • the subscriber in the electronic device queries the IPC information of the event source in the event source manager with the event source information collection.
  • the subscriber in the electronic device establishes a logical channel with the event source through the channel manager based on the IPC information.
  • the channel manager sets the logical channel on the first physical channel, and the first physical channel is the other in the subscriber process to which the subscriber belongs The physical channel used by the subscriber to subscribe to the event of the event source.
  • the subscriber in the electronic device sends subscription information to the event source through the logical channel established on the first physical channel.
  • the subscriber in the electronic device receives the event fed back by the event source for the subscription information through the logical channel established on the first physical channel.
  • connection mode of the logical channel is the direct connection mode
  • a second physical channel is newly created; the logical channel is set on the second physical channel.
  • the subscriber in the electronic device creates a second physical channel when the connection mode of the logical channel is the direct connection mode.
  • the subscriber in the electronic device sets the logical channel on the second physical channel.
  • the method before the step of querying the IPC information of the event source in the event source information set, the method further includes: when any event source is initialized, storing the event source information of any event source To the event source information set, where the event source information includes an event source ID, a list of supported events, and the IPC information.
  • the event source manager has an event source information collection, wherein the event source information includes the event source ID, a list of supported events, and the IPC information.
  • the event source includes a local device event source and/or a cross-device event source.
  • Subscribers in the electronic device can subscribe to the event source of the device and/or the cross-device event source.
  • event source information when the local device event source and the cross-device event source are initialized, their event source information will be stored in the event source information collection of the electronic device where they are located, and event source managers of different electronic devices synchronize the event source information.
  • the step of querying the IPC information of the event source in the event source information collection includes: querying the first event source to which the event to be subscribed belongs in the event source information collection; determining the current subscription authority Whether the first predetermined condition is satisfied; based on the fact that the current subscription right meets the first predetermined condition, the IPC information of the first event source is queried in the event source information set.
  • the event source manager of the electronic device queries its own event source information collection for the first event source to which the event to be subscribed belongs.
  • the event source manager of the electronic device determines whether the current subscription authority of the subscriber meets the first predetermined condition.
  • the event source manager of the electronic device queries the event source information set for the IPC information of the first event source, and sends it to the subscriber for The subscriber establishes a logical channel with the first event source according to the IPC information to subscribe and receive events.
  • the first predetermined condition is: the current subscription permission is greater than or equal to the subscription permission of the to-be-subscribed event, and/or the current subscription permission is greater than or equal to the first The subscribeable permission of the event source.
  • the step of querying the IPC information of the event source in the event source information collection includes: querying the event source information collection for a second event source that meets a predetermined filtering rule; and judging the current subscription authority Whether the second predetermined condition is met; based on the situation that the current subscription right meets the second predetermined condition, the IPC information of the second event source is queried in the event source information set.
  • the event source manager of the electronic device searches its own event source information collection for the second event source that meets the predetermined screening rule.
  • the event source manager of the electronic device determines whether the current subscription authority of the subscriber meets the second predetermined condition.
  • the event source manager of the electronic device queries the event source information set for the IPC information of the second event source, and sends it to the subscriber for The subscriber establishes a logical channel with the second event source according to the IPC information to subscribe and receive events.
  • the second predetermined condition is: the current subscription permission is greater than or equal to the subscription permission of the event to be subscribed in the second event source, and/or the current subscription permission is greater than or Equal to the subscribeable permission of the second event source.
  • an embodiment of the present invention provides an event subscription device, including: an IPC information query module, used to query the IPC information of the event source in the event source information collection; a logical channel establishment module, used to based on the IPC information
  • a logical channel is established with the event source; a physical channel setting module is used to set the logical channel on the first physical channel when the connection mode of the logical channel is in the non-direct connection mode.
  • a physical channel is the physical channel used by subscribers other than the current subscriber in the subscriber process to subscribe to the event of the event source; the event subscription module is used to pass the first physical channel established on the first physical channel.
  • the logical channel sends subscription information to the event source; the event receiving module is configured to receive the event fed back by the event source for the subscription information through the logical channel established on the first physical channel.
  • it further includes: a physical channel creation module, which is used to create a second physical channel when the connection mode of the logical channel is the direct connection mode; the physical channel setting module is also used to: The logical channel is arranged on the second physical channel.
  • an event source information storage module which is used to initialize any event source before the IPC information query module queries the IPC information of the event source.
  • the event source information of the source is stored in the event source information collection, where the event source information includes an event source ID, a list of supported events, and the IPC information.
  • the IPC information query module includes: a first event source query module for querying the first event source to which the event to be subscribed belongs in the event source information set; and a first judgment module for To determine whether the current subscription authority meets a first predetermined condition; the first execution module is configured to query the first event source in the event source information set based on the situation that the current subscription authority meets the first predetermined condition IPC information.
  • the first predetermined condition is: the current subscription permission is greater than or equal to the subscription permission of the to-be-subscribed event, and/or the current subscription permission is greater than or equal to the first The subscribeable permission of the event source.
  • the IPC information query module includes: a second event source query module, configured to query a second event source that meets a predetermined screening rule in the event source information set; and a second judgment module, using To determine whether the current subscription authority meets a second predetermined condition; the second execution module is configured to query the second event source in the event source information set based on the situation that the current subscription authority meets the second predetermined condition IPC information.
  • the second predetermined condition is: the current subscription permission is greater than or equal to the subscription permission of the event to be subscribed in the second event source, and/or the current subscription permission is greater than or Equal to the subscribeable permission of the second event source.
  • the event source includes a local device event source and/or a cross-device event source.
  • an embodiment of the present invention provides an electronic device, including: at least one processor; and, a memory communicatively connected with the at least one processor; wherein the memory stores the memory that can be processed by the at least one processor;
  • the instruction executed by the device, the instruction is configured to execute the method according to any one of the above-mentioned first aspects.
  • an embodiment of the present invention provides a computer-readable storage medium that stores computer-executable instructions, and the computer-executable instructions are used to execute the method procedures described in any one of the above-mentioned first aspects.
  • an embodiment of the present invention provides a computer program product, which when the computer program product runs on an electronic device, causes the electronic device to execute the method process described in any one of the above-mentioned first aspects.
  • multiple subscribers in the same process realize the multiplexing of physical channels, which greatly reduces the number of physical channels that need to be established, thereby reducing the consumption of system resources and facilitating the system to provide effective resources to Other processes improve the effective utilization of system resources and work efficiency as a whole.
  • Fig. 1 shows a schematic structural diagram of an electronic device involved in this application.
  • Figure 2 shows a flowchart of an event subscription method provided by an embodiment of the present invention
  • FIG. 3 shows a schematic diagram of the principle of subscribing to events for a multiplexed physical channel according to an embodiment of the present invention
  • FIG. 4 shows a schematic diagram of the principle of subscribing to an event through a cross-device multiplexing physical channel according to an embodiment of the present invention
  • Fig. 5 shows a schematic block diagram of an event subscription apparatus provided by an embodiment of the present invention.
  • Event refers to the content executed by the electronic device. For example, user operations such as mouse click, mouse drag, and keyboard input performed on the interface of the electronic device.
  • Event source The object that generated the event. For example, when the mouse is clicked on a button, an event is generated, and this button is the source of the event.
  • Subscriber The object that receives the event, for example, an application in an electronic device. Subscribers can subscribe to events in the event source. When the event occurs in the event source, the event will be sent to subscribers who have subscribed to the event.
  • Fig. 1 shows a schematic structural diagram of an electronic device involved in this application.
  • the electronic device may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, and a battery 142, Antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, earphone jack 170D, sensor 180, button 190, motor 191, indicator 192, camera 193, display Screen 194, and subscriber identification module (SIM) card interface 195, etc.
  • SIM subscriber identification module
  • the electronic device may include more or fewer components than those shown in the figure, or combine certain components, or split certain components, or arrange different components.
  • the smart TV does not need to be provided with one or more of the SIM card interface 195, the camera 193, the button 190, the receiver 170B, the microphone 170C, and the earphone interface 170D.
  • the illustrated components can be implemented in hardware, software, or a combination of software and hardware.
  • the processor 110 may include one or more processing units.
  • the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), and an image signal processor. (image signal processor, ISP), controller, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU), etc.
  • the different processing units may be independent devices or integrated in one or more processors.
  • the electronic device may also include one or more processors 110.
  • the controller can be the nerve center and command center of the electronic device. The controller can generate operation control signals according to the instruction operation code and timing signals to complete the control of fetching instructions and executing instructions.
  • a memory may also be provided in the processor 110 to store instructions and data.
  • the memory in the processor 110 is a cache memory.
  • the memory can store instructions or data that have just been used or recycled by the processor 110. If the processor 110 needs to use the instruction or data again, it can be directly called from the memory. This avoids repeated access and reduces the waiting time of the processor 110, thereby improving the efficiency of the electronic device.
  • the processor 110 may include one or more interfaces.
  • the interface can include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, and a universal asynchronous transmitter (universal asynchronous) interface.
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • UART universal asynchronous transmitter
  • MIPI mobile industry processor interface
  • GPIO general-purpose input/output
  • SIM subscriber identity module
  • USB Universal Serial Bus
  • the USB interface 130 is an interface that complies with the USB standard specification, and specifically may be a Mini USB interface, a Micro USB interface, a USB Type C interface, and so on.
  • the USB interface 130 can be used to connect a charger to charge the electronic device, can also be used to transfer data between the electronic device and the peripheral device, and can also be used to connect a headset to play audio through the headset.
  • the interface connection relationship between the modules illustrated in the embodiment of the present invention is merely a schematic description, and does not constitute a structural limitation of the electronic device.
  • the electronic device may also adopt different interface connection modes in the foregoing embodiments, or a combination of multiple interface connection modes.
  • the charging management module 140 is used to receive charging input from the charger.
  • the charger can be a wireless charger or a wired charger.
  • the charging management module 140 may receive the charging input of the wired charger through the USB interface 130.
  • the charging management module 140 may receive the wireless charging input through the wireless charging coil of the electronic device. While the charging management module 140 charges the battery 142, it can also supply power to the electronic device through the power management module 141.
  • the power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110.
  • the power management module 141 receives input from the battery 142 and/or the charge management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, and the wireless communication module 160.
  • the power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle times, and battery health status (leakage, impedance).
  • the power management module 141 may also be provided in the processor 110.
  • the power management module 141 and the charging management module 140 may also be provided in the same device.
  • the wireless communication function of the electronic device can be realized by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, and the baseband processor.
  • the antenna 1 and the antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in an electronic device can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization.
  • Antenna 1 can be multiplexed as a diversity antenna of a wireless local area network.
  • the antenna can be used in combination with a tuning switch.
  • the mobile communication module 150 can provide a wireless communication solution including 2G/3G/4G/5G and the like applied to electronic devices.
  • the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier, and so on.
  • the mobile communication module 150 can receive electromagnetic waves by the antenna 1, and perform processing such as filtering, amplifying and transmitting the received electromagnetic waves to the modem processor for demodulation.
  • the mobile communication module 150 can also amplify the signal modulated by the modem processor, and convert it into electromagnetic waves for radiation via the antenna 1.
  • at least part of the functional modules of the mobile communication module 150 may be provided in the processor 110.
  • at least part of the functional modules of the mobile communication module 150 and at least part of the modules of the processor 110 may be provided in the same device.
  • the modem processor may include a modulator and a demodulator.
  • the modulator is used to modulate the low frequency baseband signal to be sent into a medium and high frequency signal.
  • the demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal.
  • the demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing.
  • the application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.), or displays an image or video through the display screen 194.
  • the modem processor may be an independent device.
  • the modem processor may be independent of the processor 110 and be provided in the same device as the mobile communication module 150 or other functional modules.
  • the wireless communication module 160 can provide applications on electronic devices including wireless local area networks (WLAN), Bluetooth, global navigation satellite system (GNSS), frequency modulation (FM), NFC, infrared Technology (infrared, IR) and other wireless communication solutions.
  • the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 160 receives electromagnetic waves via the antenna 2, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110.
  • the wireless communication module 160 may also receive a signal to be sent from the processor 110, perform frequency modulation, amplify, and convert it into electromagnetic waves to radiate through the antenna 2.
  • the antenna 1 of the electronic device is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the electronic device can communicate with the network and other devices through wireless communication technology.
  • the wireless communication technology may include GSM, GPRS, CDMA, WCDMA, TD-SCDMA, LTE, GNSS, WLAN, NFC, FM, and/or IR technology.
  • the aforementioned GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), Beidou navigation satellite system (BDS), quasi-zenith satellite system (quasi- Zenith satellite system, QZSS) and/or satellite-based augmentation systems (SBAS).
  • the electronic device can realize the display function through GPU, display screen 194, and application processor.
  • the GPU is a microprocessor for image processing, connected to the display 194 and the application processor.
  • the GPU is used to perform mathematical and geometric calculations and is used for graphics rendering.
  • the processor 110 may include one or more GPUs, which execute instructions to generate or change display information.
  • the display screen 194 is used to display images, videos, and the like.
  • the display screen 194 includes a display panel.
  • the display panel can use liquid crystal display (LCD), organic light-emitting diode (OLED), active matrix organic light-emitting diode or active-matrix organic light-emitting diode (active-matrix organic light-emitting diode).
  • LCD liquid crystal display
  • OLED organic light-emitting diode
  • active-matrix organic light-emitting diode active-matrix organic light-emitting diode
  • AMOLED flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diode (QLED), etc.
  • the electronic device may include one or N display screens 194, and N is a positive integer greater than one.
  • the electronic device can realize the shooting function through an ISP, a camera 193, a video codec, a GPU, one or more display screens 194, and an application processor.
  • the ISP is used to process the data fed back from the camera 193. For example, when taking a picture, the shutter is opened, the light is transmitted to the photosensitive element of the camera through the lens, the light signal is converted into an electrical signal, and the photosensitive element of the camera transmits the electrical signal to the ISP for processing and is converted into an image visible to the naked eye.
  • ISP can also optimize the image noise, brightness, and skin color. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene.
  • the ISP may be provided in the camera 193.
  • the camera 193 is used to capture still images or videos.
  • the object generates an optical image through the lens and is projected to the photosensitive element.
  • the photosensitive element may be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor.
  • CMOS complementary metal-oxide-semiconductor
  • the photosensitive element converts the optical signal into an electrical signal, and then transfers the electrical signal to the ISP to convert it into a digital image signal.
  • ISP outputs digital image signals to DSP for processing.
  • DSP converts digital image signals into standard RGB, YUV and other formats of image signals.
  • the electronic device 100 may include one or N cameras 193, and N is a positive integer greater than one.
  • Digital signal processors are used to process digital signals. In addition to digital image signals, they can also process other digital signals. For example, when the electronic device 100 selects the frequency point, the digital signal processor is used to perform Fourier transform on the energy of the frequency point.
  • Video codecs are used to compress or decompress digital video.
  • the electronic device 100 may support one or more video codecs. In this way, the electronic device 100 can play or record videos in multiple encoding formats, such as: moving picture experts group (MPEG) 1, MPEG2, MPEG3, MPEG4, and so on.
  • MPEG moving picture experts group
  • MPEG2 MPEG2, MPEG3, MPEG4, and so on.
  • NPU is a neural-network (NN) computing processor.
  • NN neural-network
  • applications such as intelligent cognition of electronic devices can be realized, such as: image recognition, face recognition, voice recognition, text understanding, etc.
  • the external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device.
  • the external memory card communicates with the processor 110 through the external memory interface 120 to realize the data storage function. For example, save music, photos, videos and other data files in an external memory card.
  • the internal memory 121 may be used to store one or more computer programs, and the one or more computer programs include instructions.
  • the processor 110 can run the above-mentioned instructions stored in the internal memory 121 to enable the electronic device to execute the voice switching method, various functional applications, and data processing provided in some embodiments of the present application.
  • the internal memory 121 may include a storage program area and a storage data area. Among them, the storage program area can store the operating system; the storage program area can also store one or more application programs (such as a gallery, contacts, etc.) and so on.
  • the data storage area can store data (such as photos, contacts, etc.) created during the use of the electronic device.
  • 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 magnetic disk storage device, a flash memory device, a universal flash storage (UFS), and the like.
  • the processor 110 may execute the instructions stored in the internal memory 121 and/or the instructions stored in the memory provided in the processor 110 to cause the electronic device to execute the voice provided in the embodiments of the present application. Switching methods, and various functional applications and data processing.
  • the electronic device can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor. For example, music playback, recording, etc.
  • the audio module 170 is used to convert digital audio information into an analog audio signal for output, and also used to convert an analog audio input into a digital audio signal.
  • the audio module 170 can also be used to encode and decode audio signals.
  • the audio module 170 may be provided in the processor 110, or part of the functional modules of the audio module 170 may be provided in the processor 110.
  • the speaker 170A also called “speaker” is used to convert audio electrical signals into sound signals.
  • the electronic device can listen to music through the speaker 170A, or listen to a hands-free call.
  • the receiver 170B also called “earpiece” is used to convert audio electrical signals into sound signals.
  • the electronic device answers a call or voice message, it can receive the voice by bringing the receiver 170B close to the human ear.
  • the microphone 170C also called “microphone”, “microphone”, is used to convert sound signals into electrical signals.
  • the user can make a sound by approaching the microphone 170C through the human mouth, and input the sound signal into the microphone 170C.
  • the electronic device may be provided with at least one microphone 170C. In other embodiments, the electronic device may be provided with two microphones 170C, which can realize noise reduction function in addition to collecting sound signals. In other embodiments, the electronic device may also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, and realize directional recording functions.
  • the earphone interface 170D is used to connect wired earphones.
  • the earphone interface 170D can be a USB interface 130, a 3.5mm open mobile terminal platform (OMTP) standard interface, or a cellular telecommunications industry association of the USA (CTIA) Standard interface.
  • OMTP open mobile terminal platform
  • CTIA cellular telecommunications industry association of the USA
  • the sensor 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and an ambient light sensor 180L , Bone conduction sensor 180M and so on.
  • the pressure sensor 180A is used to sense a pressure signal, and can convert the pressure signal into an electrical signal.
  • the pressure sensor 180A may be provided on the display screen 194.
  • the capacitive pressure sensor may include at least two parallel plates with conductive materials. When a force is applied to the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device determines the strength of the pressure based on the change in capacitance. When a touch operation acts on the display screen 194, the electronic device detects the intensity of the touch operation according to the pressure sensor 180A.
  • the electronic device may also calculate the touched position based on the detection signal of the pressure sensor 180A.
  • touch operations that act on the same touch position but have different touch operation strengths may correspond to different operation instructions. For example: when a touch operation whose intensity of the touch operation is less than the first pressure threshold is applied to the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, an instruction to create a new short message is executed.
  • the gyro sensor 180B can be used to determine the movement posture of the electronic device.
  • the angular velocity of the electronic device around three axes ie, x, y, and z axes
  • the gyro sensor 180B can be used for image stabilization.
  • the gyroscope sensor 180B detects the angle of the shake of the electronic device, calculates the distance that the lens module needs to compensate according to the angle, and allows the lens to counteract the shake of the electronic device through a reverse movement to achieve anti-shake.
  • the gyro sensor 180B can also be used for navigation, somatosensory game scenes and so on.
  • the acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device in various directions (generally three axes). When the electronic device is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of electronic devices, and apply to applications such as horizontal and vertical screen switching, pedometers, etc.
  • Distance sensor 180F used to measure distance.
  • Electronic equipment can measure distance through infrared or laser.
  • the electronic device may use the distance sensor 180F to measure the distance to achieve fast focusing.
  • the proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector such as a photodiode.
  • the light emitting diode may be an infrared light emitting diode.
  • the electronic device emits infrared light to the outside through the light-emitting diode.
  • Electronic devices use photodiodes to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device. When insufficient reflected light is detected, the electronic device can determine that there is no object near the electronic device.
  • the electronic device can use the proximity light sensor 180G to detect that the user holds the electronic device close to the ear to talk, so as to automatically turn off the screen to save power.
  • the proximity light sensor 180G can also be used in leather case mode, and the pocket mode will automatically unlock and lock the screen.
  • the ambient light sensor 180L is used to sense the brightness of the ambient light.
  • the electronic device can adaptively adjust the brightness of the display screen 194 according to the perceived brightness of the ambient light.
  • 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 electronic device is in the pocket to prevent accidental touch.
  • the fingerprint sensor 180H (also called a fingerprint reader) is used to collect fingerprints. Electronic devices can use the collected fingerprint characteristics to unlock fingerprints, access application locks, take photos with fingerprints, and answer calls with fingerprints. In addition, other descriptions of the fingerprint sensor can be found in the international patent application PCT/CN2017/082773 entitled “Method and Electronic Equipment for Processing Notification", the entire content of which is incorporated in this application by reference.
  • the touch sensor 180K can also be called a touch panel.
  • the touch sensor 180K may be disposed on the display screen 194, and the touch screen is composed of the touch sensor 180K and the display screen 194, which is also called a touch screen.
  • the touch sensor 180K is used to detect touch operations acting on or near it.
  • the touch sensor can pass the detected touch operation to the application processor to determine the type of touch event.
  • the visual output related to the touch operation can be provided through the display screen 194.
  • the touch sensor 180K may also be disposed on the surface of the electronic device, which is different from the position of the display screen 194.
  • the bone conduction sensor 180M can acquire vibration signals.
  • the bone conduction sensor 180M can obtain the vibration signal of the vibrating bone mass of the human voice.
  • the bone conduction sensor 180M can also contact the human pulse and receive the blood pressure pulse signal.
  • the bone conduction sensor 180M may also be provided in the earphone, combined with the bone conduction earphone.
  • the audio module 170 can parse the voice signal based on the vibration signal of the vibrating bone block of the voice obtained by the bone conduction sensor 180M, and realize the voice function.
  • the application processor can analyze the heart rate information based on the blood pressure beating signal obtained by the bone conduction sensor 180M, and realize the heart rate detection function.
  • the button 190 includes a power-on button, a volume button, and so on.
  • the button 190 may be a mechanical button or a touch button.
  • the electronic device can receive key input, and generate key signal input related to user settings and function control of the electronic device.
  • the motor 191 can generate vibration prompts.
  • the motor 191 can be used for incoming call vibration notification, and can also be used for touch vibration feedback.
  • touch operations applied to different applications can correspond to different vibration feedback effects.
  • Acting on touch operations in different areas of the display screen 194, the motor 191 can also correspond to different vibration feedback effects.
  • Different application scenarios for example: time reminding, receiving information, alarm clock, games, etc.
  • the touch vibration feedback effect can also support customization.
  • the indicator 192 may be an indicator light, which may be used to indicate the charging status, power change, or to indicate messages, missed calls, notifications, and so on.
  • the SIM card interface 195 is used to connect to the SIM card.
  • the SIM card can be inserted into the SIM card interface 195 or pulled out from the SIM card interface 195 to achieve contact and separation with the electronic device.
  • the electronic device can support 1 or N SIM card interfaces, and N is a positive integer greater than 1.
  • the SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, etc.
  • the same SIM card interface 195 can insert multiple cards at the same time. The types of the multiple cards can be the same or different.
  • the SIM card interface 195 can also be compatible with different types of SIM cards.
  • the SIM card interface 195 may also be compatible with external memory cards.
  • the electronic device interacts with the network through the SIM card to realize functions such as call and data communication.
  • the electronic device adopts an eSIM, that is, an embedded SIM card.
  • the eSIM card can be embedded in the electronic device and cannot be separated from the electronic device.
  • an embodiment of the present application provides an event subscription method, which is executed on the electronic device where the subscriber, the event source manager, and the channel manager are located, and the method includes:
  • Step 102 The subscriber in the electronic device queries the IPC information of the event source in the event source manager.
  • the electronic device includes an event source manager, and the event source information collection is stored in the event source manager.
  • any event source in the electronic device when any event source in the electronic device is initialized, its event source information is registered and stored in the event source manager of the electronic device. Referring to FIG. 3, the event source 202 of the electronic device 200 and The event source 204 uploads the event source information to the event source manager 206 of the electronic device during initialization.
  • the event source information includes event source ID, supported event list and IPC information.
  • the event source identification information indicates the identity of the event source.
  • the supported event list records the events that can be generated by the event source.
  • IPC (Inter-Process Communication) information includes the communication mode supported by the event source, the IP address of the electronic device to which the event source belongs, and the port number of the event source.
  • the IP address of the electronic device to which the event source belongs and the port number of the event source indicate the location of the event source.
  • Subscribers who subscribe to an event in an event source can access the electronic device to which the event source belongs through the IP address of the electronic device to which the event source belongs, find the port number of the event source in the electronic device, access the port corresponding to the port number, and Subscribe to the event source and receive events from the event source through the port through the communication mode supported by the event source.
  • any subscriber in the subscriber process of any application in the electronic device can query the IPC information of the required event source in the event source information collection of the event source manager.
  • Step 104 The subscriber in the electronic device establishes a logical channel with the event source through the channel manager based on the IPC information.
  • the electronic device 200 has a channel manager 208 and a subscriber 210.
  • the channel manager 208 establishes a logical channel for the two.
  • the logical channel is used for the event source 202 and the subscriber 210.
  • the abstract entity used by the subscriber 210 is carried by the physical channel of the entity.
  • the physical channel is a specific physical connection, such as a tcp connection, a udp connection, or a pipe connection.
  • One physical channel has the ability to carry multiple logical channels.
  • Step 106 When the connection mode of the logical channel is the non-direct connection mode, the channel manager sets the logical channel on the first physical channel, and the first physical channel is subscribed by other subscribers in the subscriber process to which the subscriber belongs The physical channel used by the event of the event source.
  • one physical channel has the ability to carry multiple logical channels, in the non-direct connection mode, when multiple subscribers in a process connect to the same event source, the logical channels of multiple subscribers can be established on the same physical channel , Replacing the technical solution of establishing a physical channel for each subscriber to carry its logical channel in related technologies.
  • the subscriber process includes at least a subscriber 212 and a subscriber 214, and the three use logical channel 1, logical channel 2, and logical channel 3 to connect to the event source 202 respectively. These three logical channels are all established on the physical channel 4 between the subscriber process and the event source 202.
  • Step 108 The subscriber in the electronic device sends subscription information to the event source through the logical channel established on the first physical channel.
  • Step 110 The subscriber in the electronic device receives the event fed back by the event source for the subscription information through the logical channel established on the first physical channel.
  • the subscription information includes the subscriber ID and a list of the events that the subscriber subscribes to.
  • the subscriber sends the subscription information to the event source, and the event source can send the events subscribed by the subscriber to the subscriber ID to realize the delivery of the event.
  • connection mode of the logical channel is the direct connection mode
  • the subscriber in the electronic device creates a second physical channel and sets the logical channel on the second physical channel.
  • connection mode of the logical channel is the direct connection mode
  • the same physical channel is not reused between different subscribers, so a new physical channel can be established for the subscribers in the direct connection mode.
  • the event source includes local device event sources and/or cross-device event sources.
  • the event source 204 of the electronic device 200 can be subscribed by the subscriber 302, the subscriber 310, and the subscriber 312 of the electronic device 300, and the subscriber 302, the subscriber 310, and the subscriber 312 respectively use the logic in the channel manager 306 Channel 5, logical channel 6, and logical channel 7, and logical channel 5, logical channel 6, and logical channel 7 are multiplexed with physical channel 8.
  • the subscriber 302 of the electronic device 300 inquires the IPC information of the event source 204 in the event source manager 304 of the electronic device 300.
  • the subscriber 302 of the electronic device 300 establishes a logical channel with the event source 204 through the channel manager 306 of the electronic device 300 based on the IPC information of the event source 204, and establishes the logical channel in the process where the subscriber 302 is located and the event source 204 has been established
  • cross-device event sources and multiple subscribers can reuse the same physical channel for event subscription and delivery.
  • the device event source and the cross-device event source When the device event source and the cross-device event source are initialized, they will store their own event source information in the event source information collection of the electronic device where they are located, and the event source managers of different electronic devices synchronize the event source information collection. Therefore, subscribers in the electronic device can subscribe to the event source of the device and/or the cross-device event source.
  • the event source manager of the electronic device queries its own event source information collection for the first event source to which the event to be subscribed belongs.
  • the event source manager of the electronic device determines whether the current subscription authority of the subscriber meets the first predetermined condition.
  • the event source manager of the electronic device queries the IPC information of the first event source in the event source information set, and sends it to the subscriber for the subscriber to compare the IPC information with the first An event source establishes a logical channel to subscribe and receive events.
  • the subscriber can send an event subscription request to the event source manager, and the event subscription request can specify the event to be subscribed or the event source to which the event belongs.
  • the event source manager of the electronic device determines whether the subscriber has the qualification to subscribe to the event to be subscribed and/or to subscribe to the first event source. Specifically, it may determine whether the current subscription authority of the subscriber meets the first predetermined condition, and The first predetermined condition is the minimum condition that the subscriber needs to satisfy for the current subscription authority under the condition that the subscriber has the qualification to subscribe to the event to be subscribed and/or to subscribe to the first event source.
  • the first predetermined condition is: the current subscription authority is greater than or equal to the subscribeable authority of the event to be subscribed, and/or the current subscription authority is greater than or equal to the subscribeable authority of the first event source.
  • the current subscription authority refers to the subscriber's own subscription authority.
  • the level of subscription authority represents the trustworthiness of the subscriber, and the subscription authority of the event to be subscribed represents the lowest subscription authority that can be trusted for the event to be subscribed.
  • the first event source The subscription rights of represents the lowest subscription rights that the first event source can trust.
  • the subscriber's own subscription authority is greater than or equal to the subscription authority of the event to be subscribed, it can be determined that the subscriber has reached the lowest level that can be trusted by the event to be subscribed.
  • the subscriber's own subscription authority is greater than or equal to the subscribeable authority of the first event source, it can be determined that the subscriber has reached the lowest level that can be trusted by the first event source.
  • the subscriber's own subscription authority is greater than or equal to the subscribeable authority of the event to be subscribed, and the subscriber's own subscription authority is greater than or equal to the subscribeable authority of the first event source, it can be determined that the subscriber has reached the subscribeable authority. The lowest level of mutual trust between the event to be subscribed and the first event source.
  • the event source manager of the electronic device searches its own event source information collection for the second event source that meets the predetermined screening rule.
  • the event source manager of the electronic device determines whether the current subscription authority of the subscriber meets the second predetermined condition.
  • the event source manager of the electronic device queries the IPC information of the second event source in the event source information set, and sends it to the subscriber for the subscriber to compare the IPC information with the first Second, the event source establishes a logical channel to subscribe and receive events.
  • the subscriber can send an event subscription request to the event source manager.
  • the event subscription request does not specify the event to be subscribed or the event source to which the event belongs, but specifies the predetermined filtering rules, or the event subscription request does not specify the event to be subscribed
  • the event source to which the event or the event to be subscribed belongs, but depends on the predetermined filtering rules in the event source manager to filter out the event source of the required subscription event from the multiple event sources in the event source manager.
  • the predetermined screening rules can be flexibly set according to actual needs.
  • the predetermined filtering rule can also be any other filtering conditions that can be flexibly set according to actual needs.
  • the event source manager of the electronic device determines whether the subscriber has the qualification to subscribe to the event to be subscribed and/or subscribes to the first event source. Specifically, it may determine whether the current subscription authority of the subscriber meets the second predetermined condition, and The second predetermined condition is the minimum condition that the subscriber needs to satisfy for the current subscription authority under the condition that the subscriber has the qualification to subscribe to the event to be subscribed and/or to subscribe to the first event source.
  • the second predetermined condition is: the current subscription authority is greater than or equal to the subscribeable authority of the event to be subscribed in the second event source, and/or the current subscription authority is greater than or equal to the subscribeable authority of the second event source Permissions.
  • the current subscription authority is the subscriber's own subscription authority.
  • the level of the subscription authority represents the trustworthiness of the subscriber, and the subscription authority of the event to be subscribed represents the lowest subscription authority that can be trusted for the event to be subscribed.
  • the second event source The subscription rights of represents the lowest subscription rights that the second event source can trust.
  • the subscriber's own subscription authority is greater than or equal to the subscription authority of the event to be subscribed, it can be determined that the subscriber has reached the lowest level that can be trusted by the event to be subscribed.
  • the subscriber's own subscription authority is greater than or equal to the subscribeable authority of the second event source, it can be determined that the subscriber has reached the lowest level that can be trusted by the second event source.
  • the subscriber's own subscription authority is greater than or equal to the subscribeable authority of the event to be subscribed, and the subscriber's own subscription authority is greater than or equal to the subscribeable authority of the second event source, it can be determined that the subscriber has reached the subscribeable authority. The lowest level of mutual trust between the event to be subscribed and the second event source.
  • Fig. 5 shows a schematic block diagram of an event subscription apparatus provided by an embodiment of the present invention.
  • an embodiment of the present invention provides an event subscription device 500, including: an IPC information query module 502, used to query the IPC information of the event source in the event source information set; logical channel establishment module 504, used based on the The IPC information establishes a logical channel with the event source; a physical channel setting module 506 is used to set the logical channel on the first physical channel when the connection mode of the logical channel is in the non-direct connection mode , The first physical channel is a physical channel used by subscribers other than the current subscriber in the subscriber process to subscribe to the event of the event source; the event subscription module 508 is used to establish a physical channel on the first physical channel The logical channel above, sending subscription information to the event source; the event receiving module 510, configured to receive the event source for the subscription through the logical channel established on the first physical channel Information feedback event.
  • it further includes: a physical channel creation module, which is used to create a second physical channel when the connection mode of the logical channel is the direct connection mode; the physical channel setting module is also used to: The logical channel is arranged on the second physical channel.
  • an event source information storage module which is used to initialize any event source before the IPC information query module 502 queries the IPC information of the event source.
  • the event source information of the event source is stored in the event source information collection, where the event source information includes an event source ID, a support event list, and the IPC information.
  • the IPC information query module 502 includes: a first event source query module, configured to query the first event source to which the event to be subscribed belongs in the event source information set; and a first judgment module, Used to determine whether the current subscription right meets the first predetermined condition; the first execution module is used to query the first event in the event source information set based on the situation that the current subscription right meets the first predetermined condition IPC information of the source.
  • the first predetermined condition is: the current subscription permission is greater than or equal to the subscription permission of the to-be-subscribed event, and/or the current subscription permission is greater than or equal to the first The subscribeable permission of the event source.
  • the IPC information query module 502 includes: a second event source query module, configured to query a second event source that meets a predetermined screening rule in the event source information set; and a second judgment module, Used to determine whether the current subscription right meets the second predetermined condition; the second execution module is used to query the second event in the event source information set based on the situation that the current subscription right meets the second predetermined condition IPC information of the source.
  • the second predetermined condition is: the current subscription permission is greater than or equal to the subscription permission of the event to be subscribed in the second event source, and/or the current subscription permission is greater than or Equal to the subscribeable permission of the second event source.
  • the event source includes a local device event source and/or a cross-device event source.
  • the event subscription device 500 uses the solution described in any one of FIG. 1 to FIG. 4, and therefore, has all the above technical effects, which will not be repeated here.
  • embodiments of the present application further provide a computer-readable storage medium that stores instructions in the computer-readable storage medium, and when the instructions run on an electronic device, the electronic device executes The event subscription method described in any of the foregoing implementation manners.
  • the embodiment of the present application further provides a computer program product, which when the computer program product runs on an electronic device, causes the electronic device to execute the event subscription method as described in any of the foregoing implementation manners.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
  • the computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • the computer instructions may be transmitted from a website, computer, server, or data center.
  • the computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or a data center integrated with one or more available media.
  • the usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, and a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk).
  • first, second, etc. may be used to describe XXX in the embodiments of the present invention, these XXX should not be limited to these terms. These terms are only used to distinguish XXX from each other.
  • the first XXX may also be referred to as the second XXX, and similarly, the second XXX may also be referred to as the first XXX.

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Databases & Information Systems (AREA)
  • Telephone Function (AREA)

Abstract

本发明提出了一种事件订阅方法及电子设备,该方法包括:在事件源信息集合中查询事件源的IPC信息;基于IPC信息与事件源建立逻辑通道;在逻辑通道的连接模式为非直连模式的情况下,将逻辑通道设置于第一物理通道之上,第一物理通道为本订阅者进程内当前订阅者以外的其他订阅者订阅事件源的事件所使用的物理通道;通过建立于第一物理通道之上的逻辑通道,向事件源发送订阅信息;通过建立于第一物理通道之上的逻辑通道,接收事件源针对订阅信息反馈的事件。通过本发明的技术方案,同一进程内的多个订阅者实现了物理通道的复用,大量减少了所需建立的物理通道的数量,整体提升了系统资源的有效利用率和工作效率。

Description

事件订阅方法及电子设备
本申请要求于2019年12月06日提交中国专利局、申请号为201911243475.2、申请名称为“事件订阅方法及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及终端技术领域,尤其涉及一种事件订阅方法及电子设备。
背景技术
在计算机系统中,事件机制是为了将事件生产者产生的事件分发给感兴趣的消费者进行处理,达到生产者与消费者解耦的目的,消费者的新增和删除不影响生产者,生产者(可以有多个)的新增和删除也不影响消费者。事件生产者也被称为事件源或发布者,消费者也被称为订阅者。随着智能终端的发展,用户手中的移动智能设备、智能家居设备越来越多,各类应用程序也层出不穷,应用程序中的订阅者往往需要关注大量事件。事件源与订阅者之间传输事件的逻辑信道依赖于实体的物理信道。
然而,电子设备中存在着海量的事件,如位置信息变化,设备电量状态变化、时间变动、网络状态变化等,同样,对海量事件进行订阅的订阅者分布在各个应用中,为实现事件机制的顺利运行,每个订阅者与其订阅有事件的事件源间均建立有物理信道,这就导致需建立大量物理通道。大量物理通道的建立会造成大量系统开销,占用了过多的系统资源,进而抢占系统中其他对象的资源,影响系统的整体工作效率。
因此,如何减少事件机制的物理通道所占用的系统资源,成为目前亟待解决的技术问题。
发明内容
本发明实施例提供了一种事件订阅方法及电子设备,旨在解决相关技术中事件机制的大量物理通道消耗过多系统资源的技术问题。
第一方面,本发明实施例提供了一种事件订阅方法,包括:在事件源信息集合中查询事件源的IPC信息;基于所述IPC信息与所述事件源建立逻辑通道;在所述逻辑通道的连接模式为非直连模式的情况下,将所述逻辑通道设置于第一物理通道之上,所述第一物理通道为本订阅者进程内当前订阅者以外的其他订阅者订阅所述事件源的事件所使用的物理通道;通过建立于所述第一物理通道之上的所述逻辑通道,向所述事件源发送订阅信息;通过建立于所述第一物理通道之上的所述逻辑通道,接收所述事件源针对所述订阅信息反馈的事件。
其中,电子设备中的订阅者在具有事件源信息集合的事件源管理器中查询事件源 的IPC信息。
电子设备中的订阅者基于所述IPC信息通过通道管理器与所述事件源建立逻辑通道。
在所述逻辑通道的连接模式为非直连模式的情况下,通道管理器将所述逻辑通道设置于第一物理通道之上,所述第一物理通道为订阅者所属订阅者进程内的其他订阅者订阅所述事件源的事件所使用的物理通道。
电子设备中的订阅者通过建立于所述第一物理通道之上的所述逻辑通道,向所述事件源发送订阅信息。
电子设备中的订阅者通过建立于所述第一物理通道之上的所述逻辑通道,接收所述事件源针对所述订阅信息反馈的事件。
在一种可能的设计中,在所述逻辑通道的连接模式为直连模式的情况下,新建第二物理通道;将所述逻辑通道设置于所述第二物理通道之上。
其中,电子设备中的订阅者在所述逻辑通道的连接模式为直连模式的情况下,新建第二物理通道。
电子设备中的订阅者将所述逻辑通道设置于所述第二物理通道之上。
在一种可能的设计中,在所述在事件源信息集合中查询事件源的IPC信息的步骤之前,还包括:将任一事件源初始化时,将所述任一事件源的事件源信息存储至所述事件源信息集合,其中,所述事件源信息包括事件源ID、支持事件列表和所述IPC信息。
电子设备中的任一事件源初始化时,会将自身的事件源信息存储至电子设备的事件源管理器中,事件源管理器中具有事件源信息集合,其中,所述事件源信息包括事件源ID、支持事件列表和所述IPC信息。
在一种可能的设计中,所述事件源包括本设备事件源和/或跨设备事件源。
电子设备中的订阅者可订阅本设备事件源和/或跨设备事件源。
其中,本设备事件源和跨设备事件源初始化时,均会将自身的事件源信息存储至自身所在电子设备的事件源信息集合中,不同电子设备的事件源管理器同步事件源信息。
在一种可能的设计中,所述在事件源信息集合中查询事件源的IPC信息的步骤,包括:在所述事件源信息集合中查询待订阅事件所属的第一事件源;判断当前订阅权限是否满足第一预定条件;基于所述当前订阅权限满足所述第一预定条件的情况,在所述事件源信息集合中查询所述第一事件源的IPC信息。
其中,电子设备的事件源管理器在自身的事件源信息集合中查询待订阅事件所属的第一事件源。
电子设备的事件源管理器判断订阅者的当前订阅权限是否满足第一预定条件。
基于所述当前订阅权限满足所述第一预定条件的情况,电子设备的事件源管理器在所述事件源信息集合中查询所述第一事件源的IPC信息,并发送至订阅者,以供订阅者根据该IPC信息与第一事件源建立逻辑通道进行事件的订阅和接收。
在一种可能的设计中,所述第一预定条件为:所述当前订阅权限大于或等于所述待订阅事件的可订阅权限,和/或,所述当前订阅权限大于或等于所述第一事件源的可 订阅权限。
在一种可能的设计中,所述在事件源信息集合中查询事件源的IPC信息的步骤,包括:在所述事件源信息集合中查询符合预定筛选规则的第二事件源;判断当前订阅权限是否满足第二预定条件;基于所述当前订阅权限满足所述第二预定条件的情况,在所述事件源信息集合中查询所述第二事件源的IPC信息。
其中,电子设备的事件源管理器在自身的事件源信息集合中查询符合预定筛选规则的第二事件源。
电子设备的事件源管理器判断订阅者的当前订阅权限是否满足第二预定条件。
基于所述当前订阅权限满足所述第二预定条件的情况,电子设备的事件源管理器在所述事件源信息集合中查询所述第二事件源的IPC信息,并发送至订阅者,以供订阅者根据该IPC信息与第二事件源建立逻辑通道进行事件的订阅和接收。
在一种可能的设计中,所述第二预定条件为:所述当前订阅权限大于或等于所述第二事件源中待订阅事件的可订阅权限,和/或,所述当前订阅权限大于或等于所述第二事件源的可订阅权限。
第二方面,本发明实施例提供了一种事件订阅装置,包括:IPC信息查询模块,用于在事件源信息集合中查询事件源的IPC信息;逻辑通道建立模块,用于基于所述IPC信息与所述事件源建立逻辑通道;物理通道设置模块,用于在所述逻辑通道的连接模式为非直连模式的情况下,将所述逻辑通道设置于第一物理通道之上,所述第一物理通道为本订阅者进程内当前订阅者以外的其他订阅者订阅所述事件源的事件所使用的物理通道;事件订阅模块,用于通过建立于所述第一物理通道之上的所述逻辑通道,向所述事件源发送订阅信息;事件接收模块,用于通过建立于所述第一物理通道之上的所述逻辑通道,接收所述事件源针对所述订阅信息反馈的事件。
在一种可能的设计中,还包括:物理通道新建模块,用于在所述逻辑通道的连接模式为直连模式的情况下,新建第二物理通道;所述物理通道设置模块还用于:将所述逻辑通道设置于所述第二物理通道之上。
在一种可能的设计中,还包括:事件源信息存储模块,用于在所述IPC信息查询模块查询所述事件源的IPC信息之前,将任一事件源初始化时,将所述任一事件源的事件源信息存储至所述事件源信息集合,其中,所述事件源信息包括事件源ID、支持事件列表和所述IPC信息。
在一种可能的设计中,所述IPC信息查询模块包括:第一事件源查询模块,用于在所述事件源信息集合中查询待订阅事件所属的第一事件源;第一判断模块,用于判断当前订阅权限是否满足第一预定条件;第一执行模块,用于基于所述当前订阅权限满足所述第一预定条件的情况,在所述事件源信息集合中查询所述第一事件源的IPC信息。
在一种可能的设计中,所述第一预定条件为:所述当前订阅权限大于或等于所述待订阅事件的可订阅权限,和/或,所述当前订阅权限大于或等于所述第一事件源的可订阅权限。
在一种可能的设计中,所述IPC信息查询模块包括:第二事件源查询模块,用于在所述事件源信息集合中查询符合预定筛选规则的第二事件源;第二判断模块,用于 判断当前订阅权限是否满足第二预定条件;第二执行模块,用于基于所述当前订阅权限满足所述第二预定条件的情况,在所述事件源信息集合中查询所述第二事件源的IPC信息。
在一种可能的设计中,所述第二预定条件为:所述当前订阅权限大于或等于所述第二事件源中待订阅事件的可订阅权限,和/或,所述当前订阅权限大于或等于所述第二事件源的可订阅权限。
在一种可能的设计中,所述事件源包括本设备事件源和/或跨设备事件源。
第三方面,本发明实施例提供了一种电子设备,包括:至少一个处理器;以及,与所述至少一个处理器通信连接的存储器;其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被设置为用于执行上述第一方面中任一项所述的方法。
第四方面,本发明实施例提供了一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令用于执行上述第一方面中任一项所述的方法流程。
第五方面,本发明实施例提供了一种计算机程序产品,当计算机程序产品在电子设备上运行时,使得电子设备执行上述第一方面中任一项所述的方法流程。
通过以上技术方案,为同一进程内的多个订阅者实现了物理通道的复用,大量减少了所需建立的物理通道的数量,从而减少了对系统资源的消耗,便于系统将有效资源提供给其他进程,整体提升了系统资源的有效利用率和工作效率。
附图说明
图1示出了本申请所涉及到的电子设备的结构示意图。
图2示出了本发明实施例提供的一种事件订阅方法的流程图;
图3示出了本发明实施例提供的一种复用物理通道订阅事件的原理示意图;
图4示出了本发明实施例提供的一种跨设备复用物理通道订阅事件的原理示意图;
图5示出了本发明实施例提供的一种事件订阅装置的示意框图。
具体实施方式
为了便于理解,示例地给出了部分与本申请实施例相关概念的说明以供参考。如下所示:
事件:指的是电子设备执行的内容。比如,在电子设备的界面上执行的鼠标点击、鼠标拖动、键盘输入等用户操作。
事件源:产生事件的对象。比如,在一个按钮上单击鼠标时,会产生一个事件,而这个按钮就是事件源。
订阅者:接收事件的对象,比如,电子设备中的应用。订阅者可在事件源订阅事件,当事件源发生该事件时,会将该事件发送至已订阅该事件的订阅者。
以下,结合附图对本实施例的实施方式进行详细描述。其中,在本申请实施例的描述中,除非另有说明,“/”表示或的意思,例如,A/B可以表示A或B;本文中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,在本申请实施例的描述中,“多个”是指两个或多于两个。
本申请所提供的技术方案应用于电子设备,该电子设备手机、平板电脑、可穿戴设备、车载设备、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本、个人数字助理(personal digital assistant,PDA)等任意具有操作系统的电子设备上,本申请实施例对此不作任何限制。
图1示出了本申请所涉及到的电子设备的结构示意图。
如图1所示,电子设备可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。可以理解的是,本实施例示意的结构并不构成对电子设备的具体限定。在本申请另一些实施例中,电子设备可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。例如,当电子设备为智能电视时,智能电视无需设置SIM卡接口195、摄像头193、按键190、受话器170B、麦克风170C、耳机接口170D中的一个或多个。图示的部件可以以硬件,软件,或软件和硬件的组合实现。
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。在一些实施例中,电子设备也可以包括一个或多个处理器110。其中,控制器可以是电子设备的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。这就避免了重复存取,减少了处理器110的等待时间,因而提高了电子设备的效率。
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。其中,USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口130可以用于连接充电器为电子设备充电,也可以用于电子设备与外围设备之间传输数据,也可以用于连接耳机,通过耳机播放音频。
可以理解的是,本发明实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备的结构限定。在本申请另一些实施例中,电子设备也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块140可以通过电子设备的无线充电线圈接收无线充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备供电。
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,显示屏194,摄像头193,和无线通信模块160等供电。电源管理模块141还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。在其他一些实施例中,电源管理模块141也可以设置于处理器110中。在另一些实施例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。
电子设备的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。天线1和天线2用于发射和接收电磁波信号。电子设备中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。
移动通信模块150可以提供应用在电子设备上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。
无线通信模块160可以提供应用在电子设备上的包括无线局域网(wireless local area networks,WLAN),蓝牙,全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),NFC,红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理 后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。
在一些实施例中,电子设备的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括GSM,GPRS,CDMA,WCDMA,TD-SCDMA,LTE,GNSS,WLAN,NFC,FM,和/或IR技术等。上述GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidou navigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。
电子设备通过GPU,显示屏194,以及应用处理器等可以实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行指令以生成或改变显示信息。
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,电子设备可以包括1个或N个显示屏194,N为大于1的正整数。
电子设备可以通过ISP,摄像头193,视频编解码器,GPU,一个或多个显示屏194以及应用处理器等实现拍摄功能。
ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光、色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,电子设备100可以包括1个或N个摄像头193,N为大于1的正整数。
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。
视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种 视频编解码器。这样,电子设备100可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐、照片、视频等数据文件保存在外部存储卡中。
内部存储器121可以用于存储一个或多个计算机程序,该一个或多个计算机程序包括指令。处理器110可以通过运行存储在内部存储器121的上述指令,从而使得电子设备执行本申请一些实施例中所提供的语音切换方法,以及各种功能应用以及数据处理等。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统;该存储程序区还可以存储一个或多个应用程序(比如图库、联系人等)等。存储数据区可存储电子设备使用过程中所创建的数据(比如照片,联系人等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。在一些实施例中,处理器110可以通过运行存储在内部存储器121的指令,和/或存储在设置于处理器110中的存储器的指令,来使得电子设备执行本申请实施例中所提供的语音切换方法,以及各种功能应用及数据处理。
电子设备可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。其中,音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。
扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备可以通过扬声器170A收听音乐,或收听免提通话。
受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。
麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。电子设备可以设置至少一个麦克风170C。在另一些实施例中,电子设备可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,电子设备还可以设置三个,四个或更多麦克风170C,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。
耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,还可以是美国蜂窝电信工业协会(cellular telecommunications industry association of the  USA,CTIA)标准接口。
传感器180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。
其中,压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。电子设备根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,电子设备根据压力传感器180A检测所述触摸操作强度。电子设备也可以根据压力传感器180A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。
陀螺仪传感器180B可以用于确定电子设备的运动姿态。在一些实施例中,可以通过陀螺仪传感器180B确定电子设备围绕三个轴(即,x,y和z轴)的角速度。陀螺仪传感器180B可以用于拍摄防抖。示例性的,当按下快门,陀螺仪传感器180B检测电子设备抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消电子设备的抖动,实现防抖。陀螺仪传感器180B还可以用于导航,体感游戏场景等。
加速度传感器180E可检测电子设备在各个方向上(一般为三轴)加速度的大小。当电子设备静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横竖屏切换,计步器等应用。
距离传感器180F,用于测量距离。电子设备可以通过红外或激光测量距离。在一些实施例中,拍摄场景,电子设备可以利用距离传感器180F测距以实现快速对焦。
接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。电子设备通过发光二极管向外发射红外光。电子设备使用光电二极管检测来自附近物体的红外反射光。当检测到充分的反射光时,可以确定电子设备附近有物体。当检测到不充分的反射光时,电子设备可以确定电子设备附近没有物体。电子设备可以利用接近光传感器180G检测用户手持电子设备贴近耳朵通话,以便自动熄灭屏幕达到省电的目的。接近光传感器180G也可用于皮套模式,口袋模式自动解锁与锁屏。
环境光传感器180L用于感知环境光亮度。电子设备可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测电子设备是否在口袋里,以防误触。
指纹传感器180H(也称为指纹识别器),用于采集指纹。电子设备可以利用采集 的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。另外,关于指纹传感器的其他记载可以参见名称为“处理通知的方法及电子设备”的国际专利申请PCT/CN2017/082773,其全部内容通过引用结合在本申请中。
触摸传感器180K,也可称触控面板。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称触控屏。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备的表面,与显示屏194所处的位置不同。
骨传导传感器180M可以获取振动信号。在一些实施例中,骨传导传感器180M可以获取人体声部振动骨块的振动信号。骨传导传感器180M也可以接触人体脉搏,接收血压跳动信号。在一些实施例中,骨传导传感器180M也可以设置于耳机中,结合成骨传导耳机。音频模块170可以基于所述骨传导传感器180M获取的声部振动骨块的振动信号,解析出语音信号,实现语音功能。应用处理器可以基于所述骨传导传感器180M获取的血压跳动信号解析心率信息,实现心率检测功能。
按键190包括开机键,音量键等。按键190可以是机械按键,也可以是触摸式按键。电子设备可以接收按键输入,产生与电子设备的用户设置以及功能控制有关的键信号输入。
马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏194不同区域的触摸操作,马达191也可对应不同的振动反馈效果。不同的应用场景(例如:时间提醒,接收信息,闹钟,游戏等)也可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。
指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。
SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和电子设备的接触和分离。电子设备可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口195可以支持Nano SIM卡,Micro SIM卡,SIM卡等。同一个SIM卡接口195可以同时插入多张卡。所述多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容不同类型的SIM卡。SIM卡接口195也可以兼容外部存储卡。电子设备通过SIM卡和网络交互,实现通话以及数据通信等功能。在一些实施例中,电子设备采用eSIM,即:嵌入式SIM卡。eSIM卡可以嵌在电子设备中,不能和电子设备分离。
以下,将通过具体实施例对本申请提供的事件订阅方法进行详细描述。
参照图2,本申请实施例提供一种事件订阅方法,执行于订阅者、事件源管理器及通道管理器所在的电子设备,该方法包括:
步骤102,电子设备中的订阅者在事件源管理器中查询事件源的IPC信息。
电子设备包括事件源管理器,事件源管理器中存储有事件源信息集合。
在一种可能的设计中,电子设备中的任一事件源初始化时,会将自身的事件源信 息注册存储至电子设备的事件源管理器中,参照图3,电子设备200的事件源202和事件源204在初始化时将事件源信息上传至电子设备的事件源管理器206中。
其中,事件源信息包括事件源ID、支持事件列表和IPC信息。
事件源标识信息表明事件源的身份。
支持事件列表记载了事件源可产生的事件。
IPC(Inter-Process Communication,进程间通信)信息包括事件源支持的通信方式、事件源所属的电子设备的IP地址和事件源的端口号。
其中,事件源所属的电子设备的IP地址和事件源的端口号表明了事件源的位置。
订阅一事件源中的事件的订阅者可通过事件源所属的电子设备的IP地址访问事件源所属的电子设备,在该电子设备中找到事件源的端口号,访问该端口号对应的端口,并经该端口通过事件源支持的通信方式向事件源订阅事件和接收该事件源发生的事件。
因此,电子设备中任一应用的订阅者进程中任一订阅者均可于事件源管理器的事件源信息集合内查询所需事件源的IPC信息。
步骤104,电子设备中的订阅者基于IPC信息通过通道管理器与事件源建立逻辑通道。
参照图3,电子设备200中具有通道管理器208和订阅者210,事件源202与订阅者210之间传输事件时,通道管理器208为两者建立逻辑信道,逻辑信道是供事件源202与订阅者210使用的抽象实体,由实体的物理信道所承载。
物理通道则是具体的物理连接,如tcp连接、udp连接或pipe连接等。一条物理通道具有承载多条逻辑通道的能力。
步骤106,在逻辑通道的连接模式为非直连模式的情况下,通道管理器将逻辑通道设置于第一物理通道之上,第一物理通道为订阅者所属订阅者进程内的其他订阅者订阅事件源的事件所使用的物理通道。
由于一条物理通道具有承载多条逻辑通道的能力,非直连模式下,在一个进程中的多个订阅者连接同一事件源时,可将多个订阅者的逻辑通道建立在同一个物理通道上,取代了相关技术中为每个订阅者建立一个物理通道以承载其逻辑通道的技术方案。
参照图3,订阅者进程中除了订阅者210至少还包括订阅者212、订阅者214,三者分别使用逻辑通道1、逻辑通道2和逻辑通道3连接事件源202。而这三条逻辑通道均建立在订阅者进程与事件源202的物理通道4。
由此,同一进程内的多个订阅者实现了物理通道的复用,大量减少了所需建立的物理通道的数量,从而减少了对系统资源的消耗,便于系统将有效资源提供给其他进程,整体提升了系统资源的有效利用率和工作效率。
步骤108,电子设备中的订阅者通过建立于第一物理通道之上的逻辑通道,向事件源发送订阅信息。
步骤110,电子设备中的订阅者通过建立于第一物理通道之上的逻辑通道,接收事件源针对订阅信息反馈的事件。
订阅信息包括订阅者ID和订阅者订阅事件的列表,订阅者将订阅信息发送至事件源,事件源即可将订阅者订阅的事件发送至订阅者ID,实现事件的下发。
在一种可能的设计中,电子设备中的订阅者在逻辑通道的连接模式为直连模式的情况下,新建第二物理通道,并将逻辑通道设置于第二物理通道之上。
逻辑通道的连接模式为直连模式的情况下,不同订阅者之间不复用相同物理通道,故可为直连模式下的订阅者建立新的物理通道。
在一种可能的设计中,事件源包括本设备事件源和/或跨设备事件源。
参照图4,电子设备200的事件源204可被电子设备300的订阅者302、订阅者310和订阅者312订阅,订阅者302、订阅者310和订阅者312分别使用通道管理器306中的逻辑通道5、逻辑通道6和逻辑通道7,逻辑通道5、逻辑通道6和逻辑通道7复用物理通道8。
其中,电子设备300的订阅者302在电子设备300的事件源管理器304中查询事件源204的IPC信息。
电子设备300的订阅者302基于事件源204的IPC信息,通过电子设备300的通道管理器306与事件源204建立逻辑通道,并将该逻辑通道建立在订阅者302所在进程与事件源204已建立的物理通道8之上,实现跨设备事件源与多个订阅者之间复用相同物理通道进行事件订阅和下发。
本设备事件源和跨设备事件源初始化时,均会将自身的事件源信息存储至自身所在电子设备的事件源信息集合中,不同电子设备的事件源管理器同步事件源信息集合。因此,电子设备中的订阅者可订阅本设备事件源和/或跨设备事件源。
在一种可能的设计中,电子设备的事件源管理器在自身的事件源信息集合中查询待订阅事件所属的第一事件源。
电子设备的事件源管理器判断订阅者的当前订阅权限是否满足第一预定条件。
基于当前订阅权限满足第一预定条件的情况,电子设备的事件源管理器在事件源信息集合中查询第一事件源的IPC信息,并发送至订阅者,以供订阅者根据该IPC信息与第一事件源建立逻辑通道进行事件的订阅和接收。
上述技术方案用于验证订阅者的资格。
订阅者可向事件源管理器发送事件订阅请求,该事件订阅请求中可指定待订阅事件或待订阅事件所属的事件源。
接着,电子设备的事件源管理器判断订阅者是否具有订阅该待订阅事件和/或订阅该第一事件源的资格,具体地,可判断订阅者的当前订阅权限是否满足第一预定条件,而第一预定条件为订阅者具有订阅该待订阅事件和/或订阅该第一事件源的资格的情况下其当前订阅权限所需要满足的最低条件。
在一种可能的设计中,第一预定条件为:当前订阅权限大于或等于待订阅事件的可订阅权限,和/或,当前订阅权限大于或等于第一事件源的可订阅权限。
当前订阅权限即订阅者自身的订阅权限,订阅权限的高低代表了订阅者可信赖程度的高低,而待订阅事件的可订阅权限代表了待订阅事件所能信赖的最低订阅权限,第一事件源的可订阅权限代表了第一事件源所能信赖的最低订阅权限。
因此,在订阅者自身的订阅权限大于或等于待订阅事件的可订阅权限的情况下,可认定订阅者达到了可被待订阅事件信赖的最低水平。
或者,在订阅者自身的订阅权限大于或等于第一事件源的可订阅权限的情况下, 可认定订阅者达到了可被第一事件源信赖的最低水平。
或者,在订阅者自身的订阅权限大于或等于待订阅事件的可订阅权限,并且订阅者自身的订阅权限大于或等于第一事件源的可订阅权限的情况下,可认定订阅者达到了可被待订阅事件和第一事件源共同信赖的最低水平。
此时,即可确定订阅者具有订阅第一事件源的待订阅事件的资格。
在一种可能的设计中,电子设备的事件源管理器在自身的事件源信息集合中查询符合预定筛选规则的第二事件源。
电子设备的事件源管理器判断订阅者的当前订阅权限是否满足第二预定条件。
基于当前订阅权限满足第二预定条件的情况,电子设备的事件源管理器在事件源信息集合中查询第二事件源的IPC信息,并发送至订阅者,以供订阅者根据该IPC信息与第二事件源建立逻辑通道进行事件的订阅和接收。
上述技术方案用于验证订阅者的资格。
订阅者可向事件源管理器发送事件订阅请求,该事件订阅请求中不指定待订阅事件或待订阅事件所属的事件源,而是指定预定筛选规则,或者,该事件订阅请求中不指定待订阅事件或待订阅事件所属的事件源,而是依赖于事件源管理器中的预定筛选规则在事件源管理器中的多个事件源中筛选出所需订阅事件的事件源。
其中,预定筛选规则可根据实际需求进行灵活设置。
比如,设置订阅者只能订阅所在进程的事件源列表中的事件源,或者,设置订阅者只能订阅本设备事件源,或者,设置订阅者只能订阅跨设备事件源。当然,预定筛选规则还可以是根据实际需要灵活设置的任何其他筛选条件。
接着,电子设备的事件源管理器判断订阅者是否具有订阅该待订阅事件和/或订阅该第一事件源的资格,具体地,可判断订阅者的当前订阅权限是否满足第二预定条件,而第二预定条件为订阅者具有订阅该待订阅事件和/或订阅该第一事件源的资格的情况下其当前订阅权限所需要满足的最低条件。
在一种可能的设计中,第二预定条件为:当前订阅权限大于或等于第二事件源中待订阅事件的可订阅权限,和/或,当前订阅权限大于或等于第二事件源的可订阅权限。
当前订阅权限即订阅者自身的订阅权限,订阅权限的高低代表了订阅者可信赖程度的高低,而待订阅事件的可订阅权限代表了待订阅事件所能信赖的最低订阅权限,第二事件源的可订阅权限代表了第二事件源所能信赖的最低订阅权限。
因此,在订阅者自身的订阅权限大于或等于待订阅事件的可订阅权限的情况下,可认定订阅者达到了可被待订阅事件信赖的最低水平。
或者,在订阅者自身的订阅权限大于或等于第二事件源的可订阅权限的情况下,可认定订阅者达到了可被第二事件源信赖的最低水平。
或者,在订阅者自身的订阅权限大于或等于待订阅事件的可订阅权限,并且订阅者自身的订阅权限大于或等于第二事件源的可订阅权限的情况下,可认定订阅者达到了可被待订阅事件和第二事件源共同信赖的最低水平。
此时,即可确定订阅者具有订阅第二事件源的待订阅事件的资格。
图5示出了本发明实施例提供的一种事件订阅装置的示意框图。
参照图5,本发明实施例提供了一种事件订阅装置500,包括:IPC信息查询模块 502,用于在事件源信息集合中查询事件源的IPC信息;逻辑通道建立模块504,用于基于所述IPC信息与所述事件源建立逻辑通道;物理通道设置模块506,用于在所述逻辑通道的连接模式为非直连模式的情况下,将所述逻辑通道设置于第一物理通道之上,所述第一物理通道为本订阅者进程内当前订阅者以外的其他订阅者订阅所述事件源的事件所使用的物理通道;事件订阅模块508,用于通过建立于所述第一物理通道之上的所述逻辑通道,向所述事件源发送订阅信息;事件接收模块510,用于通过建立于所述第一物理通道之上的所述逻辑通道,接收所述事件源针对所述订阅信息反馈的事件。
在一种可能的设计中,还包括:物理通道新建模块,用于在所述逻辑通道的连接模式为直连模式的情况下,新建第二物理通道;所述物理通道设置模块还用于:将所述逻辑通道设置于所述第二物理通道之上。
在一种可能的设计中,还包括:事件源信息存储模块,用于在所述IPC信息查询模块502查询所述事件源的IPC信息之前,将任一事件源初始化时,将所述任一事件源的事件源信息存储至所述事件源信息集合,其中,所述事件源信息包括事件源ID、支持事件列表和所述IPC信息。
在一种可能的设计中,所述IPC信息查询模块502包括:第一事件源查询模块,用于在所述事件源信息集合中查询待订阅事件所属的第一事件源;第一判断模块,用于判断当前订阅权限是否满足第一预定条件;第一执行模块,用于基于所述当前订阅权限满足所述第一预定条件的情况,在所述事件源信息集合中查询所述第一事件源的IPC信息。
在一种可能的设计中,所述第一预定条件为:所述当前订阅权限大于或等于所述待订阅事件的可订阅权限,和/或,所述当前订阅权限大于或等于所述第一事件源的可订阅权限。
在一种可能的设计中,所述IPC信息查询模块502包括:第二事件源查询模块,用于在所述事件源信息集合中查询符合预定筛选规则的第二事件源;第二判断模块,用于判断当前订阅权限是否满足第二预定条件;第二执行模块,用于基于所述当前订阅权限满足所述第二预定条件的情况,在所述事件源信息集合中查询所述第二事件源的IPC信息。
在一种可能的设计中,所述第二预定条件为:所述当前订阅权限大于或等于所述第二事件源中待订阅事件的可订阅权限,和/或,所述当前订阅权限大于或等于所述第二事件源的可订阅权限。
在一种可能的设计中,所述事件源包括本设备事件源和/或跨设备事件源。
该事件订阅装置500使用图1至图4中任一项所述的方案,因此,具有上述所有技术效果,在此不再赘述。
除此之外,本申请实施例还进一步提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有指令,当所述指令在电子设备上运行时,使得所述电子设备执行前述任一实现方式所述的事件订阅方法。
本申请实施例还进一步提供了一种计算机程序产品,当计算机程序产品在电子设备上运行时,使得电子设备执行如前述任一实现方式所述的事件订阅方法。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid State Disk)等。
总之,以上所述仅为本发明技术方案的实施例而已,并非用于限定本发明的保护范围。凡根据本发明的揭露,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。
在本发明实施例中使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本发明。在本发明实施例和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。
应当理解,尽管在本发明实施例中可能采用术语第一、第二等来描述XXX,但这些XXX不应限于这些术语。这些术语仅用来将XXX彼此区分开。例如,在不脱离本发明实施例范围的情况下,第一XXX也可以被称为第二XXX,类似地,第二XXX也可以被称为第一XXX。
显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。

Claims (12)

  1. 一种事件订阅方法,其特征在于,包括:
    在事件源信息集合中查询事件源的IPC信息;
    基于所述IPC信息与所述事件源建立逻辑通道;
    在所述逻辑通道的连接模式为非直连模式的情况下,将所述逻辑通道设置于第一物理通道之上,所述第一物理通道为本订阅者进程内当前订阅者以外的其他订阅者订阅所述事件源的事件所使用的物理通道;
    通过建立于所述第一物理通道之上的所述逻辑通道,向所述事件源发送订阅信息;
    通过建立于所述第一物理通道之上的所述逻辑通道,接收所述事件源针对所述订阅信息反馈的事件。
  2. 根据权利要求1所述的事件订阅方法,其特征在于,还包括:
    在所述逻辑通道的连接模式为直连模式的情况下,新建第二物理通道;
    将所述逻辑通道设置于所述第二物理通道之上。
  3. 根据权利要求1或2所述的事件订阅方法,其特征在于,在所述在事件源信息集合中查询事件源的IPC信息的步骤之前,还包括:
    将任一事件源初始化时,将所述任一事件源的事件源信息存储至所述事件源信息集合,其中,所述事件源信息包括事件源ID、支持事件列表和所述IPC信息。
  4. 根据权利要求1或2所述的事件订阅方法,其特征在于,所述在事件源信息集合中查询事件源的IPC信息的步骤,包括:
    在所述事件源信息集合中查询待订阅事件所属的第一事件源;
    判断当前订阅权限是否满足第一预定条件;
    基于所述当前订阅权限满足所述第一预定条件的情况,在所述事件源信息集合中查询所述第一事件源的IPC信息。
  5. 根据权利要求4所述的事件订阅方法,其特征在于,所述第一预定条件为:
    所述当前订阅权限大于或等于所述待订阅事件的可订阅权限,和/或,
    所述当前订阅权限大于或等于所述第一事件源的可订阅权限。
  6. 根据权利要求1或2所述的事件订阅方法,其特征在于,所述在事件源信息集合中查询事件源的IPC信息的步骤,包括:
    在所述事件源信息集合中查询符合预定筛选规则的第二事件源;
    判断当前订阅权限是否满足第二预定条件;
    基于所述当前订阅权限满足所述第二预定条件的情况,在所述事件源信息集合中查询所述第二事件源的IPC信息。
  7. 根据权利要求6所述的事件订阅方法,其特征在于,所述第二预定条件为:
    所述当前订阅权限大于或等于所述第二事件源中待订阅事件的可订阅权限,和/或,
    所述当前订阅权限大于或等于所述第二事件源的可订阅权限。
  8. 根据权利要求1所述的事件订阅方法,其特征在于,
    所述事件源包括本设备事件源和/或跨设备事件源。
  9. 一种事件订阅装置,其特征在于,包括:
    IPC信息查询模块,用于在事件源信息集合中查询事件源的IPC信息;
    逻辑通道建立模块,用于基于所述IPC信息与所述事件源建立逻辑通道;
    物理通道设置模块,用于在所述逻辑通道的连接模式为非直连模式的情况下,将所述逻辑通道设置于第一物理通道之上,所述第一物理通道为本订阅者进程内当前订 阅者以外的其他订阅者订阅所述事件源的事件所使用的物理通道;
    事件订阅模块,用于通过建立于所述第一物理通道之上的所述逻辑通道,向所述事件源发送订阅信息;
    事件接收模块,用于通过建立于所述第一物理通道之上的所述逻辑通道,接收所述事件源针对所述订阅信息反馈的事件。
  10. 一种电子设备,其特征在于,包括:至少一个处理器;以及,与所述至少一个处理器通信连接的存储器;
    其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被设置为用于执行上述权利要求1至8中任一项所述的方法。
  11. 一种计算机可读存储介质,其特征在于,存储有计算机可执行指令,所述计算机可执行指令用于执行如权利要求1至8中任一项所述的方法流程。
  12. 一种计算机程序产品,其特征在于,当计算机程序产品在电子设备上运行时,使得电子设备执行如权利要求1至8中任一项所述的方法流程。
PCT/CN2020/133787 2019-12-06 2020-12-04 事件订阅方法及电子设备 WO2021110117A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911243475.2A CN112929870B (zh) 2019-12-06 2019-12-06 事件订阅方法及电子设备
CN201911243475.2 2019-12-06

Publications (1)

Publication Number Publication Date
WO2021110117A1 true WO2021110117A1 (zh) 2021-06-10

Family

ID=76161689

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/133787 WO2021110117A1 (zh) 2019-12-06 2020-12-04 事件订阅方法及电子设备

Country Status (2)

Country Link
CN (1) CN112929870B (zh)
WO (1) WO2021110117A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115412596B (zh) * 2022-08-05 2024-01-05 深圳市汇深网信息科技有限公司 基于行程管理的出行消息订阅方法、装置、设备及介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1271331B1 (en) * 2001-06-28 2008-10-15 Nokia Corporation Method for enabling a communication between processes and processing system using the same method
US20100017513A1 (en) * 2008-07-16 2010-01-21 Cray Inc. Multiple overlapping block transfers
CN106888078A (zh) * 2016-12-26 2017-06-23 中国移动通信有限公司研究院 前传网络的数据传输方法及装置
CN110515706A (zh) * 2019-08-16 2019-11-29 苏州浪潮智能科技有限公司 一种请求处理方法、装置、设备及可读存储介质

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103716076B (zh) * 2013-12-25 2017-03-01 华为技术有限公司 一种数据传输方法和设备
CN109995800A (zh) * 2017-12-29 2019-07-09 中国科学院沈阳自动化研究所 面向工业sdn网络中动态实时应用的中间件服务系统和方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1271331B1 (en) * 2001-06-28 2008-10-15 Nokia Corporation Method for enabling a communication between processes and processing system using the same method
US20100017513A1 (en) * 2008-07-16 2010-01-21 Cray Inc. Multiple overlapping block transfers
CN106888078A (zh) * 2016-12-26 2017-06-23 中国移动通信有限公司研究院 前传网络的数据传输方法及装置
CN110515706A (zh) * 2019-08-16 2019-11-29 苏州浪潮智能科技有限公司 一种请求处理方法、装置、设备及可读存储介质

Also Published As

Publication number Publication date
CN112929870B (zh) 2022-07-22
CN112929870A (zh) 2021-06-08

Similar Documents

Publication Publication Date Title
WO2020224486A1 (zh) 一种通话方法、设备及系统
WO2020244623A1 (zh) 一种空鼠模式实现方法及相关设备
WO2021052214A1 (zh) 一种手势交互方法、装置及终端设备
WO2020014880A1 (zh) 一种多屏互动方法及设备
CN111132234B (zh) 一种数据传输方法及对应的终端
WO2021169847A1 (zh) 一种分布式服务调度方法及相关装置
WO2021258809A1 (zh) 数据同步方法、电子设备和计算机可读存储介质
WO2022100610A1 (zh) 投屏方法、装置、电子设备及计算机可读存储介质
WO2020238890A1 (zh) 信息处理方法和设备
WO2021052204A1 (zh) 基于通讯录的设备发现方法、音视频通信方法及电子设备
WO2020216098A1 (zh) 一种跨电子设备转接服务的方法、设备以及系统
WO2021104104A1 (zh) 一种高能效的显示处理方法及设备
WO2021017909A1 (zh) 一种通过nfc标签实现功能的方法、电子设备及系统
WO2021068926A1 (zh) 模型更新方法、工作节点及模型更新系统
WO2021175266A1 (zh) 身份验证方法、装置和电子设备
WO2021052407A1 (zh) 一种电子设备操控方法及电子设备
WO2021238967A1 (zh) 一种内容分享的方法、装置及系统
WO2022143156A1 (zh) 一种加密通话方法、装置、终端及存储介质
CN114356195B (zh) 一种文件传输的方法及相关设备
WO2021027623A1 (zh) 一种设备能力发现方法及p2p设备
WO2021110117A1 (zh) 事件订阅方法及电子设备
WO2021110115A1 (zh) 事件订阅方法及电子设备
CN114528581A (zh) 一种安全显示方法及电子设备
WO2020078267A1 (zh) 在线翻译过程中的语音数据处理方法及装置
WO2021218544A1 (zh) 一种提供无线上网的系统、方法及电子设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20895451

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20895451

Country of ref document: EP

Kind code of ref document: A1