CN116760894A - Data sharing method, device and equipment of Internet of things equipment and storage medium - Google Patents

Data sharing method, device and equipment of Internet of things equipment and storage medium Download PDF

Info

Publication number
CN116760894A
CN116760894A CN202310712317.7A CN202310712317A CN116760894A CN 116760894 A CN116760894 A CN 116760894A CN 202310712317 A CN202310712317 A CN 202310712317A CN 116760894 A CN116760894 A CN 116760894A
Authority
CN
China
Prior art keywords
data
internet
knx
shared memory
target
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202310712317.7A
Other languages
Chinese (zh)
Inventor
周春喜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Shendu Technology Co ltd
Original Assignee
Hangzhou Shendu Technology Co ltd
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 Hangzhou Shendu Technology Co ltd filed Critical Hangzhou Shendu Technology Co ltd
Priority to CN202310712317.7A priority Critical patent/CN116760894A/en
Publication of CN116760894A publication Critical patent/CN116760894A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/544Buffers; Shared memory; Pipes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/04Protocols for data compression, e.g. ROHC

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Medical Informatics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Computer And Data Communications (AREA)

Abstract

The application discloses a data sharing method, a device, equipment and a storage medium of an internet of things device, which relate to the field of data sharing and comprise the following steps: distributing a section of shared memory special for storing equipment data for a preset number of knx group addresses by utilizing self identification and through a shared memory function of an operating system; respectively distributing a plurality of target knx group addresses for each Internet of things device based on classification results of the plurality of Internet of things devices accessed to the local machine; converting the equipment data corresponding to each Internet of things equipment into corresponding unified knx format data; and storing the unified knx format data corresponding to each Internet of things device into the memory segment corresponding to each target knx group address in the shared memory so as to complete data sharing of each Internet of things device. The application realizes the sharing of data by converting the data of each Internet of things device into the data in knx format and storing the data in the shared memory independent of the access program of each device, thereby ensuring the consistency of the data and preventing the data from being lost.

Description

