Smart home device operating method and apparatus, storage medium, and electronic device
By using pre-defined callback interfaces and development components, the development process for smart home devices is simplified, the complexity and long development cycles caused by the Matter protocol are resolved, and a more efficient development process is achieved.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- HOORII TECHNOLOGY CO LTD
- Filing Date
- 2024-12-05
- Publication Date
- 2026-06-11
AI Technical Summary
In existing technologies, the process of developing smart home devices based on the Matter protocol is too complex, time-consuming, and difficult.
This paper provides a method for operating smart home devices. By using pre-set callback interfaces and development components, it reduces the developer's dependence on the Matter protocol, allows direct writing of callback functions that do not conform to the Matter protocol, and simplifies the development process by utilizing cross-platform interfaces and object model interfaces in the development components.
It reduces the difficulty of developing smart home devices, shortens the development cycle, reduces the need to learn and understand the Matter protocol, and improves development efficiency.
Smart Images

Figure CN2024136967_11062026_PF_FP_ABST
Abstract
Description
A method, apparatus, storage medium, and electronic device for operating smart home devices. Technical Field
[0001] This specification relates to the field of computer technology, and in particular to a method, apparatus, storage medium and electronic device for operating a smart home device. Background Technology
[0002] With the continuous development of technology, smart home devices are being widely used, such as smart curtains, smart speakers, and smart lights.
[0003] Currently, to enable communication between smart home devices from different brands, the Matter protocol can be used to develop smart home devices. The Matter protocol is a new smart home connectivity standard led by the Connectivity Standards Alliance (CSA). However, the existing process for developing smart home devices based on the Matter protocol is overly complex, time-consuming, and difficult. Therefore, a crucial issue is how to reduce the development difficulty and time required to run the developed smart home devices to perform business functions.
[0004] Based on this, this manual provides a method for operating a smart home device. Summary of the Invention
[0005] This specification provides a method, apparatus, storage medium, and electronic device for operating smart home devices, in order to partially solve the aforementioned problems existing in the prior art.
[0006] The following technical solution is adopted in this specification:
[0007] This manual provides a method for operating smart home devices, including:
[0008] In response to the startup operation of the first user's terminal, the smart home device is started and a pre-written program corresponding to the smart home device is run; wherein, the program is used to control the smart home device to perform functions;
[0009] When a specified instruction is received to instruct the smart home device to perform a specified function, the program calls a pre-set callback interface; wherein, the callback interface satisfies the Matter protocol, and the callback interface stores several callback functions for implementing the functions of the smart home device, and the callback functions are functions pre-set by the second user that do not satisfy the Matter protocol;
[0010] From the callback functions stored in the callback interface, determine the callback function used to implement the specified function, and use it as the target callback function;
[0011] Run the target callback function.
[0012] Optionally, the program is pre-written based on a pre-set development component, the development component including the callback interface, the callback interface being used to store the callback functions when the second user inputs the callback functions.
[0013] Optionally, the development component further includes a hardware interface, which is used to determine the target hardware selected by the second user in response to the second user's selection operation, and to compile the project file corresponding to the smart home device into an executable file corresponding to the target hardware.
[0014] Optionally, the development component further includes an instruction addition interface, which is used to add the first instruction to the instruction set of the smart home device when a first instruction in a preset format is received from the second user.
[0015] Optionally, the development component further includes an instruction transmission component and an instruction assembly interface. The instruction assembly interface is used to assemble the parameters to be assembled into a second instruction in a preset format when the parameters to be assembled are received. The instruction transmission component is used to send the second instruction to the device corresponding to the second instruction.
[0016] Optionally, the development component further includes a property model interface and a lightweight property model. The lightweight property model is a property model corresponding to the function of the smart home device. The property model interface is used to store the mapping relationship table when the second user inputs the mapping relationship table, and to determine the property model corresponding to the third instruction according to the mapping relationship table when the third instruction is received, and to perform the operation corresponding to the third instruction on the determined property model. The mapping relationship table includes the mapping relationship between the parameters required to implement the function of the smart home device and the lightweight property model.
[0017] Optionally, the development component further includes an initialization interface for initializing the basic configuration of the firmware when programming the firmware of the smart home device.
[0018] Optionally, the development component further includes a cross-platform interface, which is used to respond to the selection operation of the second user, determine the target information selected by the second user, and compile the project file corresponding to the smart home device into an executable file corresponding to the target information.
[0019] Optionally, the development component further includes a system interface, which is used to respond to the selection operation of the second user, determine the target system selected by the second user, and compile the project file corresponding to the smart home device into an executable file corresponding to the target system.
[0020] This manual provides a smart home device operating mechanism, including:
[0021] A startup module is used to respond to a startup operation from the first user's terminal, start the smart home device, and run a pre-written program corresponding to the smart home device; wherein, the program is used to control the smart home device to perform functions;
[0022] The calling module is used to call a pre-set callback interface through the program when it receives a specified instruction to instruct the smart home device to perform a specified function; wherein the callback interface satisfies the Matter protocol, the callback interface stores several callback functions for implementing the functions of the smart home device, and the callback functions are functions pre-set by the second user that do not satisfy the Matter protocol;
[0023] The determining module is used to determine, from the callback functions stored in the callback interface, the callback function used to implement the specified function, and use it as the target callback function;
[0024] The execution module is used to run the target callback function.
[0025] This specification provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method for operating smart home devices.
[0026] This specification provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-described smart home device operation method.
[0027] The above-mentioned technical solutions adopted in this specification can achieve the following beneficial effects:
[0028] The smart home device operation method provided in this manual responds to the startup operation of the first user's terminal, starts the smart home device, and runs a pre-written program corresponding to the smart home device. This program is used to control the smart home device to perform functions. When a specified instruction is received to instruct the smart home device to perform a specified function, a pre-set callback interface is invoked. This callback interface conforms to the Matter protocol and stores several callback functions used to implement the functions of the smart home device. These callback functions are pre-set by the second user and do not conform to the Matter protocol. From the callback functions stored in the callback interface, the callback function used to implement the specified function is determined and selected as the target callback function. The target callback function is then executed.
[0029] As can be seen from the above method, when running a smart home device, this application responds to the startup operation of the first user's terminal, starts the smart home device, and runs a pre-written program corresponding to the smart home device. This program is used to control the smart home device to perform functions. When a specified instruction is received to instruct the smart home device to perform a specified function, a pre-set callback interface is called. This callback interface satisfies the Matter protocol and stores a general function for satisfying the target protocol, as well as several callback functions for implementing the functions of the smart home device. These callback functions are functions pre-set by the second user that do not satisfy the Matter protocol. From the callback functions stored in the callback interface, the callback function for implementing the specified function is determined and used as the target callback function. The target callback function is then run. By calling a callback interface that satisfies the Matter protocol, the target callback function for implementing the specified function is determined from that callback interface to achieve the specified function. This eliminates the need for the second user to understand the Matter protocol and write callback functions that satisfy the Matter protocol when writing the smart home device program, thereby reducing the development difficulty of the smart home device and shortening the development time cycle. Attached Figure Description
[0030] Figure 1 is a flowchart illustrating a method for operating a smart home device as provided in this specification;
[0031] Figure 2 is a schematic diagram of one method of opening a curtain provided in this instruction manual;
[0032] Figure 3 is a schematic diagram of a process for writing data into a physical model as provided in this specification;
[0033] Figure 4 is a schematic diagram of the data processing in a reading object model provided in this specification;
[0034] Figure 5 is a schematic diagram of a development component provided in this specification;
[0035] Figure 6 is a schematic diagram of a smart home device operating mechanism provided in this specification;
[0036] Figure 7 is a schematic diagram of an electronic device corresponding to Figure 1 provided in this specification. Detailed Implementation
[0037] To make the objectives, technical solutions, and advantages of this specification clearer, the technical solutions of this specification will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this specification, and not all of them. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this specification.
[0038] Currently, the development of smart home devices supporting the Matter protocol is generally based on the Matter SDK. The Matter protocol aims to provide a unified IP-based standard that supports communication between smart home devices. By defining a unified application layer protocol, the Matter protocol allows seamless connection between smart home devices of different brands and types, simplifying interoperability and enabling users to easily control smart home devices from different brands. This breaks down traditional "single-brand barriers," allowing for unified management of smart home devices and providing users with more flexible choices. The aforementioned Matter SDK, led by CSA, aims to provide a standard implementation of the Matter protocol, including key modules such as device control, authentication, and data transmission.
[0039] However, the Matter SDK integrates a large number of third-party projects, and the interfaces are redundant and complex. This requires developers to spend a lot of time and energy to learn and master the configuration and use of each layer of the Matter protocol stack in the Matter SDK, resulting in a long development cycle and high development difficulty.
[0040] Based on this, this specification provides a method, apparatus, storage medium, and electronic device for operating smart home devices. The technical solutions provided by various embodiments of this specification are described in detail below with reference to the accompanying drawings.
[0041] Figure 1 is a flowchart illustrating a smart home device operation method provided in this specification, including the following steps:
[0042] S100: In response to the startup operation of the first user's terminal, the smart home device is started and the pre-written program corresponding to the smart home device is run; wherein, the program is used to control the smart home device to perform functions.
[0043] In this manual, the device used to run the smart home device can first respond to the startup operation of the first user's terminal, start the smart home device, and run the pre-written program corresponding to the smart home device. The device used to run the smart home device can be the firmware of the smart home device, the hardware or module containing the firmware, or an electronic device such as a desktop computer or laptop computer containing the firmware. For ease of description, the following explanation focuses on the firmware as the execution entity, describing the operation method of the smart home device provided in this manual. Firmware is software embedded in a hardware device that provides the device's basic functions and control logic.
[0044] The aforementioned smart home devices can be of any type, such as smart curtains, smart lights, and smart clotheslines; this manual does not specify any particular type. The first user is the user of this smart home device, and the terminal is the terminal used by the first user. This terminal can be used to control the startup of the smart home device; that is, the first user can start the smart home device through this terminal. Of course, this terminal can also be used to control the smart home device to perform its functions; this manual does not specify any particular type. Therefore, the aforementioned firmware can respond to the startup operation of the first user's terminal and start the smart home device. Afterward, the firmware can run a pre-written program corresponding to the smart home device. This program is pre-written and is used to control the smart home device to perform its functions; this program can be pre-stored in the firmware.
[0045] S102: When a specified instruction is received to instruct the smart home device to perform a specified function, a pre-set callback interface is called through the program; wherein, the callback interface satisfies the Matter protocol, the callback interface stores several callback functions for implementing the functions of the smart home device, and the callback functions are functions pre-set by the second user that do not satisfy the Matter protocol.
[0046] In this specification, when a specified instruction is received to instruct a smart home device to perform a specified function, the aforementioned firmware can call a pre-set callback interface through the program. The specified function can be pre-set and implemented through a callback function. The specified instruction can also be pre-set and is used to instruct the smart home device to perform the specified function. Specifically, taking a smart curtain as an example, the specified function could be that when a command to open the curtain is received from the terminal, the motor automatically controls the curtain to open; in this case, the specified instruction is the command to open the curtain sent by the terminal.
[0047] Based on this, the first user first clicks the button to open the curtains on the aforementioned terminal. The terminal can then generate an instruction to open the curtains and send this instruction to the aforementioned smart home device. When the firmware in the smart home device receives the instruction to open the curtains (i.e., the specified instruction), it can call a pre-set callback interface through the program. This allows the target callback function in the callback interface to be triggered according to the instruction to open the curtains, and then the target callback function to be run to control the smart home device to open the curtains.
[0048] Of course, the above-mentioned instruction function can also be to automatically control the motor to open the curtains when the light intensity reaches a preset threshold. Therefore, the specified instruction can be "open the curtains when the light intensity reaches the preset threshold." It should be noted that the above-mentioned specified functions and instructions are merely examples, and this manual does not limit the specific functions or instructions to be specified. Furthermore, there is a correspondence between the above-mentioned specified functions and instructions.
[0049] In this specification, the aforementioned callback interface is pre-configured, conforms to the Matter protocol, and stores several callback functions for implementing the functions of smart home devices. The second user is the user developing the smart home device. In addition to storing the callback functions pre-configured by the second user, the aforementioned callback interface may also store general functions that conform to the Matter protocol. These general functions are not pre-configured by the second user, but conform to the Matter protocol, and can be pre-stored in the callback interface.
[0050] The aforementioned callback function is pre-set by the second user and does not satisfy the Matter protocol. This callback function is used to implement the functions of the smart home device. It can include attributes, events, and commands required to implement these functions. The callback function can include at least one of the aforementioned attributes, events, and commands. Attributes represent the status information of the smart home device, such as temperature, humidity, and on / off status; these attributes can be read and written. Commands are instructions for controlling the smart home device, used to control its state or trigger its behavior. Events are notifications sent by the smart home device to the terminal, informing the terminal of changes in the device's status or other important events.
[0051] Specifically, taking smart home devices such as smart curtains as an example, the specified function can be to automatically control the motor to open the curtains when a command to open the curtains is received from the terminal. The attributes in the callback function that implements this specified function can be the current percentage of the curtains and the target percentage. The command can be to automatically control the motor to open the curtains when a command to open the curtains is received from the terminal, and the event can be a message notifying the terminal that the command was executed successfully.
[0052] It should be noted that the function implemented by this callback function is a function that can be implemented through callback. In other words, among all the functions of a smart home device, the function that needs to be implemented through callback is the callback function. The callback function is used to implement the callback function in the smart home device. The specified function mentioned above can be any one or more of the callback functions. This manual does not make any specific limitations.
[0053] In this specification, since the above callback interface conforms to the Matter protocol, when writing the callback function, the second user does not need to understand and master the Matter protocol and the configuration and use of each layer of the Matter protocol stack. The second user can directly write a callback function that does not conform to the Matter protocol and store it directly in the callback interface so that smart home devices that support the Matter protocol can directly call the callback interface when running.
[0054] S104: Determine the callback function used to implement the specified function from the callback functions stored in the callback interface, and use it as the target callback function.
[0055] S106: Run the target callback function.
[0056] In this specification, the firmware can first determine the callback function used to implement the specified function from the callback functions stored in the callback interface, and use it as the target callback function. Then, the firmware can run the target callback function to automatically implement the specified function of the smart home device.
[0057] When the target callback function is running, the firmware can control the smart home device to perform a specified function according to the command in the target callback function. For example, if the command in the target callback function is to control the motor in the smart home device to open the curtains, the firmware can determine the preset format instruction corresponding to the command and send the determined instruction to the motor so that the motor can parse the instruction and automatically open the curtains according to the parsed result.
[0058] The preset format is a pre-set format that conforms to AT (Attention) commands, typically beginning with "AT". The preset format commands corresponding to the above commands can be pre-set by a second user and stored in the command set. Furthermore, since the commands transmitted from the firmware to the motor are in a preset format, the motor can directly parse the commands to obtain the parsed result, which is "open the curtains," thus the motor can automatically open the curtains.
[0059] As can be seen from the above method, when running a smart home device, in response to the startup operation of the first user's terminal, the smart home device is started and a pre-written program corresponding to the smart home device is run. This program is used to control the smart home device to perform functions. When a specified instruction is received to instruct the smart home device to perform a specified function, a pre-set callback interface is called through the program. This callback interface conforms to the Matter protocol and stores several callback functions used to implement the functions of the smart home device. These callback functions are functions pre-set by the second user that do not conform to the Matter protocol. From the callback functions stored in the callback interface, the callback function used to implement the specified function is determined and used as the target callback function. The target callback function is then run. By calling a callback interface that conforms to the Matter protocol, the target callback function used to implement the specified function is determined from that callback interface to achieve the specified function. This eliminates the need for the second user to understand the Matter protocol and write callback functions that conform to the Matter protocol when writing the smart home device program, thereby reducing the development difficulty of the smart home device and shortening the development cycle.
[0060] In this specification, the aforementioned program can be pre-written based on a pre-configured development component, which provides the interfaces required for the development process of smart home devices. This development component may include the aforementioned callback interface, which can be used to store callback functions received from a second user. This allows the second user to avoid needing to understand and master the Matter protocol, the configuration of each layer in the Matter protocol stack, and the configuration of each interface in the Matter SDK. They only need to write callback functions that do not conform to the Matter protocol. Furthermore, since the callback interface conforms to the Matter protocol, smart home devices that call this callback interface to implement functions can still support the Matter protocol. Subsequently, when implementing a specific function of the smart home device, the program can automatically call the callback interface and determine the target callback function corresponding to the specified function from the callback functions stored in the callback interface, and then run the target callback function. Moreover, the second user can directly store or register all callback functions that implement the functions of the smart home device into the callback interface for centralized processing. This eliminates the need for the second user to focus on the large number of callback interfaces provided by the Matter SDK; they only need to write callback functions including attributes, events, and commands.
[0061] In this specification, the aforementioned development component may also store a Matter SDK. This Matter SDK is used to trigger a callback upon receiving an instruction from the terminal, calling a callback interface. Based on the instruction, the target callback function corresponding to that instruction in the callback interface is triggered to control the smart home device to implement the function or operation corresponding to the instruction. Specifically, taking a smart curtain as an example, the specified function could be to automatically control the motor to open the curtain when an instruction to open the curtain is received from the terminal. Therefore, to implement the specified function, as shown in Figure 2 (a schematic diagram of the curtain-opening process provided in this specification), the first user clicks the curtain-opening button on the terminal. The terminal generates an instruction to open the curtain and sends this instruction to the smart home device. Upon receiving the curtain-opening instruction, the firmware in the smart home device can trigger a callback in the Matter SDK within the development component, calling a pre-set callback interface. Based on the curtain-opening instruction, the target callback function in the callback interface used to implement the specified function is triggered, and then the target callback function is run to control the smart home device to open the curtain.
[0062] When the callback in the Matter SDK is triggered programmatically and a pre-defined callback interface is called, the callback in the Matter SDK can be triggered programmatically. Simultaneously, a callback thread monitors whether the Matter SDK generates a callback. When the callback in the Matter SDK is triggered and the command to open the curtains is sent to the callback thread, the Matter SDK generates a callback, and the callback thread can then call the pre-defined callback interface to process the command to open the curtains. The development component may also include a callback thread, which monitors whether the Matter SDK generates a callback and, when the Matter SDK generates a callback, calls the callback interface to process the received command.
[0063] In this specification, when developing Matter products based on the Matter SDK, the project files may contain code that depends on components provided by a specific operating system and driver code that depends on a specific chip platform. However, if the chip vendor is changed or the project is deployed on multiple platforms, engineers need to manually modify the project files. This modification includes changes to hardware-related configurations, compilers, library files, and system-related configurations. Modifications to hardware-related configurations may include changes to hardware drivers, hardware versions, hardware GPIO configurations, clock settings, interrupt vector tables, etc. Compiler modifications include changes to compiler options, optimization levels, and debugging settings. Library file modifications include changes to library file paths, third-party libraries, and library configurations. System-related configuration modifications include changes to the system version, toolchain, linker, and memory, etc., to make the compiled executable file corresponding to the modified project files portable to the required chip or platform. This increases the difficulty of porting the project files and requires engineers to invest a lot of effort and time in modifying the project files.
[0064] Based on this, the aforementioned development components also include a cross-platform interface. This interface responds to the second user's selection operation, determines the target information selected by the second user, and compiles the project files corresponding to the smart home device into an executable file corresponding to the target information. This target information may include hardware or a system; the hardware refers to the chip required for the executable file, and the system refers to the operating system supported by the executable file. The cross-platform interface can directly and automatically modify the smart home device's project files based on the target information and compile the modified project files to obtain the executable file corresponding to the target information.
[0065] Furthermore, the aforementioned development components or cross-platform interfaces can all include a hardware interface. This hardware interface can be used to respond to the second user's selection operation, determine the target hardware selected by the second user, and compile the project files corresponding to the smart home device into an executable file corresponding to the target hardware. The project files are files written during the development of the smart home device. These project files can be written based on initial hardware, which is of a different type than the target hardware. The target hardware is the chip on which the executable file needs to be deployed, i.e., the chip on which the project file needs to be ported. The executable file can be executed or run on this target hardware. The aforementioned hardware interface can compile the project files corresponding to the smart home device into an executable file corresponding to the target hardware. This allows the second user to write project files without needing to consider differences between hardware, such as differences in hardware drivers between different hardware. Furthermore, when porting project files, there is no need to manually modify the project files; the hardware interface can automatically modify the project files so that the modified project files can be compiled into an executable file that can be executed or run on the target hardware. This reduces the difficulty of porting project files, saves the second user's effort and time, and shortens the development cycle.
[0066] The aforementioned hardware interface can store hardware converters for various types of hardware. These converters are pre-configured and can compile project files written for one type of hardware into executable files that can be executed or run on another type of hardware. In other words, the converter can modify project files written for one type of hardware to be correctly compiled and run on another type of hardware, and then compile the modified project files to obtain executable files that can run or run on the other type of hardware. Therefore, when compiling project files corresponding to smart home devices into executable files corresponding to target hardware, the aforementioned hardware interface can determine the target hardware converter from among the various hardware converters based on the initial hardware and target hardware corresponding to the smart home device's project files, and compile the aforementioned project files into executable files corresponding to the target hardware using the target hardware converter.
[0067] The aforementioned development components or cross-platform interfaces may also include a system interface. This system interface can be used to respond to a second user's selection operation, determine the target system selected by the second user, and compile the project files corresponding to the smart home device into an executable file corresponding to the target system. The project files may be written based on an initial system, which is of a different type than the target system. The target system is the operating system supported by the executable file. This system interface compiles the project files corresponding to the smart home device into an executable file corresponding to the target system. This eliminates the need for the second user to consider differences between systems, such as version or service differences, when writing project files. Furthermore, the system interface automatically modifies the project files during porting, ensuring they can be compiled into an executable file that supports the target system. This reduces the difficulty of porting project files, saves the second user's time and effort, and shortens the development cycle.
[0068] The aforementioned system interface can store system converters for various types of hardware. These converters are pre-configured and can compile project files written for one type of operating system into executable files supporting another type. In other words, the converter can modify project files written for one type of operating system to support another, and then compile the modified project files to obtain executable files supporting the other type of operating system. Therefore, when compiling project files corresponding to smart home devices into executable files corresponding to system hardware, the aforementioned system interface can determine the target system converter from among the system converters based on the initial system and target system corresponding to the smart home device's project files, and compile the aforementioned project files into executable files corresponding to the target system using that target system converter.
[0069] In this specification, the aforementioned development components also include an instruction addition interface. This interface is used to add a first instruction in a preset format to the instruction set of the smart home device upon receiving such an instruction from a second user. The first instruction is pre-written by the second user and conforms to a preset format. This first instruction includes three types: read, write, and notification. For example, the first instruction could read the temperature from an object model, write the temperature to the object model, or notify a motor to open the curtains. This specification does not specifically limit the type of instruction or its function. The instruction set can include first instructions written by the second user, as well as pre-set general instructions that also conform to a preset format and are not written by the second user, thereby reducing the workload of the second user and shortening the development time cycle. It should be noted that the devices involved in the aforementioned first instructions are all devices equipped with independent processing units or computing units.
[0070] Furthermore, each of the aforementioned first instructions has corresponding processing logic, which can be pre-set by the second user. This processing logic is used to process the first instruction and can be a callback-type function used to process the first instruction. It should be noted that this processing logic does not need to be stored in the aforementioned callback interface; it can be directly received and saved by the instruction thread. Therefore, the aforementioned development component can also include an instruction thread. This instruction thread can monitor whether the second user has input the processing logic corresponding to the first instruction. When it receives the processing logic corresponding to the first instruction input by the second user, the instruction thread can be used to store the received processing logic corresponding to the first instruction, and upon receiving the first instruction, parse the first instruction, determine the parsing result, and then execute the processing logic corresponding to the first instruction based on the parsing result. The parsing result is the parameter required to execute the processing logic corresponding to the first instruction. It should be noted that the second user does not need to write code to perform string parsing operations on the instruction when writing the processing logic; the aforementioned instruction thread can automatically parse the received instruction.
[0071] In this specification, the aforementioned development component further includes an instruction transmission component and an instruction assembly interface. The instruction assembly interface is used to assemble the parameters to be assembled into a second instruction of a preset format upon receiving the parameters to be assembled. The instruction transmission component is used to transmit the second instruction, specifically to send the second instruction to the device corresponding to the second instruction, or to receive the second instruction transmitted by the device. The parameters to be assembled can be attribute values or a combination of attributes and attribute values. These parameters can be determined by the instruction thread, input by a second user, or determined by the device; this specification does not impose specific limitations. The parameters to be assembled are the parameters that need to be assembled into an instruction of a preset format. The second instruction is the instruction obtained after assembling the parameters to be assembled. This second instruction is an instruction of a preset format. When the parameters to be assembled are parameters input by a second user, the second instruction corresponding to these parameters is actually the first instruction stored in the instruction set. The instruction transmission component is a component within the development component, used to transmit instructions of a preset format. The device corresponding to the second instruction is a device equipped with an independent arithmetic unit or computing unit. The above-mentioned instruction assembly interface can be used to assemble the parameters to be assembled, so that the second user does not need to manually write the assembly code. The user only needs to call the instruction assembly interface to obtain a complete instruction that conforms to the preset format based on the parameters to be assembled, i.e., the second instruction. This eliminates the need for the second user to perform tedious string operations.
[0072] This specification addresses the shortcomings of current Matter SDKs, which primarily focus on implementing the Matter protocol and its various components. However, they lack design and implementation details for scenarios involving information exchange between external sensor datasets and Matter object models. This necessitates developers gaining a deep understanding of the Matter protocol and designing and implementing these scenarios independently, thus increasing the development barrier. Therefore, the aforementioned development components also include an object model interface and a lightweight object model. The lightweight object model represents the object model corresponding to the functions of smart home devices. It is a simplified version of the object model provided by the Matter SDK, including only those related to the functions of smart home devices. Object models unrelated to these functions, such as network-related object models, are hidden. The object model is a crucial concept in the Internet of Things (IoT) field, describing the attributes, services (commands), and events of physical devices (i.e., smart home devices). The object model enables smart home devices to interact with other smart home devices in a standardized and structured manner, facilitating communication between them.
[0073] The aforementioned object model interface is used to store the mapping table when a second user input is received, and to determine the object model corresponding to the third instruction based on the mapping table when a third instruction is received, and to perform the operation corresponding to the third instruction on the determined object model. The third instruction can be an instruction to operate on the object model, including read and write operations. The third instruction can also include attributes (i.e., parameters) and attribute values (i.e., the values corresponding to the parameters). This third instruction is obtained based on the aforementioned processing logic and parsing results. Since the aforementioned lightweight object model is actually a subset of all object models included in the Matter SDK, the object model corresponding to the third instruction can be an object model within the lightweight object model, but it is also actually an object model within the Matter SDK. Therefore, performing the operation corresponding to the third instruction on the determined object model is essentially performing the operation corresponding to the third instruction on the object model corresponding to the third instruction within the Matter SDK.
[0074] The aforementioned mapping table includes the mapping relationship between the parameters required to implement the functions of smart home devices and the lightweight material model. The parameters required to implement the functions of smart home devices may include parameters transmitted from peripheral devices and parameters transmitted to peripheral devices. These peripheral devices include sensors, motors, and other equipment. These peripheral devices may or may not have independent computing units. The parameters may be physical parameters related to the functions of smart home devices, such as temperature, humidity, and light intensity; the specific parameters can be set by a second user.
[0075] The above mapping table can be set by a second user. When setting the mapping table, the second user can set it based on the lightweight object model provided by the development component. This will hide object models that are not directly related to the functions of smart home devices from the second user, avoiding functional abnormalities caused by the second user's unfamiliarity with the Matter protocol and saving the time and effort required for the second user to master this part, thus improving development efficiency.
[0076] Furthermore, upon receiving a third instruction, the aforementioned object model interface can automatically determine the object model corresponding to the third instruction based on the mapping table, and perform the corresponding operation on the determined object model. This process requires no corresponding code from a second user, nor does it require consideration of the operational specifications of the Matter object model. Users only need to call the simple and easy-to-use object model interface, provide the most basic parameters (i.e., the third instruction), and the object model interface will automatically complete the entire operation process internally.
[0077] In this specification, taking the function of writing the temperature value collected by the sensor into the physical model as an example, the aforementioned first instruction can be to write the temperature value collected by the sensor into the attribute value corresponding to the temperature attribute in the physical model. This first instruction is a write-type instruction, which can be an instruction from the aforementioned instruction set. Of course, it can also be an instruction (i.e., the second instruction) obtained by assembling the temperature value and temperature (i.e., the parameter to be assembled) through the instruction assembly interface. The processing logic corresponding to this first instruction can call the physical model interface to determine the physical model corresponding to the first instruction, i.e., the physical model corresponding to temperature, and then write the temperature value into the attribute value corresponding to the temperature attribute in the physical model, that is, to use the temperature value as the attribute value corresponding to the temperature attribute in the physical model.
[0078] Based on this, as shown in Figure 3, which is a schematic diagram of a process for writing data into a physical model provided in this specification, the sensor can send the first instruction to the instruction transmission component. The instruction transmission component parses the first instruction through the instruction thread to determine the parsing result, namely, the temperature and temperature value. Then, it determines the processing logic corresponding to the first instruction and executes the determined processing logic based on the parsing result. Specifically, a third instruction can be generated based on the parsing result. This third instruction is for writing to the physical model corresponding to the temperature attribute, and it also includes the temperature and temperature value. The physical model interface is called, and the third instruction is sent to the physical model interface so that the physical model interface determines the physical model corresponding to the third instruction, i.e., the physical model corresponding to the temperature attribute, based on the mapping table, and uses the temperature value as the attribute value corresponding to the temperature attribute in the determined physical model to update the physical model.
[0079] Furthermore, taking the scenario of reading the temperature value corresponding to the temperature in the object model and sending the read temperature value to the sensor as an example, the sensor is a sensor equipped with an independent arithmetic unit or computing unit. The aforementioned first instruction can be to read the temperature value corresponding to the temperature in the object model and send the temperature value to the sensor. This first instruction is a read-type instruction, which can be an instruction from the aforementioned instruction set. Of course, it can also be an instruction (i.e., the second instruction) obtained by assembling the temperature (i.e., the parameter to be assembled) through an instruction assembly interface. The processing logic corresponding to this first instruction is to call the object model interface to read the temperature value corresponding to the temperature in the object model, and then call the instruction assembly interface to assemble the read temperature value into a second instruction in a preset format, and send the second instruction to the sensor.
[0080] Based on this, as shown in Figure 4, which is a schematic diagram of a process for reading data from an object model provided in this specification, the sensor can send the first instruction to the instruction transmission component. The instruction transmission component parses the first instruction through the instruction thread to determine the parsing result, i.e., temperature. Then, it determines the processing logic corresponding to the first instruction and executes the determined processing logic based on the parsing result. Specifically, a third instruction can be generated based on the parsing result. This third instruction is for reading the object model corresponding to the temperature attribute, and it also includes the temperature. The object model interface is called, and the third instruction is sent to the object model interface so that the object model interface determines the object model corresponding to the third instruction, i.e., the object model corresponding to the temperature attribute, based on the mapping table, and then determines and returns the temperature value corresponding to the temperature in the object model. The instruction assembly interface is called to assemble the temperature value (i.e., the parameter to be assembled) to obtain a second instruction in a preset format. Then, the second instruction is sent to the instruction transmission component through the instruction thread, so that the instruction transmission component sends the second instruction to the sensor.
[0081] In this specification, the aforementioned development components also include an initialization interface. This interface is used to initialize the basic configuration of the firmware when programming the firmware of the smart home device. This basic configuration includes basic configuration of the Matter protocol, network configuration, Bluetooth configuration, OTA (Over-the-Air) related configuration, binding related configuration, and subscription related configuration, including Thread network configuration. Furthermore, all of the above basic configurations are default configurations to ensure the complete functionality and performance of the smart home device, while also shielding the second user from complex configuration details. Of course, in addition to the basic configurations, the firmware configuration also includes other configurations that the second user needs to manually configure. These other configurations may include the smart home device's hardware drivers, RF configuration, external dependent resources, etc. This specification does not specifically limit these; the second user can manually write relevant configuration files or configure them manually.
[0082] In this specification, the existing Matter SDK is primarily developed using C++, while developers are generally proficient in C. This mismatch between developers' technical skills and the requirements of the Matter SDK raises the barrier to entry for developing smart home devices and reduces development efficiency. Therefore, the aforementioned development component also includes a C language interface. This C language interface is used to convert the code input from the second user into C++ target code. This code can be the content input by the second user, such as a callback function, a first instruction, the processing logic corresponding to the first instruction, a mapping table, and parameters to be assembled.
[0083] In this specification, the device involved in the first and second instructions may also be a device that does not have an independent arithmetic unit and computing unit. However, in this case, the code corresponding to the data transmission between the device and the firmware needs to be manually written by the second user.
[0084] In this specification, in order to promptly notify the first user of changes in the terminal object model, the firmware can call the object model interface through the program to determine the object model, and send the data contained in the object model, i.e., the attributes and the corresponding attribute values, to the first user's terminal through the Matter SDK subscription interface and display them.
[0085] As shown in Figure 5, which is a schematic diagram of a development component provided in this specification, the development component shown in Figure 5 may include a first interface and a second interface. The first interface is related to Matter protocol development and includes the aforementioned initialization interface, callback interface, object model interface, and C language interface. The second interface is related to instruction development and includes an instruction addition interface and an instruction assembly interface. Of course, the above-mentioned development component also includes a callback thread, an instruction thread, a cross-platform interface, and the Matter SDK. The cross-platform interface may also include a hardware interface and a system interface.
[0086] The above describes one or more implementations of this specification. Based on the same idea, this specification also provides a corresponding smart home device operating device, as shown in Figure 6.
[0087] Figure 6 is a schematic diagram of a smart home device operating mechanism provided in this specification, including:
[0088] The startup module 200 is used to respond to the startup operation of the first user's terminal, start the smart home device, and run the pre-written program corresponding to the smart home device; wherein, the program is used to control the smart home device to perform functions;
[0089] The calling module 202 is used to call a pre-set callback interface through the program when it receives a specified instruction for instructing the smart home device to perform a specified function; wherein the callback interface satisfies the Matter protocol, the callback interface stores several callback functions for implementing the functions of the smart home device, and the callback functions are functions pre-set by the second user that do not satisfy the Matter protocol;
[0090] The determining module 204 is used to determine, from the callback functions stored in the callback interface, the callback function used to implement the specified function, and use it as the target callback function;
[0091] The execution module 206 is used to run the target callback function.
[0092] Optionally, the program is pre-written based on a pre-set development component, the development component including the callback interface, the callback interface being used to store the callback functions when the second user inputs the callback functions.
[0093] Optionally, the development component further includes a hardware interface, which is used to determine the target hardware selected by the second user in response to the second user's selection operation, and to compile the project file corresponding to the smart home device into an executable file corresponding to the target hardware.
[0094] Optionally, the development component further includes an instruction addition interface, which is used to add the first instruction to the instruction set of the smart home device when a first instruction in a preset format is received from the second user.
[0095] Optionally, the development component further includes an instruction transmission component and an instruction assembly interface. The instruction assembly interface is used to assemble the parameters to be assembled into a second instruction in a preset format when the parameters to be assembled are received. The instruction transmission component is used to send the second instruction to the device corresponding to the second instruction.
[0096] Optionally, the development component further includes a property model interface and a lightweight property model. The lightweight property model is a property model corresponding to the function of the smart home device. The property model interface is used to store the mapping relationship table when the second user inputs the mapping relationship table, and to determine the property model corresponding to the third instruction according to the mapping relationship table when the third instruction is received, and to perform the operation corresponding to the third instruction on the determined property model. The mapping relationship table includes the mapping relationship between the parameters required to implement the function of the smart home device and the lightweight property model.
[0097] Optionally, the development component further includes an initialization interface for initializing the basic configuration of the firmware when programming the firmware of the smart home device.
[0098] Optionally, the development component further includes a cross-platform interface, which is used to respond to the selection operation of the second user, determine the target information selected by the second user, and compile the project file corresponding to the smart home device into an executable file corresponding to the target information.
[0099] Optionally, the development component further includes a system interface, which is used to respond to the selection operation of the second user, determine the target system selected by the second user, and compile the project file corresponding to the smart home device into an executable file corresponding to the target system.
[0100] This specification also provides a computer-readable storage medium storing a computer program that can be used to execute a smart home device operation method shown in Figure 1 above.
[0101] This specification also provides a schematic structural diagram of an electronic device corresponding to Figure 1, as shown in Figure 7. As shown in Figure 7, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, memory, and non-volatile memory, and may also include other hardware required for business operations. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to implement the smart home device operation method described in Figure 1.
[0102] Of course, in addition to software implementation, this specification does not exclude other implementation methods, such as logic devices or a combination of hardware and software. In other words, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0103] In the 1990s, improvements to a technology could be clearly distinguished as either hardware improvements (e.g., improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the methodology). However, with technological advancements, many methodological improvements today can be considered direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved methodology into the hardware circuit. Therefore, it cannot be said that a methodological improvement cannot be implemented using hardware physical modules. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logic function is determined by the user programming the device. Designers can program and "integrate" a digital system onto a PLD themselves, without needing chip manufacturers to design and manufacture dedicated integrated circuit chips. Furthermore, nowadays, instead of manually manufacturing integrated circuit chips, this programming is mostly implemented using "logic compiler" software. Similar to the software compiler used in program development, the original code before compilation must also be written in a specific programming language, called a Hardware Description Language (HDL). There are many HDLs, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, and RHDL (Ruby Hardware Description Language). Currently, the most commonly used are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also understand that by simply performing some logic programming on the method flow using one of these hardware description languages and programming it into an integrated circuit, the hardware circuit implementing the logical method flow can be easily obtained.
[0104] The controller can be implemented in any suitable manner. For example, it can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicon Labs C8051F320. A memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also recognize that, in addition to implementing the controller in purely computer-readable program code form, the same functionality can be achieved by logically programming the method steps to make the controller take the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, such a controller can be considered a hardware component, and the means included therein for implementing various functions can also be considered as structures within the hardware component. Alternatively, the means for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.
[0105] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.
[0106] For ease of description, the above devices are described in terms of function, divided into various units. Of course, in implementing this specification, the functions of each unit can be implemented in one or more software and / or hardware components.
[0107] Those skilled in the art will understand that embodiments of this specification can be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this specification may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0108] This specification is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this specification. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in one or more flowchart illustrations and / or one or more block diagrams.
[0109] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means that implement the functions specified in one or more flowcharts and / or one or more block diagrams.
[0110] These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, such that the instructions, which execute on the computer or other programmable apparatus, provide steps for implementing the functions specified in one or more flowcharts and / or one or more block diagrams.
[0111] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0112] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0113] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0114] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0115] Those skilled in the art will understand that the embodiments of this specification can be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this specification may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0116] This specification can be described in the general context of computer-executable instructions that are executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a specific task or implement a specific abstract data type. This specification can also be practiced in distributed computing environments, where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0117] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
[0118] The above description is merely an embodiment of this specification and is not intended to limit this specification. Various modifications and variations can be made to this specification by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of the claims of this specification.
Claims
1. A smart home device operation method, characterized by, include: In response to the startup operation of the first user's terminal, the smart home device is started and a pre-written program corresponding to the smart home device is run; wherein, the program is used to control the smart home device to perform functions; When a specified instruction is received to instruct the smart home device to perform a specified function, the program calls a pre-set callback interface; wherein, the callback interface satisfies the Matter protocol, and the callback interface stores several callback functions for implementing the functions of the smart home device, and the callback functions are functions pre-set by the second user that do not satisfy the Matter protocol; From the callback functions stored in the callback interface, determine the callback function used to implement the specified function, and use it as the target callback function; Run the target callback function.
2. The method of claim 1, wherein, The program is pre-written based on a pre-set development component, which includes the callback interface. The callback interface is used to store the callback functions when the second user inputs the callback functions.
3. The method of claim 2, wherein, The development component also includes a hardware interface, which is used to respond to the second user's selection operation, determine the target hardware selected by the second user, and compile the project file corresponding to the smart home device into an executable file corresponding to the target hardware.
4. The method of claim 2, wherein, The development component also includes an instruction addition interface, which is used to add the first instruction to the instruction set of the smart home device when a first instruction in a preset format is received from the second user.
5. The method of claim 2, wherein, The development component also includes an instruction transmission component and an instruction assembly interface. The instruction assembly interface is used to assemble the parameters to be assembled into a second instruction in a preset format when the parameters to be assembled are received. The instruction transmission component is used to send the second instruction to the device corresponding to the second instruction.
6. The method of claim 2, wherein, The development components also include a property model interface and a lightweight property model. The lightweight property model is a property model corresponding to the functions of the smart home device. The property model interface is used to store the mapping relationship table when it receives the mapping relationship table input by the second user, and to determine the property model corresponding to the third instruction according to the mapping relationship table when it receives the third instruction, and to perform the operation corresponding to the third instruction on the determined property model. The mapping relationship table includes the mapping relationship between the parameters required to implement the functions of the smart home device and the lightweight property model.
7. The method of claim 2, wherein, The development component also includes an initialization interface, which is used to initialize the basic configuration of the firmware when programming the firmware of the smart home device.
8. The method of claim 2, wherein, The development component also includes a cross-platform interface, which is used to respond to the selection operation of the second user, determine the target information selected by the second user, and compile the project file corresponding to the smart home device into an executable file corresponding to the target information.
9. The method of claim 2, wherein, The development component also includes a system interface, which is used to respond to the second user's selection operation, determine the target system selected by the second user, and compile the project file corresponding to the smart home device into an executable file corresponding to the target system.
10. A smart home device operation apparatus, characterized by comprising: include: A startup module is used to respond to a startup operation from the first user's terminal, start the smart home device, and run a pre-written program corresponding to the smart home device; wherein, the program is used to control the smart home device to perform functions; The calling module is used to call a pre-set callback interface through the program when it receives a specified instruction to instruct the smart home device to perform a specified function; wherein the callback interface satisfies the Matter protocol, the callback interface stores several callback functions for implementing the functions of the smart home device, and the callback functions are functions pre-set by the second user that do not satisfy the Matter protocol; The determining module is used to determine, from the callback functions stored in the callback interface, the callback function used to implement the specified function, and use it as the target callback function; The execution module is used to run the target callback function.
11. A computer readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the method described in any one of claims 1 to 9.
12. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method described in any one of claims 1 to 9.