Data sharing method, device and equipment of Internet of things equipment and storage medium
Technical Field
The present application relates to the field of data sharing, and in particular, to a method, an apparatus, a device, and a storage medium for sharing data of an internet of things device.
Background
In general, a large number of devices are accessed in a smart home, each device has a large amount of own data, each device may be accessed by different programs, each program needs to store information of the used device, for functions related to linkage and the like, the program needs to store information of the device accessed by itself and also needs to know information of the devices accessed by other subroutines, for the case, the information of the devices needs to be queried and stored in the other programs, so that a large amount of data is easy to repeatedly store among different programs, and updating and synchronizing query is a huge loss on performance, and the problem of inconsistent data cannot be avoided, and when the programs are restarted, the data is easy to be lost completely, or the data needs to be re-acquired and stored.
Disclosure of Invention
Accordingly, the present application is directed to a method, apparatus, device and storage medium for sharing data of an internet of things device, which can convert data of each internet of things device into data in knx format, and store the data in a shared memory independent of each internet of things device, thereby realizing sharing of data, ensuring consistency of data and preventing data loss. The specific scheme is as follows:
in a first aspect, the present application provides a data sharing method of an internet of things device, applied to a host, including:
a section of shared memory special for storing equipment data is allocated for a preset number of knx group addresses by utilizing self identification and through a shared memory function of a preset operating system;
classifying a plurality of internet of things devices accessed to a local machine, and respectively distributing a plurality of target knx group addresses positioned in the preset knx group addresses for each internet of things device based on classification results;
converting the equipment data corresponding to each Internet of things equipment by using a preset data structure to obtain corresponding unified knx format data;
and storing the unified knx format data corresponding to each Internet of things device into a memory segment corresponding to each target knx group address in the shared memory so as to complete data sharing of the plurality of Internet of things devices.
Optionally, before allocating a section of shared memory dedicated for storing device data for a preset number of knx group addresses by using self-identification and through a shared memory function of a preset operating system, the method further includes:
the first byte number occupied by each knx group address is determined, and the number of knx group addresses is determined based on the first byte number to obtain a preset number of knx group addresses.
Optionally, the allocating a section of shared memory dedicated for storing device data for a preset number of knx group addresses by using self-identification and through a shared memory function of a preset operating system includes:
determining a second byte number occupied by data stored in the preset data structure, and calculating a target memory capacity based on the second byte number and the preset number;
and allocating a section of shared memory which is specially used for storing equipment data and corresponds to the target memory capacity for the preset number of knx group addresses by utilizing self identification and a shmem function of a linux operating system.
Optionally, the classifying the plurality of internet of things devices accessing the local device, and respectively allocating a plurality of target knx group addresses located in the preset number of knx group addresses to each of the internet of things devices based on a classification result, including:
classifying functional attributes contained in target internet of things equipment accessed to the local machine to obtain a plurality of functional attribute categories; the target internet of things device is any one of the plurality of internet of things devices;
and distributing corresponding target knx group addresses in the preset knx group addresses to the target Internet of things equipment based on the functional attribute categories.
Optionally, the converting, by using a preset data structure, the device data corresponding to each of the internet of things devices to obtain corresponding unified knx format data includes:
converting the function attribute data corresponding to each function attribute category in the target internet of things device by using a preset data structure to obtain corresponding unified knx format data;
correspondingly, the storing the unified knx format data corresponding to each of the internet of things devices in the memory segment corresponding to each of the target knx group addresses in the shared memory includes:
and storing the unified knx format data corresponding to each functional attribute category in the target internet of things device into a memory segment corresponding to each target knx group address in the shared memory.
Optionally, after the completion of the data sharing on the plurality of internet of things devices, the method further includes:
and after the local machine is started, loading the shared memory of the local machine through the self identification.
Optionally, after the completion of the data sharing on the plurality of internet of things devices, the method further includes:
after receiving data of other hosts, inquiring whether a target shared memory for storing the data of the other hosts exists in the local machine or not based on the identifiers corresponding to the other hosts;
if the data of the other hosts does not exist, the target shared memory is created in the host based on the identification of the other hosts, and the received data of the other hosts are stored by using the target shared memory;
if so, loading the target shared memory, and modifying the data in the target shared memory by utilizing the received data of the other hosts.
In a second aspect, the present application provides a data sharing apparatus of an internet of things device, applied to a host, including:
the shared memory allocation module is used for allocating a section of shared memory special for storing equipment data for a preset number of knx group addresses by utilizing self identification and through a shared memory function of a preset operating system;
the address allocation module is used for classifying a plurality of internet of things devices accessed to the local machine and respectively allocating a plurality of target knx group addresses positioned in the preset number of knx group addresses to each internet of things device based on a classification result;
the data format conversion module is used for converting the equipment data corresponding to each Internet of things equipment by utilizing a preset data structure so as to obtain corresponding unified knx format data;
and the data sharing module is used for storing the unified knx format data corresponding to each Internet of things device into the memory segment corresponding to each target knx group address in the shared memory so as to complete data sharing of the plurality of Internet of things devices.
In a third aspect, the present application provides an electronic device, comprising:
a memory for storing a computer program;
and the processor is used for executing the computer program to realize the data sharing method of the internet of things device.
In a fourth aspect, the present application provides a computer readable storage medium storing a computer program, which when executed by a processor, implements the method for sharing data of an internet of things device described above.
In the application, a section of shared memory special for storing equipment data is allocated for a preset number of knx group addresses by utilizing self identification and through a shared memory function of a preset operating system; classifying a plurality of internet of things devices accessed to a local machine, and respectively distributing a plurality of target knx group addresses positioned in the preset knx group addresses for each internet of things device based on classification results; converting the equipment data corresponding to each Internet of things equipment by using a preset data structure to obtain corresponding unified knx format data; and storing the unified knx format data corresponding to each Internet of things device into a memory segment corresponding to each target knx group address in the shared memory so as to complete data sharing of the plurality of Internet of things devices. Therefore, the shared memory special for storing the equipment data is allocated by utilizing the self identifier and through the shared memory function of the preset operating system, so that the equipment data converted into the unified knx format is stored into the shared memory later, the sharing of the equipment data can be realized, the repeated storage of the equipment data is avoided, the shared memories corresponding to different hosts can be distinguished according to the identifiers corresponding to the different hosts, and the shared memory is independent of each equipment access program, so that the problem of higher performance consumption when the equipment data is synchronously updated due to the fact that the equipment data are stored in each equipment access program is avoided, the consistency when the equipment data is synchronously updated is ensured, and the problem of data loss or the need of equipment data re-storage when the equipment access program is restarted is prevented; in addition, the application converts the device data into unified knx format data by adopting a high-efficiency data compression structure, reduces the occupation of the memory and improves the efficiency of data retrieval.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present application, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a data sharing method of an Internet of things device disclosed by the application;
FIG. 2 is a schematic diagram of a preset number of knx set addresses according to the present disclosure;
FIG. 3 is a flow chart of a shared memory according to the present application;
FIG. 4 is a flowchart of a data sharing method of a specific Internet of things device according to the present application;
fig. 5 is a schematic structural diagram of a data sharing device of an internet of things device according to the present disclosure;
fig. 6 is a block diagram of an electronic device according to the present disclosure.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
Under normal conditions, each program accessing to the smart home needs to store information of equipment accessed by the program itself and information of other equipment accessed by the connected subroutines, so that a large amount of data is easily and repeatedly stored among different programs, and updating and synchronous inquiry are huge loss of performance and cannot avoid the problem of inconsistent data; when the program is restarted, the data is easy to be lost completely, or the data needs to be acquired again and stored. Therefore, the application provides a data sharing method of the internet of things device, which realizes data sharing by converting the data of each internet of things device into knx format data and storing the knx format data in a shared memory independent of access programs of each device, thereby ensuring the consistency of the data and preventing the data from losing.
Referring to fig. 1, an embodiment of the present application discloses a data sharing method of an internet of things device, which is applied to a host, and includes:
step S11, a section of shared memory special for storing equipment data is allocated for a preset number of knx group addresses by utilizing self identification and through a shared memory function of a preset operating system.
In this embodiment, before allocating a section of shared memory dedicated for storing device data to a preset number of knx group addresses by using self-identification and through a shared memory function of a preset operating system, determining a first byte number occupied by each knx group address, and determining the number of knx group addresses based on the first byte number to obtain a preset number of knx group addresses. It will be appreciated that since the operating system is based on knx, each of the local access devices may be assigned one or more knx addresses, each knx address occupying a first byte of 2 bytes, 2 bytes being 16 bits, 2 16 The number of knx set addresses is 65536, i.e. the preset number is 65536.
In this embodiment, the allocating a section of shared memory dedicated for storing device data to a preset number of knx group addresses by using self-identification and through a shared memory function of a preset operating system may include determining a second byte number occupied by data stored in the preset data structure, and calculating a target memory capacity based on the second byte number and the preset number; and allocating a section of shared memory which is specially used for storing equipment data and corresponds to the target memory capacity for the preset number of knx group addresses by utilizing self identification and a shmem function of a linux operating system. It will be appreciated that each internet of things device may be assigned a plurality of knx group addresses according to different types, and the data corresponding to each knx group address has different attributes, such as data length, address type, etc., so that a corresponding data structure needs to be designed to store the data of the internet of things device. The number and types of the internet of things devices accessed to the local machine are not fixed because the number of knx group addresses is 65536 at maximum, so that 65536 knx group addresses can be directly stored, the second byte number occupied by the data stored in the preset data structure is 24 bytes, namely the device data corresponding to one knx group address occupies 24 bytes, the memory capacity can be obtained by multiplying the second byte number by the preset number, namely 24×65536 bytes=1.5m, and then a section of shared memory which is specially used for storing the device data and is independent of 1.5M of the access program of each internet of things device is allocated for 65536 knx group addresses by utilizing the self identification id through the shmem function of the linux operating system.
And step S12, classifying a plurality of internet of things devices accessed to the local machine, and respectively distributing a plurality of target knx group addresses positioned in the preset number of knx group addresses for each internet of things device based on the classification result.
In this embodiment, as shown in fig. 2, the sorting result includes, for example, air conditioning, floor heating, fresh air, equipment a, equipment B, etc., where each piece of equipment needs to be respectively allocated with a plurality of target knx group addresses located in 65536 knx group addresses, for example, air conditioning, and because the air conditioning includes multiple functional attributes, a plurality of target knx group addresses are allocated to the air conditioning.
And S13, converting the device data corresponding to each Internet of things device by using a preset data structure to obtain corresponding unified knx format data.
In this embodiment, the preset data structure is as follows:
wherein val_type represents the length type of the device data, and the value includes 0,1,2,3,4, etc., corresponding to the data type of knx; addr_type represents the distinction of a plurality of knx group addresses corresponding to one internet of things device, for example, for an air conditioner, 0 is a switch address, 1 is a mode address, 2 is a wind speed address, etc.; dev_type represents the type of the internet of things device and is used for distinguishing different device types, such as defining that an air conditioner is 3, a floor heating is 4 and the like; the client_id represents the id of the subprogram accessed by the internet of things device and is used for distinguishing which subprogram is accessed to the current address; reserved represents reserved data, so as to realize byte alignment and support certain custom expansion; val represents the value of the current address; mac represents the physical address of the module to which the current address belongs; extension represents an extension attribute, and certain necessary data is stored according to bits; last_active represents the time of last update of the current address; reserved represents reserved data, and supports custom expansion attributes; inout represents the read-write type of the address, 1 represents readable, 2 represents writable, 3 represents readable and writable; exist indicates whether the current address exists, 0 is absent, 1 is present, and whether each knx group address actually exists can be distinguished through extension.
In this embodiment, the above preset data structure is used to convert the device data corresponding to each internet of things device to obtain corresponding unified knx format data, so that format conversion of the device data corresponding to each knx group address can be achieved through the above preset data structure, so that the converted knx format data can contain as many parameters with different attributes as possible, and storage space is saved in a byte alignment and bit manner.
Step S14, storing the unified knx format data corresponding to each of the internet of things devices into the memory segment corresponding to each of the target knx group addresses in the shared memory, so as to complete data sharing of the plurality of internet of things devices.
In this embodiment, the unified knx format data converted by each internet of things device is respectively stored in the memory segment corresponding to the target knx group address in the shared memory, so that data sharing of each internet of things device accessed to the local is realized through the shared memory.
In this embodiment, after the completion of data sharing on the plurality of internet of things devices, loading the shared memory of the local device through the self identifier may be further included after the local device is started. It can be understood that, as shown in fig. 3, if the host a is started, the shared memory of the host a can be loaded through the id=a of the host a; correspondingly, other hosts can load the corresponding shared memory according to the self identification.
In this embodiment, after the completion of data sharing on the plurality of internet of things devices, the method may further include: after receiving data of other hosts, inquiring whether a target shared memory for storing the data of the other hosts exists in the local machine or not based on the identifiers corresponding to the other hosts; if the data of the other hosts does not exist, the target shared memory is created in the host based on the identification of the other hosts, and the received data of the other hosts are stored by using the target shared memory; if so, loading the target shared memory, and modifying the data in the target shared memory by utilizing the received data of the other hosts. It can be understood that, as shown in fig. 3, if the host a receives data of another host (host B), whether there is a target shared memory of the host B in the host a based on the id=b of the host B, where the target shared memory is used for storing the data of the host B; if the target shared memory of the host B does not exist in the local machine a, creating the target shared memory of the host B in the local machine a based on the identification id=b of the host B, so as to store the received data of the host B by using the target shared memory of the host B; if the target shared memory of the host B exists in the local machine A, loading the target shared memory of the host B based on the identification of the host B, and modifying the data in the target shared memory by utilizing the received data of the host B.
In this embodiment, as shown in fig. 3, if the host a receives a query request for data of the host B, whether the target shared memory of the host B exists is queried in the host a based on the identifier of the host B, and if the target shared memory of the host B exists in the host a, the target shared memory of the host B is loaded; if the target shared memory of the host B does not exist in the local machine A, an error message is returned. It can be seen that the subsequent reading and modification of the device data is achieved by manipulating the data in the shared memory.
Therefore, the shared memory special for storing the equipment data is allocated by utilizing the self identifier and through the shared memory function of the preset operating system, so that the equipment data converted into the unified knx format is stored into the shared memory later, the sharing of the equipment data can be realized, the repeated storage of the equipment data is avoided, the shared memories corresponding to different hosts can be distinguished according to the identifiers corresponding to the different hosts, and the shared memory is independent of each equipment access program, so that the problem of higher performance consumption when the equipment data is synchronously updated due to the fact that the equipment data are stored in each equipment access program is avoided, the consistency when the equipment data is synchronously updated is ensured, and the problem of data loss or the need of equipment data re-storage when the equipment access program is restarted is prevented; in addition, the application converts the device data into unified knx format data by adopting a high-efficiency data compression structure, reduces the occupation of the memory and improves the efficiency of data retrieval.
Based on the previous embodiment, the present application describes how to implement the overall process of sharing data of the internet of things device, and next, the present application will be described in detail how to store the data of the internet of things device of a certain access host into the shared memory. Referring to fig. 4, an embodiment of the present application discloses a process of sharing data storage, which is applied to a host, and includes:
step S21, classifying functional attributes contained in the target internet of things equipment accessed to the local machine to obtain a plurality of functional attribute categories; the target internet of things device is any one of a plurality of internet of things devices accessed to the local machine.
In this embodiment, for any one target internet of things device connected to the local, the functional attributes included in the target internet of things device need to be classified to obtain a plurality of functional attribute categories, for example, the air conditioner includes a switch attribute, a mode attribute, a wind speed attribute, a temperature attribute, an error code attribute, etc., or the light may include only one switch attribute.
Step S22, allocating a corresponding plurality of target knx group addresses located in the preset plurality of knx group addresses to the target internet of things device based on the plurality of functional attribute categories.
In this embodiment, a plurality of target knx group addresses, which are located in 65536 knx group addresses and have the same number as the function attribute categories, are allocated to the target internet of things device based on the plurality of function attribute categories contained in the target internet of things device, that is, the number of function attribute categories contained in the target internet of things device determines how many target knx group addresses are allocated to the target internet of things device. For example, 5 target knx group addresses in 65536 knx group addresses are allocated to the air conditioner, namely a switch knx group address corresponding to a switch attribute, a mode knx group address corresponding to a mode attribute, a wind speed knx group address corresponding to a wind speed attribute, a temperature knx group address corresponding to a temperature attribute and an error code knx group address corresponding to an error code attribute; alternatively, 1 target knx group address among 65536 knx group addresses, that is, a switch knx group address corresponding to a switch attribute is allocated to the lamp light.
Step S23, converting the function attribute data corresponding to each function attribute category in the target internet of things device by using a preset data structure, so as to obtain corresponding unified knx format data.
In this embodiment, format conversion is performed on the functional attribute data corresponding to each functional attribute category in the target internet of things device by using a preset data structure, so as to obtain corresponding unified knx format data. For example, the air conditioner includes a switch attribute, a mode attribute, a wind speed attribute, a temperature attribute, and an error code attribute, and the switch data corresponding to the switch attribute of the air conditioner is converted into corresponding unified knx format data according to a preset data structure, and similarly, format conversion is performed on the data corresponding to the remaining four function attributes.
Step S24, storing the unified knx format data corresponding to each of the functional attribute categories in the target internet of things device into the memory segment corresponding to each of the target knx group addresses in the shared memory.
In this embodiment, since a plurality of target knx group addresses with the same number as the functional attribute categories have been allocated to the target internet of things device, the converted unified knx format data corresponding to each functional attribute category in the target internet of things device is stored in the memory segment corresponding to the target knx group address in the shared memory. For example, the converted unified knx format data corresponding to the switch attribute, the mode attribute, the wind speed attribute, the temperature attribute and the error code attribute in the air conditioner are stored into the memory fragments corresponding to the 5 target knx group addresses allocated for the air conditioner in the shared memory.
Therefore, the application can realize the sharing of the device data and avoid the repeated storage of the device data by storing the device data converted into the uniform knx format into the shared memory, and can avoid the problem of larger performance consumption when synchronously updating the device data caused by storing the device data in the device access programs because the shared memory is independent of the device access programs, ensure the consistency when synchronously updating the device data and prevent the problem of data loss or the need of re-storing the device data caused by restarting the device access programs; in addition, the application converts the device data into unified knx format data by adopting a high-efficiency data compression structure, reduces the occupation of the memory and improves the efficiency of data retrieval.
Referring to fig. 5, an embodiment of the present application discloses a data sharing device of an internet of things device, which is applied to a host, and includes:
the shared memory allocation module 11 is configured to allocate a section of shared memory dedicated for storing device data to a preset number of knx group addresses by using a self-identifier and through a shared memory function of a preset operating system;
the address allocation module 12 is configured to classify a plurality of internet of things devices accessing the local device, and allocate a plurality of target knx group addresses located in the preset number of knx group addresses to each of the internet of things devices based on a classification result;
the data format conversion module 13 is configured to convert device data corresponding to each of the internet of things devices by using a preset data structure, so as to obtain corresponding unified knx format data;
the data sharing module 14 is configured to store the unified knx format data corresponding to each of the internet of things devices into a memory segment corresponding to each of the target knx group addresses in the shared memory, so as to complete data sharing of the plurality of internet of things devices.
Therefore, the shared memory special for storing the equipment data is allocated by utilizing the self identifier and through the shared memory function of the preset operating system, so that the equipment data converted into the unified knx format is stored into the shared memory later, the sharing of the equipment data can be realized, the repeated storage of the equipment data is avoided, the shared memories corresponding to different hosts can be distinguished according to the identifiers corresponding to the different hosts, and the shared memory is independent of each equipment access program, so that the problem of higher performance consumption when the equipment data is synchronously updated due to the fact that the equipment data are stored in each equipment access program is avoided, the consistency when the equipment data is synchronously updated is ensured, and the problem of data loss or the need of equipment data re-storage when the equipment access program is restarted is prevented; in addition, the application converts the device data into unified knx format data by adopting a high-efficiency data compression structure, reduces the occupation of the memory and improves the efficiency of data retrieval.
In some specific embodiments, the data sharing device of the internet of things device may further include:
an address number determining unit, configured to determine a first byte number occupied by each knx group address, and determine the number of knx group addresses based on the first byte number, so as to obtain a preset number of knx group addresses.
In some embodiments, the shared memory allocation module 11 may specifically include:
the memory capacity determining unit is used for determining a second byte number occupied by the data stored in the preset data structure and calculating a target memory capacity based on the second byte number and the preset number;
the shared memory allocation unit is used for allocating a section of shared memory which is specially used for storing equipment data and corresponds to the target memory capacity for the preset number of knx group addresses by utilizing self identification and a shmem function of a linux operating system.
In some specific embodiments, the address allocation module 12 may specifically include:
the classifying unit is used for classifying the functional attributes contained in the target internet of things equipment accessed to the local machine to obtain a plurality of functional attribute categories; the target internet of things device is any one of the plurality of internet of things devices;
and the address allocation unit is used for allocating a corresponding plurality of target knx group addresses in the preset number of knx group addresses to the target Internet of things equipment based on the plurality of functional attribute categories.
In some specific embodiments, the data format conversion module 13 may specifically include:
the data format conversion unit is used for converting the function attribute data corresponding to each function attribute category in the target internet of things device by utilizing a preset data structure so as to obtain corresponding unified knx format data;
accordingly, the data sharing module 14 may specifically include:
and the data storage unit is used for storing the unified knx format data corresponding to each functional attribute type in the target internet of things device into the memory segment corresponding to each target knx group address in the shared memory.
In some specific embodiments, the data sharing device of the internet of things device may further include:
and the shared memory loading unit is used for loading the shared memory of the local machine through the self identification after the local machine is started.
In some specific embodiments, the data sharing device of the internet of things device may further include:
the shared memory inquiring unit is used for inquiring whether a target shared memory for storing the data of other hosts exists in the local machine or not based on the identification corresponding to the other hosts after the data of the other hosts are received;
the shared memory creating unit is used for creating the target shared memory in the local machine based on the identification of other hosts if the shared memory does not exist, so as to store the received data of the other hosts by utilizing the target shared memory;
and the data modification unit is used for loading the target shared memory if the target shared memory exists, and modifying the data in the target shared memory by utilizing the received data of the other hosts.
Further, the embodiment of the present application further discloses an electronic device, and fig. 6 is a block diagram of an electronic device 20 according to an exemplary embodiment, where the content of the figure is not to be considered as any limitation on the scope of use of the present application.
Fig. 6 is a schematic structural diagram of an electronic device 20 according to an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input output interface 25, and a communication bus 26. The memory 22 is configured to store a computer program, where the computer program is loaded and executed by the processor 21 to implement relevant steps in the data sharing method of the internet of things device disclosed in any of the foregoing embodiments. In addition, the electronic device 20 in the present embodiment may be specifically an electronic computer.
In this embodiment, the power supply 23 is configured to provide an operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and an external device, and the communication protocol to be followed is any communication protocol applicable to the technical solution of the present application, which is not specifically limited herein; the input/output interface 25 is used for acquiring external input data or outputting external output data, and the specific interface type thereof may be selected according to the specific application requirement, which is not limited herein.
The memory 22 may be a carrier for storing resources, such as a read-only memory, a random access memory, a magnetic disk, or an optical disk, and the resources stored thereon may include an operating system 221, a computer program 222, and the like, and the storage may be temporary storage or permanent storage.
The operating system 221 is used for managing and controlling various hardware devices on the electronic device 20 and computer programs 222, which may be Windows Server, netware, unix, linux, etc. The computer program 222 may further include a computer program that can be used to perform other specific tasks in addition to the computer program that can be used to perform the data sharing method of an internet of things device performed by the electronic device 20 as disclosed in any of the previous embodiments.
Further, the application also discloses a computer readable storage medium for storing a computer program; the data sharing method of the internet of things device is realized when the computer program is executed by the processor. For specific steps of the method, reference may be made to the corresponding contents disclosed in the foregoing embodiments, and no further description is given here.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, so that the same or similar parts between the embodiments are referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of functionality in order to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The foregoing has outlined rather broadly the more detailed description of the application in order that the detailed description of the application that follows may be better understood, and in order that the present principles and embodiments may be better understood; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present application, the present description should not be construed as limiting the present application in view of the above.

Claims (10)

1. The data sharing method of the Internet of things device is characterized by being applied to a host and comprising the following steps of:
a section of shared memory special for storing equipment data is allocated for a preset number of knx group addresses by utilizing self identification and through a shared memory function of a preset operating system;
classifying a plurality of internet of things devices accessed to a local machine, and respectively distributing a plurality of target knx group addresses positioned in the preset knx group addresses for each internet of things device based on classification results;
converting the equipment data corresponding to each Internet of things equipment by using a preset data structure to obtain corresponding unified knx format data;
and storing the unified knx format data corresponding to each Internet of things device into a memory segment corresponding to each target knx group address in the shared memory so as to complete data sharing of the plurality of Internet of things devices.
2. The method for sharing data of an internet of things device according to claim 1, wherein before allocating a section of shared memory dedicated for storing device data to a preset number of knx group addresses by using self-identification and through a shared memory function of a preset operating system, the method further comprises:
the first byte number occupied by each knx group address is determined, and the number of knx group addresses is determined based on the first byte number to obtain a preset number of knx group addresses.
3. The method for sharing data of an internet of things device according to claim 1, wherein the allocating a section of shared memory dedicated for storing device data for a preset number of knx group addresses by using self-identification and through a shared memory function of a preset operating system includes:
determining a second byte number occupied by data stored in the preset data structure, and calculating a target memory capacity based on the second byte number and the preset number;
and allocating a section of shared memory which is specially used for storing equipment data and corresponds to the target memory capacity for the preset number of knx group addresses by utilizing self identification and a shmem function of a linux operating system.
4. The method for sharing data of an internet of things device according to claim 1, wherein the classifying the plurality of internet of things devices accessing to the local machine and respectively allocating a plurality of target knx group addresses located in the preset number of knx group addresses to each of the internet of things devices based on a classification result comprises:
classifying functional attributes contained in target internet of things equipment accessed to the local machine to obtain a plurality of functional attribute categories; the target internet of things device is any one of the plurality of internet of things devices;
and distributing corresponding target knx group addresses in the preset knx group addresses to the target Internet of things equipment based on the functional attribute categories.
5. The method for sharing data of an internet of things device according to claim 4, wherein the converting, by using a preset data structure, device data corresponding to each of the internet of things devices to obtain corresponding unified knx format data includes:
converting the function attribute data corresponding to each function attribute category in the target internet of things device by using a preset data structure to obtain corresponding unified knx format data;
correspondingly, the storing the unified knx format data corresponding to each of the internet of things devices in the memory segment corresponding to each of the target knx group addresses in the shared memory includes:
and storing the unified knx format data corresponding to each functional attribute category in the target internet of things device into a memory segment corresponding to each target knx group address in the shared memory.
6. The method for sharing data of the internet of things device according to claim 1, further comprising, after the completion of the sharing of the data of the plurality of internet of things devices:
and after the local machine is started, loading the shared memory of the local machine through the self identification.
7. The method for sharing data of an internet of things device according to any one of claims 1 to 6, wherein after the completion of the sharing of data of the plurality of internet of things devices, further comprising:
after receiving data of other hosts, inquiring whether a target shared memory for storing the data of the other hosts exists in the local machine or not based on the identifiers corresponding to the other hosts;
if the data of the other hosts does not exist, the target shared memory is created in the host based on the identification of the other hosts, and the received data of the other hosts are stored by using the target shared memory;
if so, loading the target shared memory, and modifying the data in the target shared memory by utilizing the received data of the other hosts.
8. The utility model provides a data sharing device of thing allies oneself with equipment which characterized in that is applied to the host computer, includes:
the shared memory allocation module is used for allocating a section of shared memory special for storing equipment data for a preset number of knx group addresses by utilizing self identification and through a shared memory function of a preset operating system;
the address allocation module is used for classifying a plurality of internet of things devices accessed to the local machine and respectively allocating a plurality of target knx group addresses positioned in the preset number of knx group addresses to each internet of things device based on a classification result;
the data format conversion module is used for converting the equipment data corresponding to each Internet of things equipment by utilizing a preset data structure so as to obtain corresponding unified knx format data;
and the data sharing module is used for storing the unified knx format data corresponding to each Internet of things device into the memory segment corresponding to each target knx group address in the shared memory so as to complete data sharing of the plurality of Internet of things devices.
9. An electronic device, comprising:
a memory for storing a computer program;
a processor for executing the computer program to implement the data sharing method of the internet of things device according to any one of claims 1 to 7.
10. A computer readable storage medium for storing a computer program which when executed by a processor implements a data sharing method of an internet of things device as claimed in any one of claims 1 to 7.
CN202310712317.7A 2023-06-15 2023-06-15 Data sharing method, device and equipment of Internet of things equipment and storage medium Pending CN116760894A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310712317.7A CN116760894A (en) 2023-06-15 2023-06-15 Data sharing method, device and equipment of Internet of things equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310712317.7A CN116760894A (en) 2023-06-15 2023-06-15 Data sharing method, device and equipment of Internet of things equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116760894A true CN116760894A (en) 2023-09-15

Family

ID=87960286

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310712317.7A Pending CN116760894A (en) 2023-06-15 2023-06-15 Data sharing method, device and equipment of Internet of things equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116760894A (en)

Similar Documents

Publication Publication Date Title
CN106294190B (en) Storage space management method and device
CN109154917B (en) Storage system and solid state disk
CN112860592B (en) Data caching method and device based on linked list, electronic equipment and storage medium
JP2002169694A (en) Method and system for automatic allocation of boot server to pxe client on network via dhcp server
CN109800270B (en) Data storage and query method and Internet of things system
CN108845877B (en) Method, device and system for managing memory
CN111885216B (en) DNS query method, device, equipment and storage medium
US11356409B1 (en) Network address allocation management using prefix allocation trees
CN112434025B (en) Method, system, device and medium for optimizing index persistence
CN113794764A (en) Request processing method and medium for server cluster and electronic device
CN113805816B (en) Disk space management method, device, equipment and storage medium
CN110798507A (en) Method and system for DHCP address allocation memory
CN116301667B (en) Database system, data access method, device, equipment and storage medium
CN106934066B (en) Metadata processing method and device and storage equipment
CN117608856A (en) Memory expansion method, system, terminal and storage medium for NVMe (network video Me) acceleration card
CN116760894A (en) Data sharing method, device and equipment of Internet of things equipment and storage medium
CN115495023B (en) Data request method, device, equipment and storage medium
US11675510B2 (en) Systems and methods for scalable shared memory among networked devices comprising IP addressable memory blocks
CN116107509A (en) Data processing method and device and electronic equipment
US11875152B2 (en) Methods and systems for optimizing file system usage
CN115712581A (en) Data access method, storage system and storage node
CN113849510A (en) Data storage method, device and equipment of air conditioner and storage medium
CN115129709A (en) Data processing method, server and system
CN114020344A (en) Bus resource reservation method, device, equipment and storage medium
CN113905252A (en) Data storage method and device for live broadcast room, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination