A card resource allocation method for Internet of Things devices

By pre-placing only one seed card on the Internet of Things device and using the card resource server to dynamic card resource allocation, the problems of wasted and cost of card resources of many operators in the existing technology have been solved, and more efficient card resource utilization has been achieved.

CN116132461BActive Publication Date: 2025-03-18BEIJING SHUMI NETWORK TECH CO LTD +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211174564.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-26
Publication Date
2025-03-18
Estimated Expiration
2042-09-26

AI Technical Summary

Technical Problem

When existing IoT devices are deployed, telecommunications cards from multiple operators need to be pre-installed, resulting in high waste rate of card resource packages and huge total package investment costs.

Method used

When the IoT devices are deployed, only one seed card is pre-installed, and a new card is applied to the card resource server through the seed card network, and card resources are dynamically allocated according to the local signal strength and data traffic, and the statistical results are analyzed regularly to adjust card resources.

Benefits of technology

By dynamically allocating card resources, the utilization rate of card resource packages is improved and the investment cost of the overall card resource package is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116132461B_ABST
    Figure CN116132461B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention relates to a card resource allocation method for an Internet of Things device, the method comprising: obtaining a device identification and state when the Internet of Things device is reset; sending instructions to a card resource server when the device state is a first state and receiving new card data for loading, changing the device state to a second state and switching and resetting the network card; sending instructions to a card resource server when the device state is a second state and initializing the first, second and third counter values ​​when the return receipt is a successful binding, changing the device state to a third state and resetting; regularly updating the three counter values ​​when the device state is a third state, activating the card resource signal statistics list maintenance, the card resource flow statistics list maintenance and the card resource adjustment review according to the three counter values, switching new card resources when the review result is not a first-class result, and deleting old card resources according to the instructions issued by the card resource server. The present invention can improve the utilization rate of card resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular to a card resource allocation method for an Internet of Things device. Background Art

[0002] IoT devices are usually connected to the backend application platform based on the communication network of telecom operators. Therefore, at least one telecom card is pre-installed on each IoT device. Each telecom card has a set of personalized data (card ID, operator ID and operator card data) and corresponds to a traffic package. Given that the signal strength of telecom operators in each region varies, IoT application providers usually pre-install telecom cards of multiple operators on the devices when deploying IoT devices to ensure that IoT devices work properly. The disadvantages of this approach are obvious, which will result in a high waste rate of card resource packages purchased by IoT application providers and a huge total package investment cost. Summary of the invention

[0003] The purpose of the present invention is to provide a card resource allocation method, electronic device and computer-readable storage medium for Internet of Things devices in view of the defects of the prior art; when the front-end Internet of Things device is deployed, only one seed card is pre-set on the device; after being put into use, the Internet of Things device will first log in to the network based on the seed card and initiate a new card application to the back-end card resource server. After receiving the application, the card resource server sends the corresponding new card data to the Internet of Things device based on the initial telecommunications card pre-allocated to each Internet of Things device. After the new card is successfully downloaded and installed, the Internet of Things device enters the working state based on the new card log in network; during the operation of the device, the Internet of Things device will continuously count the signal strength of the local telecommunications operator and the data traffic of the local device and regularly analyze the statistical results. If the analysis result shows that the current operator's signal is insufficient or the package traffic of the current telecommunications card is too large or too small, the card resource server will initiate a new card application again and carry in the application Five types of analysis results. After receiving the application, the card resource server selects a matching telecom card from the card resource pool based on the five types of analysis results to allocate the new card and send the corresponding new card data to the IoT device. At the same time, the old card is included in the old card recycling list for management. After the new card is downloaded and installed successfully, the IoT device logs on to the network and enters the working state based on the switched new card; the card resource server will also regularly call the operator interface to track the traffic of each old card in the old card recycling list, and decide whether to completely recycle the old card based on the tracking results. If it is determined to be recycled, the old card recycling instruction will be sent to the IoT device, and the IoT device will retain the previous old card (except the seed card) data each time it switches to a new card until it receives the old card recycling instruction sent by the card resource server and deletes it; in addition, the card resource server will also control the expansion speed of the card resource pool based on the actual traffic usage of the front-end IoT device. Through the present invention, there is no need to pre-install telecommunication cards of multiple operators when deploying IoT devices. Card resources can be dynamically allocated to each IoT device based on the strength of the local telecommunication operator network signal of the IoT device and / or the data traffic usage of the device itself. The entire card resource pool can be dynamically expanded based on the card resource usage of all devices, thereby achieving the purpose of improving the utilization rate of card resource packages and reducing the overall card resource package investment cost.

[0004] To achieve the above-mentioned purpose, a first aspect of an embodiment of the present invention provides a card resource allocation method for an Internet of Things device, the method comprising:

[0005] Each time the IoT device is reset, the IoT device obtains a preset IoT device identifier and IoT device state from the local as the corresponding first device identifier and first device state; the first device state includes a first state, a second state and a third state;

[0006] Performing network login card identification processing according to a locally preset card resource list to generate a corresponding first network login card identifier; and performing network login processing according to the first network login card identifier;

[0007] When the network login process is successful and the first device state is the first state, a first new card application instruction carrying the first device identifier is sent to a remote card resource server; and first new card data sent back by the card resource server is received; and new card data loading process is performed according to the first new card data; if the new card data loading process is successful, the state of the Internet of Things device is changed to the second state, and the network login card switching process is performed on the card resource list according to the first new card data; if the network login card switching process is successful, a device reset process is performed;

[0008] When the network login process is successful and the first device state is the second state, a first new card binding instruction carrying the first device identifier and the first network login card identifier is sent to the card resource server; and a first binding receipt sent back by the card resource server is received; and when the first binding receipt indicates that the binding is successful, the locally preset first, second, and third counter values ​​are initialized, the state of the Internet of Things device is changed to the third state, and the device is reset;

[0009] When the network login process is successful and the first device state is the third state, the values ​​of the first, second and third counters are updated regularly; and the list maintenance process of the locally preset card resource signal statistics list is activated according to the latest value of the first counter; and the list maintenance process of the locally preset card resource traffic statistics list is activated according to the latest value of the second counter; and the card resource adjustment review process is activated according to the latest value of the third counter to generate a corresponding first review result, and when the first review result is not a first type of result, a new card resource switching process is performed according to the first review result; and the first old card recovery instruction issued by the card resource server is identified, and the old card resource deletion process is performed according to the first old card identifier of the first old card recovery instruction.

[0010] Preferably, the card resource list includes multiple first card resource records; the first card resource record includes a first card identification field, a first operator identification field, a first card package traffic field, a first card type field, a first card status field, a first activation timestamp field and a first deactivation timestamp field; the first card type field includes a seed card type and a non-seed card type; the first card status field includes an activation state and a deactivation state; only one of the first card resource records in the card resource list has the first card type field as a seed card type; only one of the first card resource records in the card resource list has the first card status field as an activation state; when the device status data in the card resource list is in the first state, the first card status field of the first card resource record in the card resource list is the first card type as a seed card type.

[0011] The first new card data includes a first new card identifier, a first new card operator identifier, a first new card package flow, and a first new card loading script;

[0012] The card resource signal statistics list includes a plurality of first signal statistics records; the first signal statistics record includes a second card identification field, a second operator identification field, a first signal strength field and a first timestamp field;

[0013] The card resource flow statistics list includes a plurality of first flow statistics records; the first flow statistics record includes a third card identification field, a third operator identification field, a first flow field, and a second timestamp field;

[0014] The initial values ​​of the first, second and third counters are 0;

[0015] The first audit results include the first, second, third, fourth, fifth and sixth categories of results;

[0016] The card resource server has a local preset of an IoT device list, a card resource pool, and an old card recycling list;

[0017] The IoT device list includes a plurality of first IoT device records; the first IoT device record includes a first device identification field, a first seed card identification field and a first login card identification field; each of the first IoT device records corresponds to one IoT device;

[0018] The card resource pool includes a plurality of first resource card records; the first resource card record includes a first resource card identification field, a first resource card operation identification field, a first resource card package flow field, a first resource card type field, a first resource card status field, a first resource card activation timestamp field, a first resource card deactivation timestamp field and a first resource card loading script field; the first resource card type field includes a seed card type and a non-seed card type, and the initial value defaults to empty; the first resource card status field includes an activation state and a deactivation state, and the initial value defaults to the deactivation state; the initial values ​​of the first resource card activation timestamp field and the first resource card deactivation timestamp field are both empty by default;

[0019] The old card recycling list includes a plurality of first old card records; the first old card record includes a second resource card identification field and a second device identification field.

[0020] Preferably, the performing of network login card identification processing according to the locally preset card resource list to generate the corresponding first network login card identifier specifically includes:

[0021] The Internet of Things device extracts the first card identification field of the first card resource record in the card resource list whose first card status field is in an activated state as the corresponding first login card identification.

[0022] Preferably, the performing new card data loading processing according to the first new card data specifically includes:

[0023] The Internet of Things device performs script parsing and operation processing on the first new card loading script of the first new card data, and confirms that the new card data loading processing is successful when the processing is successful.

[0024] Preferably, performing a login card switching process on the card resource list according to the first new card data specifically includes:

[0025] The IoT device obtains the current device system time as the corresponding first time; and performs timestamp conversion on the first time to generate a corresponding first timestamp;

[0026] Adding a first card resource record with empty content to the card resource list as a corresponding newly added card resource record; and using the first card resource record with the first card type field in the card resource list as a seed card type as a corresponding seed card resource record;

[0027] The newly added card resource record setting process is performed according to the first new card data and the first timestamp, specifically: the first card identification field, the first operator identification field and the first card package flow field of the newly added card resource record are set according to the first new card identification, the first new card operator identification and the first new card package flow of the first new card data; and the first card type field of the newly added card resource record is set to a non-seed card type; and the first card status field of the newly added card resource record is set to an activated state; and the first activation timestamp field of the newly added card resource record is set to the first timestamp; and the first deactivation timestamp field of the newly added card resource record is set to empty;

[0028] The seed card resource record setting process is performed according to the first timestamp, specifically: the first card status field of the seed card resource record is set to an inactive state; and the first inactivation timestamp field of the seed card resource record is set to the first timestamp;

[0029] If the newly added card resource record setting process is successful and the seed card resource record setting process is successful, it is confirmed that the login card switching process is successful.

[0030] Preferably, the periodic updating of the first, second and third counter values ​​specifically includes:

[0031] The IoT device periodically adds 1 to the value of the first counter according to a preset first time period; and identifies whether the value of the first counter after adding 1 exceeds a preset first counter threshold, and if so, resets the value of the first counter to 0;

[0032] and periodically adding 1 to the value of the second counter according to a preset second time period; and identifying whether the value of the second counter after adding 1 exceeds a preset second counter threshold, and if so, resetting the value of the second counter to 0;

[0033] The value of the third counter is periodically increased by 1 according to a preset third time period; and it is identified whether the value of the third counter after the increase by 1 exceeds a preset third counter threshold value, and if so, the value of the third counter is reset to 0.

[0034] Preferably, the activating the list maintenance processing of the locally preset card resource signal statistics list according to the latest first counter value specifically includes:

[0035] When the latest value of the first counter is equal to the preset first counter threshold, the IoT device obtains the current device signal strength as the corresponding first login card signal strength;

[0036] and obtaining the current device system time as the corresponding second time, and performing timestamp conversion on the second time to generate a corresponding second timestamp;

[0037] and extracting the first operator identification field of the first card resource record whose first card identification field in the card resource list matches the first network login card identification as the corresponding first network login card operator identification;

[0038] And add a new first signal statistics record with empty content in the card resource signal statistics list as the corresponding new signal statistics record; and set the corresponding second card identification field, second operator identification field, first signal strength field and first timestamp field in the new signal statistics record according to the first network login card identification, the first network login card operator identification, the first network login card signal strength and the second timestamp.

[0039] Preferably, the activating the list maintenance processing of the locally preset card resource flow statistics list according to the latest second counter value specifically includes:

[0040] When the latest value of the second counter is equal to the preset second counter threshold, the IoT device obtains the current device system time as the corresponding third time, and performs timestamp conversion on the third time to generate a corresponding third timestamp;

[0041] and extracting the first operator identification field of the first card resource record whose first card identification field in the card resource list matches the first network login card identification as the corresponding second network login card operator identification;

[0042] and extracting the second timestamp field closest to the third timestamp in the card resource flow statistics list as the corresponding previous timestamp;

[0043] and respectively counting the device receiving data flow and the device sending data flow in the time period from the previous timestamp to the third timestamp to generate a corresponding first receiving flow and a first sending flow; and summing up the first receiving flow and the first sending flow to generate a corresponding first total flow;

[0044] And add a new first traffic statistics record with empty content in the card resource traffic statistics list as the corresponding new traffic statistics record; and set the corresponding third card identification field, the third operator identification field, the first traffic field and the second timestamp field in the new traffic statistics record according to the first network login card identification, the second network login card operator identification, the first total traffic and the third timestamp.

[0045] Preferably, the activating the card resource adjustment review process according to the latest third counter value to generate the corresponding first review result specifically includes:

[0046] When the latest value of the third counter of the IoT device is equal to the preset third counter threshold, the IoT device obtains the current device system time as the corresponding audit end time; and uses the result of subtracting the audit end time from the preset audit time length as the corresponding audit end time; and the audit start time and the audit end time form a corresponding audit time period; the time length unit of the audit time length is hours;

[0047] and marking all the first signal statistics records whose second card identification field in the card resource signal statistics list matches the first network login card identification and whose first timestamp field satisfies the audit time period as corresponding second signal statistics records; and performing mean calculation on the first signal strength field of all the second signal statistics records to generate the corresponding average signal strength for the audit time period;

[0048] And all the first traffic statistics records whose third card identification field in the card resource traffic statistics list matches the first network card identification and whose second timestamp field satisfies the audit time period are marked as corresponding second traffic statistics records; and the first traffic field of all the second traffic statistics records is summed up to generate the corresponding total traffic for the audit period; and the monthly traffic is estimated based on the total traffic for the audit period and the audit time length to generate the corresponding first estimated monthly traffic, the first estimated monthly traffic = total traffic for the audit period * 30 * 24 / audit time length; and the first card package traffic field of the first card resource record whose first card identification field in the card resource list matches the first network card identification is extracted as the corresponding first allocated monthly traffic; and the difference between the first estimated monthly traffic and the first allocated monthly traffic is used as the corresponding audit difference traffic;

[0049] When the average signal strength during the audit period is greater than a preset average signal strength threshold, and the absolute value of the audit difference flow is less than a preset flow difference threshold, the first audit result is set as a first category result; the average signal strength threshold is greater than 0, and the flow difference threshold is greater than 0;

[0050] When the average signal strength during the audit period is less than or equal to the average signal strength threshold, and the absolute value of the audit difference flow is less than the flow difference threshold, setting the first audit result to the second type of result;

[0051] When the average signal strength during the audit period is less than or equal to the average signal strength threshold, and the audit difference flow is less than or equal to the negative flow difference threshold, setting the first audit result to the third category result;

[0052] When the average signal strength during the audit period is less than or equal to the average signal strength threshold, and the audit difference flow is greater than or equal to the flow difference threshold, setting the first audit result to the fourth category result;

[0053] When the average signal strength during the audit period is greater than the average signal strength threshold, and the audit difference flow is less than or equal to the negative flow difference threshold, setting the first audit result to the fifth category result;

[0054] When the average signal strength during the audit period is greater than the average signal strength threshold, and the audit difference flow is greater than or equal to the flow difference threshold, the first audit result is set to the sixth category result.

[0055] Preferably, when the first audit result is not a first-category result, performing a new card resource switching process according to the first audit result specifically includes:

[0056] When the first audit result is not a first-category result, the IoT device sends a second new card application instruction carrying the first device identifier, the first network login card identifier, and the first audit result to the card resource server; and receives second new card data sent back by the card resource server; the second new card data includes a second new card identifier, a second new card operator identifier, a second new card package flow, and a second new card loading script;

[0057] Performing script parsing and running processing on the second new card loading script of the second new card data; if the script parsing and running processing are successful, obtaining the current device system time as the corresponding fourth time and performing timestamp conversion on the fourth time to generate a corresponding fourth timestamp;

[0058] The first card resource record whose first card identification field in the card resource list is the first login card identification is used as the corresponding old card resource record; the first card status field of the old card resource record is set to the inactive state; and the first inactivation timestamp field of the old card resource record is set to the fourth timestamp;

[0059] Add a first card resource record with empty content to the card resource list as the corresponding new card resource record; and set the first card identification field, the first operator identification field and the first card package flow field of the new card resource record according to the second new card identification, the second new card operator identification and the second new card package flow of the second new card data; and set the first card type field of the new card resource record to a non-seed card type; and set the first card status field of the new card resource record to an activated state; and set the first activation timestamp field of the new card resource record to the fourth timestamp; and set the first deactivation timestamp field of the new card resource record to empty;

[0060] The state of the IoT device is changed to the second state, and the device is reset after the state modification is successful.

[0061] Preferably, the deleting of old card resources according to the first old card identifier of the first old card recycling instruction specifically includes:

[0062] The Internet of Things device extracts the first old card identifier from the first old card recycling instruction; deletes the first card resource record in the card resource list whose first card type field is a non-seed card type, whose first card status field is an inactive state, and whose first card identifier field matches the first old card identifier, and deletes the card data corresponding to the first old card identifier in the local storage space; sets the first recycling status to recycling success when data deletion is completed, and sends the first recycling receipt carrying the first device identifier and the first recycling status back to the card resource server.

[0063] Preferably, the method further comprises: the card resource server configures the card resource pool according to the resource card list entered by the administrator, specifically:

[0064] The card resource server uses the resource card list entered by the administrator as the corresponding first list; the resource card list includes a plurality of entered resource card records; the entered resource card records include an entered resource card identification field, an entered resource card operation identification field, an entered resource card package flow field, and an entered resource card loading script field;

[0065] Each of the input resource card records in the first list is used as the corresponding current input resource card record; and the input resource card identification field, the input resource card operation identification field, the input resource card package flow field and the input resource card loading script field of the current input resource card record are extracted as the corresponding current input resource card identification, the current input resource card operation identification, the current input resource card package flow and the current input resource card loading script;

[0066] Confirm whether there is a first resource card record in the card resource pool whose first resource card identification field matches the currently entered resource card identification; if it is confirmed that it does not exist, add a new first resource card record to the card resource pool as the corresponding current resource card record; and set the first resource card identification field, the first resource card operation identification field, the first resource card package traffic field and the first resource card loading script field of the current resource card record to the corresponding currently entered resource card identification, the currently entered resource card operation identification, the currently entered resource card package traffic and the currently entered resource card loading script; and set the first resource card type field, the first resource card activation timestamp field and the first resource card deactivation timestamp field of the current resource card record to empty; and set the first resource card status field of the current resource card record to the deactivated state.

[0067] Preferably, the method further comprises: the card resource server manages the IoT device list and the card resource pool according to the initial device resource list entered by the administrator before each batch of IoT devices is put into use, specifically:

[0068] Before each batch of IoT devices is put into use, the card resource server uses the device initial resource list entered by the administrator as the corresponding second list; the device initial resource list includes multiple device initial resource records; the device initial resource record includes a device identification field, a device seed card identification field and an initial login card identification field;

[0069] Taking each of the device initial resource records in the second list as the corresponding current device initial resource record; and extracting the device identification field, the device seed card identification field and the initial login card identification field of the current device initial resource record as the corresponding current device identification, current device seed card identification and current initial login card identification;

[0070] Confirm whether there is a first IoT device record in the IoT device list whose first device identification field matches the current device identification; if it is confirmed that there is, use the matched first IoT device record as the corresponding current IoT device record; if it is confirmed that there is not, add a new first IoT device record in the IoT device list as the corresponding current IoT device record and set the first device identification field of the newly added current IoT device record to the current device identification; set the first seed card identification field of the current IoT device record to the current device seed card identification; and set the first login card identification field of the current IoT device record to the current initial login card identification;

[0071] The first resource card record whose first resource card identification field in the card resource pool matches the seed card identification of the current device is used as the corresponding first card record; and the current server system time is obtained as the corresponding first server time, and the first server time is converted into a timestamp to generate a corresponding first server timestamp; if the first resource card status field of the first card record is in an inactive state, the first resource card type field of the first card record is set to a seed card type, and the first resource card status field of the first card record is set to an activated state, and the first resource card activation timestamp field of the first card record is set to the first server timestamp, and the first resource card inactivation timestamp field of the first card record is set to empty;

[0072] The first resource card record in the card resource pool whose first resource card identification field matches the current initial login card identification is used as the corresponding second card record; and the first resource card type field of the second card record is set to a non-seed card type.

[0073] Preferably, the method further comprises:

[0074] When receiving the first new card application instruction sent by the Internet of Things device, the card resource server extracts the first device identifier from the first new card application instruction; and extracts the first login card identifier field of the first Internet of Things device record whose first device identifier field in the Internet of Things device list matches the first device identifier as the corresponding first new card identifier; and extracts the first resource card operation identifier field, the first resource card package traffic field and the first resource card loading script field of the first resource card record whose first resource card identifier field in the card resource pool matches the first new card identifier as the corresponding first new card operator identifier, the first new card package traffic and the first new card loading script; and the corresponding first new card data composed of the obtained first new card identifier, the first new card operator identifier, the first new card package traffic and the first new card loading script is sent back to the Internet of Things device.

[0075] Preferably, the method further comprises:

[0076] When the card resource server receives the first new card binding instruction sent by the Internet of Things device, the card resource server extracts the first device identifier and the first network login card identifier from the first new card binding instruction; obtains the current server system time as the corresponding second server time, and performs timestamp conversion on the second server time to generate a corresponding second server timestamp; and uses the first Internet of Things device record whose first device identifier field in the Internet of Things device list matches the first device identifier as the corresponding current Internet of Things device record; and updates the first network login card identifier field of the current Internet of Things device record to the first network login card identifier; and uses the first resource card record whose first resource card identifier field in the card resource pool matches the first network login card identifier as the corresponding current resource card record; and updates the first resource card status field of the current resource card record to the activated status, and updates the first resource card activation timestamp field of the current resource card record to the second server timestamp; and sends the first binding receipt set as successful binding back to the Internet of Things device.

[0077] Preferably, the method further comprises:

[0078] When the card resource server receives the second new card application instruction sent by the IoT device, the card resource server extracts the first device identification, the first network login card identification and the first audit result from the second new card application instruction; and uses the first IoT device record whose first device identification field in the IoT device list matches the first device identification as the corresponding current IoT device record; and uses the first resource card record whose first resource card identification field in the card resource pool matches the first network login card identification as the corresponding current resource card record; and extracts the first resource card operation identification field and the first resource card package flow field of the current resource card record as the corresponding current resource card operation identification and current resource card package flow;

[0079] When the first audit result is a second type result, select a first resource card record from the card resource pool, whose first resource card identification field has no corresponding second resource card identification field in the old card recycling list, whose first resource card type field is empty, whose first resource card status field is in an inactive state, whose first resource card operation identification field does not match the current resource card operation identification, and whose first resource card package flow field is closest to the current resource card package flow, as the corresponding switching resource card record;

[0080] When the first audit result is the third type of result, calculate and generate the corresponding first package traffic according to the current resource card package traffic and the preset first increment percentage a, where the first package traffic = current resource card package traffic * (1 + a), 0 < a < 100%; and select from the card resource pool a first resource card record whose first resource card identification field has no corresponding second resource card identification field in the old card recycling list, and whose first resource card type field is empty, and whose first resource card status field is in an inactivated state, and whose first resource card operation identification field does not match the current resource card operation identification, and whose first resource card package traffic field is closest to the first package traffic as the corresponding switching resource card record;

[0081] When the first audit result is the fourth type of result, calculate and generate the corresponding second package traffic according to the current resource card package traffic and the preset first decrement percentage b, where the second package traffic = current resource card package traffic * (1 - b), 0 < b < 100%; and select from the card resource pool a first resource card record whose first resource card identification field has no corresponding second resource card identification field in the old card recycling list, and whose first resource card type field is empty, and whose first resource card status field is in an inactivated state, and whose first resource card operation identification field does not match the current resource card operation identification, and whose first resource card package traffic field is closest to the second package traffic as the corresponding switching resource card record;

[0082] When the first audit result is the fifth type of result, calculate and generate the corresponding third package traffic according to the current resource card package traffic and the first increment percentage a, where the third package traffic = current resource card package traffic * (1 + a); and select from the card resource pool a first resource card record whose first resource card identification field has no corresponding second resource card identification field in the old card recycling list, and whose first resource card type field is empty, and whose first resource card status field is in an inactivated state, and whose first resource card operation identification field matches the current resource card operation identification, and whose first resource card package traffic field is closest to the third package traffic as the corresponding switching resource card record;

[0083] When the first audit result is a sixth type result, the corresponding fourth package flow is calculated based on the current resource card package flow and the first reduction percentage b, where the fourth package flow = current resource card package flow * (1-b); and a first resource card record is selected from the card resource pool, whose first resource card identification field does not have a corresponding second resource card identification field in the old card recycling list, whose first resource card type field is empty, whose first resource card status field is in an inactive state, whose first resource card operation identification field matches the current resource card operation identification, and whose first resource card package flow field is closest to the fourth package flow as the corresponding switching resource card record;

[0084] Acquire the current server system time as the corresponding third server time, and perform timestamp conversion on the third server time to generate a corresponding third server timestamp;

[0085] In the card resource pool, the first resource card type field of the current resource card record is reset to empty; the first resource card status field of the current resource card record is updated to an inactivated state; the first resource card inactivation timestamp field of the current resource card record is updated to the third server timestamp; the first resource card identification field of the current resource card record is extracted as the corresponding second resource card identification field, the first device identification field of the current IoT device record is extracted as the corresponding second device identification field, and the first old card record corresponding to the obtained second resource card identification field and the second device identification field is added to the old card recycling list;

[0086] In the card resource pool, the first resource card type field of the switching resource card record is updated to a non-seed card type; and the first resource card identification field, the first resource card operation identification field, the first resource card package flow field and the first resource card loading script field of the switching resource card record are extracted as the corresponding second new card identification, the second new card operator identification, the second new card package flow and the second new card loading script;

[0087] The second new card data corresponding to the obtained second new card identifier, the second new card operator identifier, the second new card package traffic and the second new card loading script are sent back to the Internet of Things device.

[0088] Preferably, the method further includes the card resource server periodically performing old card recycling processing according to the old card recycling list, specifically:

[0089] The card resource server regularly traverses each of the first old card records in the old card recycling list according to a preset fourth time period; during the traversal, the first old card record currently traversed is used as the current old card record; and the second resource card identification field and the second device identification field of the current old card record are extracted as the corresponding current resource card identification and current device identification; and the first resource card operation identification field and the first resource card deactivation timestamp field of the first resource card record that matches the first resource card identification field in the card resource pool with the current resource card identification are extracted as the corresponding current operator identification and current deactivation timestamp; and the time difference between the current server system time and the current deactivation timestamp is calculated to generate a corresponding first time difference; and in the When the first time difference exceeds the preset first time period, the telecommunications operator interface corresponding to the current operator identifier is called to obtain the data traffic of the telecommunications card corresponding to the current resource card identifier in the most recent first time period to generate the corresponding first data traffic; and when the first data traffic is lower than the minimum traffic threshold, the current resource card identifier is used as the corresponding first old card identifier, and the first old card recycling instruction carrying the first old card identifier is issued to the Internet of Things device corresponding to the current device identifier; and the first recycling receipt sent back by the Internet of Things device corresponding to the current device identifier is received, and the first recycling status is extracted from the first recycling receipt; and when the first recycling status is successful recycling, the current old card record is deleted from the old card recycling list.

[0090] Preferably, the method further includes the card resource server regularly performing capacity expansion management on the card resource pool, specifically:

[0091] The card resource server regularly counts the total amount of all the first resource card records in the card resource pool according to a preset fifth time period to generate a corresponding first resource pool card total amount; and sums up the first resource card package flow field of all the first resource card records in the card resource pool to generate a corresponding first resource pool total flow; and counts the total amount of the first resource card records in the card resource pool whose first resource card status field is in an inactive state and whose first resource card type field is empty to generate a corresponding first unallocated card total amount; and sums up the first resource card records in the card resource pool whose first resource card status field is in an inactive state and whose first resource card type field is empty to generate a corresponding first unallocated card total amount. The first resource card package flow field of the first resource card record is statistically generated to generate a corresponding first unallocated total flow; and the ratio of the first unallocated card total amount to the first resource pool card total amount is used as the corresponding first effective card ratio, and the ratio of the first unallocated total flow to the first resource pool total flow is used as the corresponding first effective flow ratio; and when the first effective card ratio is lower than a preset card ratio threshold or the first effective flow ratio is lower than a preset flow ratio threshold, the card resource pool is expanded in resource card capacity until the latest effective card ratio is not lower than the card ratio threshold and the latest effective flow ratio is not lower than the flow ratio threshold.

[0092] A second aspect of an embodiment of the present invention provides an electronic device, including: a memory, a processor, and a transceiver;

[0093] The processor is used to be coupled to the memory, read and execute instructions in the memory, so as to implement the method steps described in the first aspect above;

[0094] The transceiver is coupled to the processor, and the processor controls the transceiver to send and receive messages.

[0095] A third aspect of an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions. When the computer instructions are executed by a computer, the computer executes the instructions of the method described in the first aspect above.

[0096] The embodiment of the present invention provides a card resource allocation method for an Internet of Things device, an electronic device and a computer-readable storage medium; when the front-end Internet of Things device is deployed, only one seed card is pre-installed on the device; after being put into use, the Internet of Things device will first log in to the network based on the seed card and initiate a new card application to the back-end card resource server; after receiving the application, the card resource server sends the corresponding new card data to the Internet of Things device based on the initial telecommunications card pre-allocated to each Internet of Things device; after the new card is downloaded and installed successfully, the Internet of Things device enters a working state based on the new card log in to the network; during the operation of the device, the Internet of Things device will continuously count the signal strength of the local telecommunications operator and the data traffic of the local device and regularly analyze the statistical results; if the analysis result shows that the current operator's signal is insufficient or the package traffic of the current telecommunications card is too large or too small, the new card application will be initiated again to the card resource server and five types of analysis results will be carried in the application After receiving the application, the card resource server selects a matching telecom card from the card resource pool based on the five types of analysis results to allocate the new card and sends the corresponding new card data to the IoT device. At the same time, the old card is included in the old card recycling list for management. After the new card is downloaded and installed successfully, the IoT device logs on to the network and enters the working state based on the switched new card; the card resource server will also regularly call the operator interface to track the traffic of each old card in the old card recycling list, and decide whether to completely recycle the old card based on the tracking results. If it is determined to be recycled, the old card recycling instruction will be sent to the IoT device, and the IoT device will retain the previous old card (except the seed card) data each time it switches to a new card until it receives the old card recycling instruction issued by the card resource server and deletes it; in addition, the card resource server will also control the expansion speed of the card resource pool based on the actual traffic usage of the front-end IoT device. Through the present invention, there is no need to pre-install telecommunication cards of multiple operators when deploying IoT devices. Card resources can be dynamically allocated to each IoT device based on the strength of the local telecommunication operator network signal of the IoT device and / or the data traffic usage of the device itself. The entire card resource pool can be dynamically expanded based on the card resource usage of all devices, thereby improving the utilization rate of card resource packages and reducing the overall card resource package investment cost. BRIEF DESCRIPTION OF THE DRAWINGS

[0097] Figure 1 A schematic diagram of a card resource allocation method for an Internet of Things device provided in Embodiment 1 of the present invention;

[0098] Figure 2 A schematic diagram of the structure of an electronic device provided in Embodiment 2 of the present invention. DETAILED DESCRIPTION

[0099] In order to make the purpose, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0100] Embodiment 1 of the present invention provides a card resource allocation method for an Internet of Things device, the method is used to improve the utilization rate of a card resource package and reduce the overall card resource package investment cost, the implementation steps of the method are composed of the implementation steps of a front-end Internet of Things device and a back-end card resource server, Figure 1 A schematic diagram of a card resource allocation method for an Internet of Things device provided in Embodiment 1 of the present invention.

[0101] Based on Figure 1 Before describing the method steps of the first embodiment of the present invention in detail, in order to better understand the method provided by the first embodiment of the present invention, the following first describes the technical implementation of the three data sets and two preprocessing processes (card resource pool configuration processing process, Internet of Things device list and card resource pool management processing process) preset on the card resource server in the first embodiment of the present invention.

[0102] In the first embodiment of the present invention, the back-end card resource server locally presets three data sets, namely: an IoT device list, a card resource pool, and an old card recycling list;

[0103] The IoT device list includes multiple first IoT device records; the first IoT device record includes a first device identification field, a first seed card identification field, and a first login card identification field; each first IoT device record corresponds to an IoT device;

[0104] Here, the IoT device list is used to store the binding information of each IoT device and its corresponding seed card and non-seed card; each first IoT device record in the IoT device list corresponds to a front-end IoT device; the first device identification field is used to store the unique product or identity identification code of the corresponding device; the first seed card identification field is used to store the unique card identification code of the seed card preset on the corresponding device; the first login card identification field is used to store the unique card identification code of the telecommunications card used by the corresponding device in actual work;

[0105] The card resource pool includes multiple first resource card records; the first resource card record includes a first resource card identification field, a first resource card operation identification field, a first resource card package flow field, a first resource card type field, a first resource card status field, a first resource card activation timestamp field, a first resource card deactivation timestamp field and a first resource card loading script field; the first resource card type field includes a seed card type and a non-seed card type, and the initial value defaults to empty; the first resource card status field includes an activation state and a deactivation state, and the initial value defaults to the deactivation state; the initial values ​​of the first resource card activation timestamp field and the first resource card deactivation timestamp field are both empty by default;

[0106] Here, the card resource pool is used to store the card resource information of the telecommunications cards purchased by the Internet of Things application providers; each first resource card record in the card resource pool corresponds to a telecommunications card; the first resource card identification field, the first resource card operation identification field, and the first resource card package traffic field of the first resource card record are respectively the unique card identification code, the telecommunications operator identification code, and the card package traffic value of the corresponding telecommunications card (in megabytes by default, or other orders of magnitude); the first resource card type field of the first resource card record has three setting values: empty, seed card type, and non-seed card type. If it is empty, it means that the corresponding telecommunications card has not been allocated. If it is a seed card type, it means that the corresponding telecommunications card has been allocated as a seed card. If it is a non-seed card type, it means that the corresponding telecommunications card has been divided But it is not a seed card, so the initial value of the first resource card type field will be set to empty by default; the first resource card status field of the first resource card record has two setting values: activation status and deactivation status. If it is in activation status, it means that the corresponding telecommunications card is in use. If it is in deactivation status, it means that the corresponding telecommunications card has not been activated for use, so the initial value of the first resource card status field will be set to deactivation status by default; the first resource card activation timestamp field of the first resource card record is the start time when the corresponding telecommunications card was last activated and used; the first resource card deactivation timestamp field of the first resource card record is the start time when the corresponding telecommunications card was last deactivated; the first resource card loading script field of the first resource card record is the card data loading script of the corresponding telecommunications card;

[0107] The old card recycling list includes a plurality of first old card records; the first old card record includes a second resource card identification field and a second device identification field.

[0108] Here, the old card recycling list is used to store some telecommunications card information to be recycled; each first old card record in the old card recycling list corresponds to a telecommunications card to be recycled; the second resource card identification field of the first old card record is used to store the unique card identification code of the corresponding telecommunications card; the second device identification field of the first old card record is used to store the unique product or identity identification code of the Internet of Things device previously bound to the corresponding telecommunications card.

[0109] Every time an IoT operator purchases a batch of telecom cards, a resource card list will be generated. Based on the resource card list, the card resource pool of the card resource server of the first embodiment of the present invention will be expanded and configured, as shown below. The method of the first embodiment of the present invention also includes: the card resource server configures the card resource pool according to the resource card list entered by the administrator, specifically:

[0110] Step A1, the card resource server uses the resource card list entered by the administrator as the corresponding first list;

[0111] The resource card list includes a plurality of input resource card records; the input resource card record includes an input resource card identification field, an input resource card operation identification field, an input resource card package flow field, and an input resource card loading script field;

[0112] Here, the resource card list provides the card information of the current batch of purchased telecom cards; each input resource card record corresponds to a newly purchased telecom card; the resource card identification field, the input resource card operation identification field, the input resource card package flow field, and the input resource card loading script field are the unique card identification code of the corresponding telecom card, the telecom operator identification code, the card package flow value (in megabytes by default, and can also be in other orders of magnitude) and the card data loading script respectively;

[0113] Step A2, taking each input resource card record of the first list as the corresponding current input resource card record; and extracting the input resource card identification field, the input resource card operation identification field, the input resource card package flow field and the input resource card loading script field of the current input resource card record as the corresponding current input resource card identification, the current input resource card operation identification, the current input resource card package flow and the current input resource card loading script;

[0114] Step A3, confirm whether there is a first resource card record in the card resource pool whose first resource card identification field matches the currently entered resource card identification; if it is confirmed that it does not exist, add a first resource card record to the card resource pool as the corresponding current resource card record; and set the first resource card identification field, the first resource card operation identification field, the first resource card package flow field and the first resource card loading script field of the current resource card record to the corresponding currently entered resource card identification, the currently entered resource card operation identification, the currently entered resource card package flow and the currently entered resource card loading script; and set the first resource card type field, the first resource card activation timestamp field and the first resource card deactivation timestamp field of the current resource card record to empty; and set the first resource card status field of the current resource card record to the deactivated state.

[0115] Here, the current step A3 is to add and set the first resource card record in the card resource pool based on the resource card list.

[0116] Each time an IoT operator puts a batch of IoT devices into use, it will generate an initial device resource list in advance, and will configure the IoT device list and card resource pool of the card resource server of the first embodiment of the present invention based on the initial device resource list of the time, as shown below. The method of the first embodiment of the present invention also includes: before each batch of IoT devices is put into use, the card resource server manages the IoT device list and card resource pool according to the initial device resource list entered by the administrator, specifically:

[0117] Step B1, before each batch of IoT devices is put into use, the card resource server uses the initial device resource list entered by the administrator as the corresponding second list;

[0118] The device initial resource list includes a plurality of device initial resource records; the device initial resource record includes a device identification field, a device seed card identification field and an initial login card identification field;

[0119] Here, the equipment initial resource list provides the telecom card information of the seed cards and initial working cards initially allocated and occupied by this batch of IoT devices in the card resource pool; each equipment initial resource record corresponds to an IoT device; the equipment identification field of the equipment initial resource record is the unique product or identity identification code of the corresponding device; the equipment seed card identification field of the equipment initial resource record is the unique card identification code of the seed card pre-installed on the corresponding device; the initial login card identification field of the equipment initial resource record is the unique card identification code of the working card pre-allocated to the corresponding device, but the card has not yet been loaded on the corresponding device;

[0120] Step B2, taking each device initial resource record of the second list as the corresponding current device initial resource record; and extracting the device identification field, device seed card identification field and initial login card identification field of the current device initial resource record as the corresponding current device identification, current device seed card identification and current initial login card identification;

[0121] Step B3, confirm whether there is a first IoT device record in the IoT device list whose first device identification field matches the current device identification. If it is confirmed that it exists, the matching first IoT device record is used as the corresponding current IoT device record. If it is confirmed that it does not exist, a new first IoT device record is added to the IoT device list as the corresponding current IoT device record and the first device identification field of the newly added current IoT device record is set as the current device identification; the first seed card identification field of the current IoT device record is set as the current device seed card identification; and the first login card identification field of the current IoT device record is set as the current initial login card identification;

[0122] Here, when confirming whether there is a first IoT device record in the IoT device list whose first device identification field matches the current device identification, if it is confirmed that it exists, it means that the IoT device is a recycled and reused device. At this time, it is only necessary to reset the first seed card identification field and the first login card identification field of the first IoT device record corresponding to the device according to the current device seed card identification and the current initial login card identification; if it is confirmed that it does not exist, it means that the IoT device is a new device. At this time, the first device identification field, the first seed card identification field and the first login card identification field of the first IoT device record corresponding to the device should be set according to the current device identification, the current device seed card identification and the current initial login card identification;

[0123] Step B4, taking the first resource card record whose first resource card identification field in the card resource pool matches the seed card identification of the current device as the corresponding first card record; obtaining the current server system time as the corresponding first server time, and performing timestamp conversion on the first server time to generate the corresponding first server timestamp; if the first resource card status field of the first card record is in an inactive state, setting the first resource card type field of the first card record to the seed card type, setting the first resource card status field of the first card record to an activated state, setting the first resource card activation timestamp field of the first card record to the first server timestamp, and setting the first resource card inactivation timestamp field of the first card record to empty;

[0124] Here, in the card resource pool, the first embodiment of the present invention sets the first resource card type field, the first resource card status field, and the first resource card activation timestamp field of the first resource card record corresponding to the seed card preset on all IoT devices to be put into use in this batch, and keeps the first resource card deactivation timestamp field empty;

[0125] Step B5: taking the first resource card record in the card resource pool whose first resource card identification field matches the current initial login card identification as the corresponding second card record; and setting the first resource card type field of the second card record to a non-seed card type.

[0126] Here, in the first embodiment of the present invention, the first resource card type field of the first resource card record corresponding to the working card pre-allocated to all the IoT devices that are about to be put into use in this batch, that is, the initial login card, is set in the card resource pool, but the first resource card status field and the first resource card activation timestamp field are not set; it can be seen from the subsequent description that in the first embodiment of the present invention, for the first resource card record of the non-seed card type, the first resource card status field and the first resource card activation timestamp field of the record will be set only after the corresponding telecommunications card is actually logged on and used.

[0127] The above is a technical description of the three data sets and two pre-processing processes (card resource pool configuration process, IoT device list and card resource pool management process) preset by the card resource server in the first embodiment of the present invention. Figure 1 The implementation steps of the method of embodiment 1 of the present invention are further described in detail. Figure 1 As shown, the method of embodiment 1 of the present invention mainly includes the following steps:

[0128] Step 1: Each time the IoT device is reset, the IoT device obtains a preset IoT device identifier and IoT device status from a local device as a corresponding first device identifier and first device status;

[0129] The first device state includes a first state, a second state and a third state.

[0130] Here, the IoT device will preset multiple system parameters locally, and the IoT device identification and IoT device status are two of them; each IoT device has a unique product or identity identification code, namely the IoT device identification; the IoT device status of each IoT device is divided into three types: the first state, the second state and the third state; the first state indicates that the device is currently in the initial state. At this time, the IoT device has only one preset seed card locally, and the IoT device needs to apply to the back-end card resource server for the pre-batch initial login card as the corresponding new card download through subsequent steps; the second state indicates that the IoT device is currently in the card switching state. At this time, in addition to the seed card, the IoT device has a newly switched new card also called a working card locally. The device needs to complete the new card login and binding operation with the back-end card resource server through subsequent steps; the third state indicates that the IoT device is currently in the working state. At this time, the IoT device has entered the normal working state based on the switched working card, and will continuously count and analyze the signal strength of the local telecom operator and the number of local traffic through subsequent steps during the device operation, and cooperate with the back-end card resource server to dynamically adjust the working card resources loaded on the device according to the signal and traffic analysis results.

[0131] Step 2: Perform network login card identification processing according to the local preset card resource list to generate a corresponding first network login card identifier; and perform network login processing according to the first network login card identifier;

[0132] The card resource list includes multiple first card resource records; the first card resource record includes a first card identification field, a first operator identification field, a first card package traffic field, a first card type field, a first card status field, a first activation timestamp field, and a first deactivation timestamp field; the first card type field includes a seed card type and a non-seed card type; the first card status field includes an activation state and a deactivation state; only one first card resource record in the card resource list has a first card type field of a seed card type; only one first card resource record in the card resource list has a first card status field of an activation state; when the device status data in the card resource list is in the first state, the first card status field of the first card resource record whose first card type field is a seed card type is an activation state;

[0133] Specifically comprising: step 21, performing a login card identification process according to a locally preset card resource list to generate a corresponding first login card identifier;

[0134] Specifically, the IoT device extracts the first card identification field of the first card resource record whose first card status field is in the activated state in the card resource list as the corresponding first login card identification;

[0135] Here, before the Internet of Things device of the embodiment of the present invention is put into use, an expandable card resource list is preset and saved locally, and each first card resource record on the card resource list corresponds to a telecommunications card; the first card identification field, the first operator identification field and the first card package flow field of the first card resource record are respectively the unique card identification code, the telecommunications operator identification code and the card package flow value of the corresponding telecommunications card (in megabytes by default, or in other orders of magnitude); the first card type field of the first card resource record has two setting values: seed card type and non-seed card type. If it is a seed card type, it means that the corresponding telecommunications card is a preset seed card. If it is a non-seed card type, it means that the corresponding telecommunications card is a working card that has been used or is being used when the Internet of Things device enters the working state; the first card status field of the first card resource record has two setting values: activation state and deactivation state. If it is an activation state, the Internet of Things device is based on the telecommunications card (seed card). card or working card) to log on to the network; the first activation timestamp field is the starting time when the corresponding telecommunications card was last activated and used; the first deactivation timestamp field is the starting time when the corresponding telecommunications card was last deactivated; because a seed card will be preset on the IoT device before it is put into use and there can only be one seed card, there is only one first card resource record in the card resource list with the first card type field being the seed card type; because the IoT device will always only use one telecommunications card to log on to the network, there is only one first card resource record in the card resource list with the first card status field being the activated state; because when the device status data is in the first state, it means that the device is currently in the initial state. At this time, the IoT device has only one preset seed card locally, and the IoT device needs to apply to the back-end card resource server for a new card download through subsequent steps. Therefore, at this time, the card resource list only has the first card resource record with the first card type field being the seed card type, and the first card status field is the activated state;

[0136] As described above, because there is only one first card resource record in the card resource list whose first card status field is in the activated state, when performing network login card identification processing according to the locally preset card resource list, the first card identification field of the first card resource record whose first card status field is in the activated state in the card resource list can be directly extracted as the corresponding first network login card identification;

[0137] Step 22, perform network login processing according to the first network login card identifier.

[0138] Here, the login process of each telecom operator is a public technical implementation. After obtaining the first login card identifier, the IoT device can call the preset corresponding card data locally and process it according to the fixed login process of the corresponding telecom operator. No repeated explanation will be given here.

[0139] Step 3, when the network login process is successful and the first device state is the first state, the first new card application instruction carrying the first device identifier is sent to the remote card resource server; and the first new card data sent back by the card resource server is received; and the new card data loading process is performed according to the first new card data; if the new card data loading process is successful, the IoT device state is changed to the second state, and the network login card switching process is performed on the card resource list according to the first new card data; if the network login card switching process is successful, the device is reset;

[0140] The first new card data includes the first new card identifier, the first new card operator identifier, the first new card package traffic, and the first new card loading script;

[0141] Specifically, the method comprises: step 31, sending a first new card application instruction carrying a first device identifier to a remote card resource server;

[0142] Here, when the login process is successful and the first device state is the first state, it means that the IoT device only has a seed card locally and has not yet completed the application and download of the working card. At this time, the IoT device of the first embodiment of the present invention will send a first new card application instruction corresponding to the first state to the card resource server for applying for the first available working card data download, that is, the first new card data;

[0143] The processing steps of the card resource server in the first embodiment of the present invention upon receiving the first new card application instruction sent by the Internet of Things device are as follows: upon receiving the first new card application instruction sent by the Internet of Things device, the card resource server extracts the first device identifier from the first new card application instruction; and extracts the first login card identifier field of the first Internet of Things device record whose first device identifier field in the Internet of Things device list matches the first device identifier as the corresponding first new card identifier; and extracts the first resource card operation identifier field, the first resource card package flow field, and the first resource card loading script field of the first resource card record whose first resource card identifier field in the card resource pool matches the first new card identifier as the corresponding first new card operator identifier, the first new card package flow, and the first new card loading script; and the corresponding first new card data composed of the obtained first new card identifier, the first new card operator identifier, the first new card package flow, and the first new card loading script are sent back to the Internet of Things device;

[0144] Here, after receiving the first new card application instruction, the card resource server can confirm that the first device state of the front-end Internet of Things device is the first state. At this time, the first login card identification field of the first Internet of Things device record corresponding to the Internet of Things device list on the card resource server side stores the card identification of the pre-assigned initial login card. The card resource server uses this identification as the first new card identification, and based on the first new card identification, retrieves the first resource card operation identification field, the first resource card package flow field, and the first resource card loading script field of the corresponding first resource card record from the card resource pool as the first new card operator identification, the first new card package flow, and the first new card loading script, and thus composes the first new card data to be sent back to the Internet of Things device;

[0145] Step 32, receiving the first new card data sent back by the card resource server; and performing new card data loading processing according to the first new card data;

[0146] The step of performing a new card data loading process according to the first new card data specifically includes: performing a script parsing and running process on a first new card loading script of the first new card data, and confirming that the new card data loading process is successful when the process is successful;

[0147] Here, after receiving the first new card data sent back by the card resource server, the Internet of Things device of the first implementation of the present invention will extract the first new card loading script therefrom to load the card data;

[0148] Step 33, if the new card data loading process is successful, the IoT device state is changed to the second state, and the card resource list is switched to the network card according to the first new card data;

[0149] Specifically including: step 331, changing the state of the IoT device to the second state;

[0150] Step 332, performing a login card switching process on the card resource list according to the first new card data;

[0151] Specifically, it includes: step 3321, the IoT device obtains the current device system time as the corresponding first time; and performs timestamp conversion on the first time to generate a corresponding first timestamp;

[0152] Step 3322: Add a first card resource record with empty content to the card resource list as the corresponding newly added card resource record; and use the first card resource record with the first card type field of the card resource list as the seed card type as the corresponding seed card resource record;

[0153] Step 3323, performing a new card resource record setting process according to the first new card data and the first timestamp;

[0154] Specifically, the first card identification field, the first operator identification field and the first card package flow field of the newly added card resource record are set according to the first new card identification, the first new card operator identification and the first new card package flow of the first new card data; and the first card type field of the newly added card resource record is set to the non-seed card type; and the first card status field of the newly added card resource record is set to the activated state; and the first activation timestamp field of the newly added card resource record is set to the first timestamp; and the first deactivation timestamp field of the newly added card resource record is set to null;

[0155] Step 3324, performing seed card resource record setting processing according to the first timestamp;

[0156] Specifically, the first card status field of the seed card resource record is set to the inactive state; and the first inactivation timestamp field of the seed card resource record is set to the first timestamp;

[0157] Step 3325, if the new card resource record setting process is successful and the seed card resource record setting process is successful, then confirm that the login card switching process is successful;

[0158] Step 34: If the network card switching process is successful, the device is reset.

[0159] Step 4: When the login process is successful and the first device state is the second state, a first new card binding instruction carrying the first device identifier and the first login card identifier is sent to the card resource server; and a first binding receipt sent back by the card resource server is received; and when the first binding receipt indicates that the binding is successful, the locally preset first, second, and third counter values ​​are initialized, the IoT device state is changed to the third state, and the device is reset;

[0160] Specifically, it includes: step 41, sending a first new card binding instruction carrying a first device identifier and a first login card identifier to a card resource server;

[0161] Here, when the network login process is successful and the first device state is the second state, it means that the IoT device has completed normal network login based on the previously loaded new card data. At this time, the IoT device of the first implementation of the present invention will send a first new card binding instruction corresponding to the second state to the card resource server to activate the configuration process of the IoT device list and the card resource pool on the card resource server side;

[0162] The processing steps of the card resource server of the first implementation of the present invention when receiving the first new card binding instruction sent by the Internet of Things device are as follows: when the card resource server receives the first new card binding instruction sent by the Internet of Things device, the card resource server extracts the first device identifier and the first network login card identifier from the first new card binding instruction; obtains the current server system time as the corresponding second server time, and performs timestamp conversion on the second server time to generate the corresponding second server timestamp; and uses the first Internet of Things device record whose first device identifier field matches the first device identifier in the Internet of Things device list as the corresponding current Internet of Things device record; and updates the first network login card identifier field of the current Internet of Things device record to the first network login card identifier; and uses the first resource card record whose first resource card identifier field matches the first network login card identifier in the card resource pool as the corresponding current resource card record; and updates the first resource card status field of the current resource card record to the activated status, and updates the first resource card activation timestamp field of the current resource card record to the second server timestamp; and sends the first binding receipt set as successful binding back to the Internet of Things device;

[0163] Here, after receiving the first new card binding instruction, the card resource server can confirm that the first device state of the front-end Internet of Things device is the second state. At this time, the card resource server will rewrite the first login card identification field of the first Internet of Things device record corresponding to the Internet of Things device list according to the first device identification and the first login card identification in the instruction; and update the first resource card status field of the corresponding first resource card record in the card resource pool to the activated state, and update the first resource card activation timestamp field based on the server system time; after completing the above operations, the card resource server will send the first binding receipt set as successful binding back to the Internet of Things device;

[0164] Step 42, receiving the first binding receipt sent back by the card resource server; and when the first binding receipt indicates successful binding, initializing the locally preset first, second, and third counter values, changing the IoT device state to the third state, and performing device reset processing.

[0165] Here, the Internet of Things device of implementation one of the present invention will preset multiple system parameters locally, and the first, second, and third counter values ​​are also three of the system parameters; the first, second, and third counter values ​​are these three system parameters only have application significance when the Internet of Things device state, that is, the first device state is the third state, so when the Internet of Things device switches the first device state from the second state to the third state, it is necessary to initialize the first, second, and third counter values. Under normal circumstances, the initial values ​​of the first, second, and third counter values ​​are 0.

[0166] Step 5, when the network login process is successful and the first device state is the third state, the values ​​of the first, second and third counters are updated regularly; and according to the latest value of the first counter, the list maintenance process of the locally preset card resource signal statistics list is activated; and according to the latest value of the second counter, the list maintenance process of the locally preset card resource flow statistics list is activated; and according to the latest value of the third counter, the card resource adjustment review process is activated to generate the corresponding first review result, and when the first review result is not a first-class result, the new card resource switching process is performed according to the first review result; and the first old card recovery instruction issued by the card resource server is identified, and the old card resource deletion process is performed according to the first old card identifier of the first old card recovery instruction;

[0167] Specifically, it includes: step 51, regularly updating the values ​​of the first, second and third counters;

[0168] Specifically, it includes: step 511, regularly adding 1 to the value of the first counter according to a preset first time period; and identifying whether the value of the first counter after adding 1 exceeds a preset first counter threshold, and if so, resetting the value of the first counter to 0;

[0169] Step 512, regularly adding 1 to the value of the second counter according to a preset second time period; and identifying whether the value of the second counter after adding 1 exceeds a preset second counter threshold, and if so, resetting the value of the second counter to 0;

[0170] Step 513, regularly adding 1 to the value of the third counter according to a preset third time period; and identifying whether the value of the third counter after adding 1 exceeds a preset third counter threshold, and if so, resetting the value of the third counter to 0;

[0171] Here, the IoT device of the first embodiment of the present invention will preset multiple system parameters locally, and the first, second, and third time periods and the first, second, and third counter thresholds are also six of the system parameters. For example, the first time period is 1 (in hours), and the corresponding first counter threshold is 24 (in hours), the second time period is 1 (in days), and the corresponding second counter threshold is 30 (in days), the third time period is 1 (in months), and the corresponding third counter threshold is 3 (in months); the first counter value is a system parameter for periodically activating the list maintenance processing of the locally preset card resource signal statistical list. The first embodiment of the present invention stipulates that the first counter value is increased by 1 every first time period. Once the first counter value is greater than the first counter threshold, it is reset to 0 for recounting, and each time the first counter value = the first counter threshold The second counter value is a system parameter for periodically activating the list maintenance processing of the card resource signal statistics list; the second counter value is a system parameter for periodically activating the list maintenance processing of the locally preset card resource flow statistics list. The present invention implements a provision that the second counter value is incremented by 1 every second time period, and once the second counter value is greater than the second counter threshold, it is reset to 0 for recounting, and the list maintenance processing of the card resource flow statistics list is activated once each time the second counter value = the second counter threshold; the third counter value is a system parameter for periodically activating the card resource adjustment and audit processing. The present invention implements a provision that the third counter value is incremented by 1 every third time period, and once the third counter value is greater than the third counter threshold, it is reset to 0 for recounting, and the card resource adjustment and audit processing is activated once each time the third counter value = the third counter threshold;

[0172] Step 52, activating the list maintenance processing of the locally preset card resource signal statistics list according to the latest first counter value;

[0173] The card resource signal statistics list includes a plurality of first signal statistics records; the first signal statistics record includes a second card identification field, a second operator identification field, a first signal strength field and a first timestamp field;

[0174] Specifically including: when the latest first counter value is equal to the preset first counter threshold, obtaining the current device signal strength as the corresponding first login card signal strength; and obtaining the current device system time as the corresponding second time, and performing timestamp conversion on the second time to generate a corresponding second timestamp; and extracting the first operator identification field of the first card resource record whose first card identification field in the card resource list matches the first login card identification as the corresponding first login card operator identification; and adding a first signal statistics record with empty content to the card resource signal statistics list as the corresponding newly added signal statistics record; and setting the corresponding second card identification field, second operator identification field, first signal strength field and first timestamp field in the newly added signal statistics record according to the first login card identification, the first login card operator identification, the first login card signal strength and the second timestamp;

[0175] Here, when the login process is successful and the first device state is the third state, it means that the Internet of Things device has entered the working state. At this time, in addition to the normal operation of the preset Internet of Things device business processing flow, the Internet of Things device of the first embodiment of the present invention will also regularly count the signal strength of the telecommunications operator corresponding to the current working card and add the statistical results to the card resource signal statistical list, specifically, each time the first counter value = the first counter threshold, the statistical operation of the signal strength is activated once and the statistical results are added to the card resource signal statistical list; each first signal statistical record in the card resource signal statistical list corresponds to a signal strength statistical result; the second card identification field of the first signal statistical record is the card identification of the current working card, that is, the first login card identification, the second operator identification field of the first signal statistical record is the operator identification corresponding to the current working card, that is, the operator identification of the first login card, the first timestamp field of the first signal statistical record is the time information of the current statistics, that is, the second timestamp, and the first signal strength field of the first signal statistical record is the signal strength of the operator corresponding to the current working card at the time corresponding to the second timestamp; when the Internet of Things device of the first embodiment of the present invention obtains the current device signal strength, the real-time signal strength can be obtained as the corresponding first login card signal strength by calling the underlying communication signal strength query interface of the device operating system;

[0176] For example, the first time period is 1 (in hours) and the corresponding first counter threshold is 24 (in hours). Then, when the first device state is the third state, the IoT device of the first embodiment of the present invention will add a first signal statistical record to the card resource signal statistical list every 24 hours.

[0177] Step 53, activating the list maintenance processing of the locally preset card resource flow statistics list according to the latest second counter value;

[0178] The card resource flow statistics list includes a plurality of first flow statistics records; the first flow statistics record includes a third card identification field, a third operator identification field, a first flow field, and a second timestamp field;

[0179] Specifically, it includes: when the latest second counter value is equal to the preset second counter threshold, obtaining the current device system time as the corresponding third time, and performing timestamp conversion on the third time to generate the corresponding third timestamp; and extracting the first operator identification field of the first card resource record whose first card identification field in the card resource list matches the first login card identification as the corresponding second login card operator identification; and extracting the second timestamp field closest to the third timestamp in the card resource flow statistics list as the corresponding previous timestamp; and respectively counting the device receiving data flow and the device sending data flow in the time period from the previous timestamp to the third timestamp to generate the corresponding first receiving flow and first sending flow; and summing up the first receiving flow and the first sending flow to generate the corresponding first total flow; and adding a first flow statistics record with empty content in the card resource flow statistics list as the corresponding newly added flow statistics record; and setting the corresponding third card identification field, third operator identification field, first flow field and second timestamp field in the newly added flow statistics record according to the first login card identification, the second login card operator identification, the first total flow and the third timestamp;

[0180] Here, when the network login process is successful and the first device state is the third state, it means that the Internet of Things device has entered the working state. At this time, the Internet of Things device of the first embodiment of the present invention not only normally runs the preset Internet of Things device business processing flow, but also regularly counts the data traffic of the Internet of Things device and adds the statistical results to the card resource traffic statistical list. Specifically, each time the second counter value = the second counter threshold, the data traffic statistical operation is activated once and the statistical results are added to the card resource traffic statistical list; each first traffic statistical record in the card resource traffic statistical list corresponds to a data traffic statistical result; the third card identification field of the first traffic statistical record is the card identification of the current working card, that is, the first network login card identification, The third operator identification field of the first traffic statistics record is the operator identification corresponding to the current working card, that is, the operator identification of the second login card; the second timestamp field of the first traffic statistics record is the time information of the current statistics, that is, the third timestamp; the first traffic field of the first traffic statistics record is the total device data receiving and sending traffic within the time period from the last statistical time, that is, the previous timestamp, to the current statistical time, that is, the third timestamp, that is, the first total traffic; when the Internet of Things device of the first embodiment of the present invention counts the device receiving data traffic and the device sending data traffic, the device receiving data traffic and the device sending data traffic in the specified time period, that is, the first receiving traffic and the first sending traffic, can be obtained by calling the underlying communication traffic query interface of the device operating system;

[0181] For example, the second time period is 1 (in days) and the corresponding second counter threshold is 30 (in days). Then, when the first device state is the third state, the IoT device of the first embodiment of the present invention will add a first flow statistics record to the card resource flow statistics list every 30 days (similar to every month).

[0182] Step 54, activating the card resource adjustment review process according to the latest third counter value to generate a corresponding first review result, and performing a new card resource switching process according to the first review result when the first review result is not a first-type result;

[0183] Specifically, it includes: step 541, activating the card resource adjustment review process according to the latest third counter value to generate a corresponding first review result;

[0184] Among them, the first audit results include the first, second, third, fourth, fifth and sixth category results;

[0185] Specifically, the method comprises: step 5411, when the latest third counter value is equal to the preset third counter threshold value, obtaining the current device system time as the corresponding audit end time; and subtracting the audit end time from the preset audit time length as the corresponding audit end time; and forming the corresponding audit time period by the audit start time and the audit end time;

[0186] The unit of the review time length is hours;

[0187] Here, when the login process is successful and the first device state is the third state, it means that the IoT device has entered the working state. At this time, the IoT device of the first embodiment of the present invention not only runs the preset IoT device business processing flow normally, but also regularly analyzes the statistical results of the card resource signal statistical list and the card resource flow statistical list in the most recent specified time period; specifically, the analysis is activated once each time the third counter value = the third counter threshold; the most recent specified time period here is the audit time period, and the preset audit time length defaults to 24*30*3 hours, which is approximately three months;

[0188] For example, the third time period is 1 (in months) and the corresponding third counter threshold is 3 (in months). Then, when the first device state is the third state, the IoT device of the first embodiment of the present invention will perform a card resource adjustment review process every 3 months. During the card resource adjustment review process, the statistical records in the card resource signal statistical list and the card resource flow statistical list within the last 24*30*3 hours will be analyzed.

[0189] Step 5412, mark all first signal statistics records whose second card identification field in the card resource signal statistics list matches the first login card identification and whose first timestamp field meets the audit time period as corresponding second signal statistics records; and perform mean calculation on the first signal strength field of all second signal statistics records to generate the corresponding average signal strength for the audit time period;

[0190] Here, when the Internet of Things device of the first embodiment of the present invention performs statistical record analysis on the card resource signal statistical list, it actually calculates the mean of the first signal strength field of the first signal statistical record within the audit time period, that is, within the last 24*30*3 hours. The obtained average signal strength during the audit period is the average daily signal strength of the telecom operator corresponding to the working card currently used on the Internet of Things device within the last 24*30*3 hours;

[0191] Step 5413, mark all first traffic statistics records whose third card identification field in the card resource traffic statistics list matches the first login card identification and whose second timestamp field meets the audit time period as corresponding second traffic statistics records; sum up the first traffic fields of all second traffic statistics records to generate the corresponding total traffic for the audit period; and estimate the monthly traffic according to the total traffic for the audit period and the audit time length to generate the corresponding first estimated monthly traffic, where the first estimated monthly traffic = total traffic for the audit period * 30 * 24 / audit time length; and extract the first card package traffic field of the first card resource record whose first card identification field in the card resource list matches the first login card identification as the corresponding first allocated monthly traffic; and use the difference between the first allocated monthly traffic and the first estimated monthly traffic as the corresponding audit difference traffic;

[0192] Here, when the Internet of Things device of the first embodiment of the present invention performs statistical record analysis on the card resource flow statistics list, it first calculates the sum of the first flow field of the first flow statistics record within the audit time period, that is, within the last 24*30*3 hours, and the total flow of the audit period is the sum of the data flow received and sent by the Internet of Things device in the last 24*30*3 hours; then, according to the first estimated monthly flow = total flow of the audit period * 30*24 / audit time length = total flow of the audit period * 30*24 / (24*30*3) = total flow of the audit period / 3, an average monthly flow is calculated, that is, the first estimated monthly flow; then, the flow package corresponding to the work card currently used on the Internet of Things device, that is, the first allocated monthly flow and the actual monthly average flow, that is, the first estimated monthly flow, are calculated to obtain the corresponding audit difference flow;

[0193] After obtaining the average signal strength and the audit difference flow rate during the audit period through the above steps 5412-5413, the IoT device of the first embodiment of the present invention will obtain the corresponding analysis result type, i.e., six types of output results of the first audit result through subsequent steps 5414-5419: first, second, third, fourth, fifth and sixth types of results;

[0194] Step 5414: when the average signal strength during the audit period is greater than the preset average signal strength threshold, and the absolute value of the audit difference flow is less than the preset flow difference threshold, the first audit result is set as the first category result;

[0195] Among them, the average signal strength threshold is greater than 0, and the flow difference threshold is greater than 0; here, the IoT device of the first embodiment of the present invention will preset multiple system parameters locally, and the average signal strength threshold and the flow difference threshold are also two of the system parameters. The settings of these two parameters can be set according to the experience values ​​of the IoT operator, but both must be values ​​greater than 0;

[0196] Here, when the average signal strength during the audit period is greater than the preset average signal strength threshold and the absolute value of the audit difference flow is less than the preset flow difference threshold, it means that the signal of the telecommunications operator corresponding to the working card currently used by the IoT device of the first embodiment of the present invention is stable, and the usage rate of the flow package corresponding to the working card is high. At this time, there is no need to implement a card replacement process on the working card, and the first audit result is outputted as the first type of result accordingly;

[0197] Step 5415, when the average signal strength during the audit period is less than or equal to the average signal strength threshold, and the absolute value of the audit difference flow is less than the flow difference threshold, setting the first audit result to the second type of result;

[0198] Here, when the average signal strength during the audit period is less than or equal to the average signal strength threshold and the absolute value of the audit difference flow is less than the flow difference threshold, it means that the flow package usage rate corresponding to the working card currently used by the IoT device of implementation one of the present invention is high, but the signal of the telecommunications operator corresponding to the working card is unstable. At this time, the working card needs to be replaced. When replacing the card, a new telecommunications card with a different telecommunications operator and a flow package similar to the current flow package needs to be applied for, and the first audit result is output as the second type of result accordingly;

[0199] Step 5416, when the average signal strength during the audit period is less than or equal to the average signal strength threshold, and the audit difference flow is less than or equal to the negative flow difference threshold, setting the first audit result to the third category result;

[0200] Here, when the average signal strength during the audit period is less than or equal to the average signal strength threshold and the audit difference flow is less than or equal to the negative flow difference threshold, it means that the signal of the telecommunications operator corresponding to the working card currently used by the IoT device of implementation one of the present invention is unstable, and the flow package corresponding to the working card is too low to meet the actual demand. At this time, the working card needs to be replaced. When replacing the card, a new telecommunications card with a different telecommunications operator and a flow package greater than the current flow package needs to be applied for. Correspondingly, the first audit result is output as the third type of result;

[0201] Step 5417, when the average signal strength during the audit period is less than or equal to the average signal strength threshold, and the audit difference flow is greater than or equal to the flow difference threshold, setting the first audit result to the fourth category result;

[0202] Here, when the average signal strength during the audit period is less than or equal to the average signal strength threshold and the audit difference flow is greater than or equal to the flow difference threshold, it means that the signal of the telecommunications operator corresponding to the working card currently used by the IoT device of the first embodiment of the present invention is unstable, and the flow package corresponding to the working card is too high, resulting in a waste of resources. At this time, the working card needs to be replaced. When replacing the card, a new telecommunications card with a different telecommunications operator and a flow package smaller than the current flow package needs to be applied for. Correspondingly, the first audit result is output as the fourth type of result;

[0203] Step 5418, when the average signal strength during the audit period is greater than the average signal strength threshold, and the audit difference flow is less than or equal to the negative flow difference threshold, setting the first audit result to the fifth category result;

[0204] Here, when the average signal strength during the audit period is greater than the average signal strength threshold and the audit difference flow is less than or equal to the negative flow difference threshold, it means that the signal of the telecommunications operator corresponding to the working card currently used by the IoT device of implementation one of the present invention is stable, but the flow package corresponding to the working card is too low to meet the actual demand. At this time, the working card needs to be replaced. When replacing the card, a new telecommunications card with the same telecommunications operator and a flow package greater than the current flow package needs to be applied for. Correspondingly, the first audit result is output as the fifth category result;

[0205] Step 5419, when the average signal strength during the audit period is greater than the average signal strength threshold, and the audit difference flow is greater than or equal to the flow difference threshold, the first audit result is set to the sixth category result;

[0206] Here, when the average signal strength during the audit period is greater than the average signal strength threshold and the audit difference flow is greater than or equal to the flow difference threshold, it means that the signal of the telecommunications operator corresponding to the working card currently used by the IoT device of the first embodiment of the present invention is stable, but the flow package corresponding to the working card is too high, resulting in a waste of resources. At this time, the working card needs to be replaced. When replacing the card, a new telecommunications card with the same telecommunications operator and a flow package smaller than the current flow package needs to be applied for. Correspondingly, the first audit result is output as the sixth category result;

[0207] Step 542, when the first audit result is not a first-category result, performing a new card resource switching process according to the first audit result;

[0208] Specifically, step 5421, when the first audit result is not a first type of result, sending a second new card application instruction carrying the first device identifier, the first login card identifier and the first audit result to the card resource server;

[0209] Here, when the first audit result is not a first-type result, it indicates that a new card replacement application process is required. At this time, the Internet of Things device of the first embodiment of the present invention will send a second new card binding instruction corresponding to the third state to the card resource server to activate the new working card allocation process on the card resource server side;

[0210] The processing steps of the card resource server in the first embodiment of the present invention upon receiving the second new card binding instruction sent by the Internet of Things device are the following steps C1-C10:

[0211] Step C1, when receiving the second new card application instruction sent by the Internet of Things device, the card resource server extracts the first device identification, the first network card identification and the first audit result from the second new card application instruction; and uses the first Internet of Things device record whose first device identification field matches the first device identification in the Internet of Things device list as the corresponding current Internet of Things device record; and uses the first resource card record whose first resource card identification field matches the first network card identification in the card resource pool as the corresponding current resource card record; and extracts the first resource card operation identification field and the first resource card package flow field of the current resource card record as the corresponding current resource card operation identification and current resource card package flow;

[0212] Step C2, when the first audit result is a second type result, select a first resource card record from the card resource pool, whose first resource card identification field has no corresponding second resource card identification field in the old card recycling list, whose first resource card type field is empty, whose first resource card status field is in an inactive state, whose first resource card operation identification field does not match the current resource card operation identification, and whose first resource card package flow field is closest to the current resource card package flow, as the corresponding switching resource card record;

[0213] Here, when the first audit result is the second type of result, it means that the front-end IoT device requires a new telecommunications card with a different telecommunications operator from the current resource card record and a traffic package similar to the current resource card package traffic; the card resource server of the first embodiment of the present invention will select a first resource card record from the card resource pool that can meet the above-mentioned card replacement requirements corresponding to the second type of result and does not exist in the old card recycling list as the switching resource card record corresponding to the new working card;

[0214] Step C3, when the first review result is the third type of result, calculate and generate the corresponding first package traffic according to the current resource card package traffic and the preset first increment percentage a, where the first package traffic = current resource card package traffic * (1 + a), 0 < a < 100%; and select from the card resource pool a first resource card record whose first resource card identification field has no corresponding second resource card identification field in the old card recycling list, and whose first resource card type field is empty, and whose first resource card status field is in an inactivated state, and whose first resource card operation identification field does not match the current resource card operation identification, and whose first resource card package traffic field is closest to the first package traffic as the corresponding switching resource card record;

[0215] Here, the Internet of Things device in the first embodiment of the present invention will preset multiple system parameters locally, and the first increment percentage a is also one of the system parameters. The setting of the first increment percentage a can be set according to the empirical value of the Internet of Things operator, but it must be between 0 and 100%;

[0216] Here, when the first review result is the third type of result, it means that the front-end Internet of Things device requests to change to a new telecom card of a different telecom operator from the current resource card record and with a traffic package larger than the current resource card package traffic; the card resource server in the first embodiment of the present invention will select from the card resource pool a first resource card record that can meet the above-mentioned card-changing requirements corresponding to the third type of result and does not exist in the old card recycling list as the switching resource card record corresponding to the new working card;

[0217] Step C4, when the first review result is the fourth type of result, calculate and generate the corresponding second package traffic according to the current resource card package traffic and the preset first decrement percentage b, where the second package traffic = current resource card package traffic * (1 - b), 0 < b < 100%; and select from the card resource pool a first resource card record whose first resource card identification field has no corresponding second resource card identification field in the old card recycling list, and whose first resource card type field is empty, and whose first resource card status field is in an inactivated state, and whose first resource card operation identification field does not match the current resource card operation identification, and whose first resource card package traffic field is closest to the second package traffic as the corresponding switching resource card record;

[0218] Here, the Internet of Things device in the first embodiment of the present invention will preset multiple system parameters locally, and the first decrement percentage b is also one of the system parameters. The setting of the first decrement percentage b can be set according to the empirical value of the Internet of Things operator, but it must be between 0 and 100%;

[0219] Here, when the first audit result is the fourth type of result, it means that the front-end IoT device requires a new telecommunications card with a different telecommunications operator from the current resource card record and a traffic package smaller than the current resource card package traffic; the card resource server of the first embodiment of the present invention will select a first resource card record from the card resource pool that can meet the above-mentioned card replacement requirements corresponding to the fourth type of result and does not exist in the old card recycling list as the switching resource card record corresponding to the new working card;

[0220] Step C5, when the first audit result is the fifth category result, the corresponding third package flow is calculated based on the current resource card package flow and the first incremental percentage a, and the third package flow = current resource card package flow * (1 + a); and a first resource card record is selected from the card resource pool, whose first resource card identification field has no corresponding second resource card identification field in the old card recycling list, whose first resource card type field is empty, whose first resource card status field is in an inactive state, whose first resource card operation identification field matches the current resource card operation identification, and whose first resource card package flow field is closest to the third package flow as the corresponding switching resource card record;

[0221] Here, when the first audit result is the fifth type of result, it means that the front-end IoT device requires a new telecommunications card with the same telecommunications operator as the current resource card record and a traffic package greater than the current resource card package traffic; the card resource server of the first embodiment of the present invention will select a first resource card record from the card resource pool that can meet the above-mentioned card replacement requirements corresponding to the fifth type of result and does not exist in the old card recycling list as the switching resource card record corresponding to the new working card;

[0222] Step C6, when the first audit result is the sixth category result, the corresponding fourth package flow is calculated based on the current resource card package flow and the first reduction percentage b, and the fourth package flow = current resource card package flow * (1-b); and a first resource card record is selected from the card resource pool, whose first resource card identification field has no corresponding second resource card identification field in the old card recycling list, whose first resource card type field is empty, whose first resource card status field is in an inactive state, whose first resource card operation identification field matches the current resource card operation identification, and whose first resource card package flow field is closest to the fourth package flow as the corresponding switching resource card record;

[0223] Here, when the first audit result is the sixth type of result, it means that the front-end IoT device requires a new telecommunications card with the same telecommunications operator as the current resource card record and a traffic package smaller than the current resource card package traffic; the card resource server of the first embodiment of the present invention will select a first resource card record from the card resource pool that can meet the above-mentioned card replacement requirements corresponding to the sixth type of result and does not exist in the old card recycling list as the switching resource card record corresponding to the new working card;

[0224] Step C7, obtaining the current server system time as the corresponding third server time, and performing timestamp conversion on the third server time to generate a corresponding third server timestamp;

[0225] Step C8, in the card resource pool, reset the first resource card type field of the current resource card record to empty; update the first resource card status field of the current resource card record to an inactivated state; update the first resource card inactivation timestamp field of the current resource card record to a third server timestamp; extract the first resource card identification field of the current resource card record as the corresponding second resource card identification field, extract the first device identification field of the current IoT device record as the corresponding second device identification field, and add the corresponding first old card record composed of the obtained second resource card identification field and the second device identification field to the old card recycling list;

[0226] Here, after selecting the switching resource card record, the card resource server of the first embodiment of the present invention needs to update the first resource card status field of the current resource card record corresponding to the current working card of the front-end Internet of Things device in the card resource pool to the inactivated state, and update the first resource card inactivation timestamp field to the third server timestamp; and add the first old card record corresponding to the device identifier corresponding to the front-end Internet of Things device and the card identifier of the current resource card record to the old card recycling list;

[0227] Step C9, in the card resource pool, the first resource card type field of the switching resource card record is updated to a non-seed card type; and the first resource card identification field, the first resource card operation identification field, the first resource card package flow field, and the first resource card loading script field of the switching resource card record are extracted as the corresponding second new card identification, second new card operator identification, second new card package flow, and second new card loading script;

[0228] Here, after selecting the switching resource card record, the card resource server of the first embodiment of the present invention needs to update the first resource card type field of the switching resource card record in the card resource pool to a non-seed card type; and extract the first resource card identification field, the first resource card operation identification field, the first resource card package flow field and the first resource card loading script field of the switching resource card record as the corresponding second new card identification, the second new card operator identification, the second new card package flow and the second new card loading script;

[0229] Step C10, sending the corresponding second new card data composed of the obtained second new card identifier, the second new card operator identifier, the second new card package flow, and the second new card loading script back to the IoT device;

[0230] Here, the card resource server of the first embodiment of the present invention obtains the second new card identifier, the second new card operator identifier, the second new card package flow, and the second new card loading script according to the selected switching resource card record, and then forms the corresponding second new card data from the obtained data and sends it back to the Internet of Things device;

[0231] Step 5422, receiving the second new card data sent back by the card resource server;

[0232] The second new card data includes the second new card identifier, the second new card operator identifier, the second new card package traffic, and the second new card loading script;

[0233] Here, the Internet of Things device of the first embodiment of the present invention receives the second new card data sent back by the card resource server after sending the second new card binding instruction to the card resource server;

[0234] Step 5423, parsing and running the second new card loading script of the second new card data; if the parsing and running are successful, obtaining the current device system time as the corresponding fourth time and performing timestamp conversion on the fourth time to generate a corresponding fourth timestamp;

[0235] Here, the IoT device of the first embodiment of the present invention extracts the second new card loading script from the second new card data to load the card data; the fourth timestamp here records the switching time of the two working cards before and after;

[0236] Step 5424, taking the first card resource record whose first card identification field is the first login card identification in the card resource list as the corresponding old card resource record; setting the first card status field of the old card resource record to the inactive state; and setting the first inactivation timestamp field of the old card resource record to the fourth timestamp;

[0237] Step 5425, add a first card resource record with empty content to the card resource list as the corresponding new card resource record; and set the first card identification field, the first operator identification field and the first card package flow field of the new card resource record according to the second new card identification, the second new card operator identification and the second new card package flow of the second new card data; and set the first card type field of the new card resource record to the non-seed card type; and set the first card status field of the new card resource record to the activated state; and set the first activation timestamp field of the new card resource record to the fourth timestamp; and set the first deactivation timestamp field of the new card resource record to empty;

[0238] Step 5426, changing the state of the IoT device to the second state, and performing device reset processing after the state modification is successful;

[0239] Here, the IoT device of the first implementation of the present invention changes the IoT device state to the second state and resets it. After the reset, it enters step 4 to send a first new card binding instruction corresponding to the second state to the card resource server to activate the configuration process of the IoT device list and the card resource pool on the card resource server side, and when receiving the first binding receipt set as a successful binding sent back by the card resource server, the first, second, and third counter values ​​are initialized and the IoT device state is changed to the third state and the device is reset again. After the reset again, it enters step 5 again;

[0240] Step 55, identifying the first old card recycling instruction issued by the card resource server, and performing old card resource deletion processing according to the first old card identifier of the first old card recycling instruction;

[0241] Here, when the Internet of Things device of the first embodiment of the present invention successfully logs in and the first device state is the third state, in addition to executing the above-mentioned processing procedures of steps 51, 52, 53, 54, etc., it is also possible to activate the processing procedure of step 55 due to receiving the first old card recycling instruction issued by the card resource server;

[0242] Specifically, the method includes: extracting a first old card identifier from a first old card recycling instruction; deleting a first card resource record in a card resource list whose first card type field is a non-seed card type, whose first card status field is an inactive state, and whose first card identifier field matches the first old card identifier, and deleting card data corresponding to the first old card identifier in a local storage space; and setting a first recycling status to recycling success when data deletion is completed, and sending a first recycling receipt carrying the first device identifier and the first recycling status back to a card resource server.

[0243] Here, the reason why the Internet of Things device of implementation one of the present invention receives the first old card recycling instruction issued by the card resource server when the network login process is successful and the first device state is the third state is because the card resource server of implementation one of the present invention will regularly perform old card recycling processing according to the old card recycling list, specifically: the card resource server regularly traverses each first old card record in the old card recycling list according to a preset fourth time period; when traversing, the currently traversed first old card record is used as the current old card record; and the second resource card identification field and the second device identification field of the current old card record are extracted as the corresponding current resource card identification and current device identification; and the first resource card operation identification field and the first resource card deactivation timestamp field of the first resource card record whose first resource card identification field in the card resource pool matches the current resource card identification are extracted as the corresponding current operation The business identification and the current inactivation timestamp are calculated; and the time difference between the current server system time and the current inactivation timestamp is calculated to generate the corresponding first time difference; and when the first time difference exceeds the preset first time period, the telecommunications operator interface corresponding to the current operator identification is called to obtain the data flow of the telecommunications card corresponding to the current resource card identification in the most recent first time period to generate the corresponding first data flow; and when the first data flow is lower than the minimum flow threshold, the current resource card identification is used as the corresponding first old card identification, and the first old card recycling instruction carrying the first old card identification is sent to the IoT device corresponding to the current device identification; and the first recycling receipt sent back by the IoT device corresponding to the current device identification is received, and the first recycling status is extracted from the first recycling receipt; and when the first recycling status is recycling success, the current old card record is deleted from the old card recycling list. Here, the fourth time period is a preset experience value, which can be set to 3 months by default.

[0244] In addition, as the number of front-end IoT devices increases and the number of seed cards and working cards allocated increases, the number of unused first resource card records in the card resource pool on the card resource server side of the first embodiment of the present invention will gradually decrease. In order to replenish resources to the card resource pool in a timely manner and avoid over-replenishment during replenishment, the first embodiment of the present invention also provides a management mechanism for dynamically expanding the card resource pool, that is, the first embodiment of the present invention also includes the card resource server regularly managing the expansion of the card resource pool, specifically:

[0245] The card resource server regularly counts the total amount of all first resource card records in the card resource pool according to the preset fifth time period to generate the corresponding first resource pool card total amount; and sums up the first resource card package flow fields of all first resource card records in the card resource pool to generate the corresponding first resource pool total flow; and counts the total amount of first resource card records in the card resource pool whose first resource card status field is in an inactive state and whose first resource card type field is empty to generate the corresponding first unallocated card total amount; and counts the first resource card package flow field of the first resource card records in the card resource pool whose first resource card status field is in an inactive state and whose first resource card type field is empty to generate the corresponding first unallocated total flow; and uses the ratio of the first unallocated card total amount to the first resource pool card total amount as the corresponding first valid card ratio, and uses the ratio of the first unallocated total flow to the first resource pool total flow as the corresponding first valid flow ratio; and when the first valid card ratio is lower than the preset card ratio threshold or the first valid flow ratio is lower than the preset flow ratio threshold, the card resource pool is expanded in resource card capacity until the latest valid card ratio is not lower than the card ratio threshold and the latest valid flow ratio is not lower than the flow ratio threshold. Here, the fifth time period, card ratio threshold, and flow ratio threshold are all preset empirical values ​​and can be set according to specific implementation conditions.

[0246] Figure 2 This is a schematic diagram of the structure of an electronic device provided in the second embodiment of the present invention. The electronic device may be the aforementioned terminal device or server, or may be a terminal device or server connected to the aforementioned terminal device or server to implement the method of the embodiment of the present invention. Figure 2 As shown, the electronic device may include: a processor 301 (such as a CPU), a memory 302, and a transceiver 303; the transceiver 303 is coupled to the processor 301, and the processor 301 controls the transceiver 303. Various instructions may be stored in the memory 302 to complete various processing functions and implement the processing steps described in the aforementioned method embodiment. Preferably, the electronic device involved in the embodiment of the present invention also includes: a power supply 304, a system bus 305 and a communication port 306. The system bus 305 is used to realize the communication connection between components. The above-mentioned communication port 306 is used for connecting and communicating between the electronic device and other peripherals.

[0247] exist Figure 2 The system bus 305 mentioned in the figure can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The system bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 2 The term "communication interface" is represented by only one thick line, but it does not mean that there is only one bus or one type of bus. The communication interface is used to realize the communication between the database access device and other devices (such as clients, read-write libraries, and read-only libraries). The memory may include random access memory (RAM) and may also include non-volatile memory (Non-Volatile Memory), such as at least one disk storage.

[0248] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), a graphics processing unit (GPU), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0249] It should be noted that an embodiment of the present invention further provides a computer-readable storage medium, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the method and processing process provided in the above embodiments.

[0250] An embodiment of the present invention further provides a chip for executing instructions, wherein the chip is used to execute the processing steps described in the aforementioned method embodiment.

[0251] The embodiment of the present invention provides a card resource allocation method for an Internet of Things device, an electronic device and a computer-readable storage medium; when the front-end Internet of Things device is deployed, only one seed card is pre-installed on the device; after being put into use, the Internet of Things device will first log in to the network based on the seed card and initiate a new card application to the back-end card resource server; after receiving the application, the card resource server sends the corresponding new card data to the Internet of Things device based on the initial telecommunications card pre-allocated to each Internet of Things device; after the new card is downloaded and installed successfully, the Internet of Things device enters a working state based on the new card log in to the network; during the operation of the device, the Internet of Things device will continuously count the signal strength of the local telecommunications operator and the data traffic of the local device and regularly analyze the statistical results; if the analysis result shows that the current operator's signal is insufficient or the package traffic of the current telecommunications card is too large or too small, the new card application will be initiated again to the card resource server and five types of analysis results will be carried in the application After receiving the application, the card resource server selects a matching telecom card from the card resource pool based on the five types of analysis results to allocate the new card and sends the corresponding new card data to the IoT device. At the same time, the old card is included in the old card recycling list for management. After the new card is downloaded and installed successfully, the IoT device logs on to the network and enters the working state based on the switched new card; the card resource server will also regularly call the operator interface to track the traffic of each old card in the old card recycling list, and decide whether to completely recycle the old card based on the tracking results. If it is determined to be recycled, the old card recycling instruction will be sent to the IoT device, and the IoT device will retain the previous old card (except the seed card) data each time it switches to a new card until it receives the old card recycling instruction issued by the card resource server and deletes it; in addition, the card resource server will also control the expansion speed of the card resource pool based on the actual traffic usage of the front-end IoT device. Through the present invention, there is no need to pre-install telecommunication cards of multiple operators when deploying IoT devices. Card resources can be dynamically allocated to each IoT device based on the strength of the local telecommunication operator network signal of the IoT device and / or the data traffic usage of the device itself. The entire card resource pool can be dynamically expanded based on the card resource usage of all devices, thereby improving the utilization rate of card resource packages and reducing the overall card resource package investment cost.

[0252] The professionals should further realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to the function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0253] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0254] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A card resource allocation method for an Internet of Things device, characterized in that: The method comprises: Each time the IoT device is reset, the IoT device obtains a preset IoT device identifier and IoT device state from the local as the corresponding first device identifier and first device state; the first device state includes a first state, a second state and a third state; Performing network login card identification processing according to a locally preset card resource list to generate a corresponding first network login card identifier; and performing network login processing according to the first network login card identifier; When the network login process is successful and the first device state is the first state, a first new card application instruction carrying the first device identifier is sent to a remote card resource server; and first new card data sent back by the card resource server is received; and new card data loading process is performed according to the first new card data; if the new card data loading process is successful, the state of the Internet of Things device is changed to the second state, and the network login card switching process is performed on the card resource list according to the first new card data; if the network login card switching process is successful, a device reset process is performed; When the network login process is successful and the first device state is the second state, a first new card binding instruction carrying the first device identifier and the first network login card identifier is sent to the card resource server; and a first binding receipt sent back by the card resource server is received; and when the first binding receipt indicates that the binding is successful, the locally preset first, second, and third counter values ​​are initialized, the state of the Internet of Things device is changed to the third state, and the device is reset; When the network login process is successful and the first device state is the third state, the values ​​of the first, second and third counters are updated regularly; and the list maintenance process of the locally preset card resource signal statistics list is activated according to the latest value of the first counter; and the list maintenance process of the locally preset card resource traffic statistics list is activated according to the latest value of the second counter; and the card resource adjustment review process is activated according to the latest value of the third counter to generate a corresponding first review result, and when the first review result is not a first type of result, a new card resource switching process is performed according to the first review result; and the first old card recovery instruction issued by the card resource server is identified, and the old card resource deletion process is performed according to the first old card identifier of the first old card recovery instruction.

2. The card resource allocation method of the Internet of Things device according to claim 1, characterized in that: The card resource list includes multiple first card resource records; the first card resource record includes a first card identification field, a first operator identification field, a first card package traffic field, a first card type field, a first card status field, a first activation timestamp field and a first deactivation timestamp field; the first card type field includes a seed card type and a non-seed card type; the first card status field includes an activation state and a deactivation state; only one of the first card resource records in the card resource list has the first card type field as a seed card type; only one of the first card resource records in the card resource list has the first card status field as an activation state; when the device status data in the card resource list is in the first state, only the first card type field of the first card resource record in the card resource list has the first card status field as a seed card type, and the first card status field is an activation state; The first new card data includes a first new card identifier, a first new card operator identifier, a first new card package flow, and a first new card loading script; The card resource signal statistics list includes a plurality of first signal statistics records; the first signal statistics record includes a second card identification field, a second operator identification field, a first signal strength field and a first timestamp field; The card resource flow statistics list includes a plurality of first flow statistics records; the first flow statistics record includes a third card identification field, a third operator identification field, a first flow field, and a second timestamp field; The initial values ​​of the first, second and third counters are 0; The first audit results include the first, second, third, fourth, fifth and sixth categories of results; The card resource server has a local preset of an IoT device list, a card resource pool, and an old card recycling list; The IoT device list includes a plurality of first IoT device records; the first IoT device record includes a first device identification field, a first seed card identification field and a first login card identification field; each of the first IoT device records corresponds to one IoT device; The card resource pool includes a plurality of first resource card records; the first resource card record includes a first resource card identification field, a first resource card operation identification field, a first resource card package flow field, a first resource card type field, a first resource card status field, a first resource card activation timestamp field, a first resource card deactivation timestamp field and a first resource card loading script field; the first resource card type field includes a seed card type and a non-seed card type, and the initial value defaults to empty; the first resource card status field includes an activation state and a deactivation state, and the initial value defaults to the deactivation state; the initial values ​​of the first resource card activation timestamp field and the first resource card deactivation timestamp field are both empty by default; The old card recycling list includes a plurality of first old card records; the first old card record includes a second resource card identification field and a second device identification field.

3. The card resource allocation method of the Internet of Things device according to claim 2, characterized in that: The performing the network login card identification process according to the locally preset card resource list to generate the corresponding first network login card identifier specifically includes: The Internet of Things device extracts the first card identification field of the first card resource record in the card resource list whose first card status field is in an activated state as the corresponding first login card identification.

4. The card resource allocation method of the Internet of Things device according to claim 2, characterized in that: The performing new card data loading processing according to the first new card data specifically includes: The Internet of Things device performs script parsing and operation processing on the first new card loading script of the first new card data, and confirms that the new card data loading processing is successful when the processing is successful.

5. The card resource allocation method of the Internet of Things device according to claim 2, characterized in that: The performing a network card switching process on the card resource list according to the first new card data specifically includes: The IoT device obtains the current device system time as the corresponding first time; and performs timestamp conversion on the first time to generate a corresponding first timestamp; Adding a first card resource record with empty content to the card resource list as a corresponding newly added card resource record; and using the first card resource record with the first card type field in the card resource list as a seed card type as a corresponding seed card resource record; The newly added card resource record setting process is performed according to the first new card data and the first timestamp, specifically: the first card identification field, the first operator identification field and the first card package flow field of the newly added card resource record are set according to the first new card identification, the first new card operator identification and the first new card package flow of the first new card data; and the first card type field of the newly added card resource record is set to a non-seed card type; and the first card status field of the newly added card resource record is set to an activated state; and the first activation timestamp field of the newly added card resource record is set to the first timestamp; and the first deactivation timestamp field of the newly added card resource record is set to empty; The seed card resource record setting process is performed according to the first timestamp, specifically: the first card status field of the seed card resource record is set to an inactive state; and the first inactivation timestamp field of the seed card resource record is set to the first timestamp; If the newly added card resource record setting process is successful and the seed card resource record setting process is successful, it is confirmed that the login card switching process is successful.

6. The card resource allocation method of the Internet of Things device according to claim 1, characterized in that: The periodic updating of the first, second and third counter values ​​specifically includes: The IoT device periodically adds 1 to the value of the first counter according to a preset first time period; and identifies whether the value of the first counter after adding 1 exceeds a preset first counter threshold, and if so, resets the value of the first counter to 0; and periodically adding 1 to the value of the second counter according to a preset second time period; and identifying whether the value of the second counter after adding 1 exceeds a preset second counter threshold, and if so, resetting the value of the second counter to 0; The value of the third counter is periodically increased by 1 according to a preset third time period; and it is identified whether the value of the third counter after the increase by 1 exceeds a preset third counter threshold value, and if so, the value of the third counter is reset to 0.

7. The card resource allocation method of the Internet of Things device according to claim 2, characterized in that: The activating the list maintenance processing of the locally preset card resource signal statistics list according to the latest first counter value specifically includes: When the latest value of the first counter is equal to the preset first counter threshold, the IoT device obtains the current device signal strength as the corresponding first login card signal strength; and obtaining the current device system time as the corresponding second time, and performing timestamp conversion on the second time to generate a corresponding second timestamp; and extracting the first operator identification field of the first card resource record whose first card identification field in the card resource list matches the first network login card identification as the corresponding first network login card operator identification; And add a new first signal statistics record with empty content in the card resource signal statistics list as the corresponding new signal statistics record; and set the corresponding second card identification field, second operator identification field, first signal strength field and first timestamp field in the new signal statistics record according to the first network login card identification, the first network login card operator identification, the first network login card signal strength and the second timestamp.

8. The card resource allocation method of the Internet of Things device according to claim 2, characterized in that: The activating the list maintenance processing of the locally preset card resource flow statistics list according to the latest second counter value specifically includes: When the latest value of the second counter is equal to the preset second counter threshold, the IoT device obtains the current device system time as the corresponding third time, and performs timestamp conversion on the third time to generate a corresponding third timestamp; and extracting the first operator identification field of the first card resource record whose first card identification field in the card resource list matches the first network login card identification as the corresponding second network login card operator identification; and extracting the second timestamp field closest to the third timestamp in the card resource flow statistics list as the corresponding previous timestamp; and respectively counting the device receiving data flow and the device sending data flow in the time period from the previous timestamp to the third timestamp to generate a corresponding first receiving flow and a first sending flow; and summing up the first receiving flow and the first sending flow to generate a corresponding first total flow; And add a new first traffic statistics record with empty content in the card resource traffic statistics list as the corresponding new traffic statistics record; and set the corresponding third card identification field, the third operator identification field, the first traffic field and the second timestamp field in the new traffic statistics record according to the first network login card identification, the second network login card operator identification, the first total traffic and the third timestamp.

9. The card resource allocation method of the Internet of Things device according to claim 2, characterized in that: The activating the card resource adjustment review process according to the latest third counter value to generate a corresponding first review result specifically includes: When the latest value of the third counter of the IoT device is equal to the preset third counter threshold, the IoT device obtains the current device system time as the corresponding audit end time; and uses the result of subtracting the audit end time from the preset audit time length as the corresponding audit end time; and the audit start time and the audit end time form a corresponding audit time period; the time length unit of the audit time length is hours; and marking all the first signal statistics records whose second card identification field in the card resource signal statistics list matches the first network login card identification and whose first timestamp field satisfies the audit time period as corresponding second signal statistics records; and performing mean calculation on the first signal strength field of all the second signal statistics records to generate the corresponding average signal strength for the audit time period; And all the first traffic statistics records whose third card identification field in the card resource traffic statistics list matches the first network card identification and whose second timestamp field satisfies the audit time period are marked as corresponding second traffic statistics records; and the first traffic field of all the second traffic statistics records is summed up to generate the corresponding total traffic for the audit period; and the monthly traffic is estimated based on the total traffic for the audit period and the audit time length to generate the corresponding first estimated monthly traffic, the first estimated monthly traffic = total traffic for the audit period * 30 * 24 / audit time length; and the first card package traffic field of the first card resource record whose first card identification field in the card resource list matches the first network card identification is extracted as the corresponding first allocated monthly traffic; and the difference between the first estimated monthly traffic and the first allocated monthly traffic is used as the corresponding audit difference traffic; When the average signal strength during the audit period is greater than a preset average signal strength threshold, and the absolute value of the audit difference flow is less than a preset flow difference threshold, the first audit result is set as a first category result; the average signal strength threshold is greater than 0, and the flow difference threshold is greater than 0; When the average signal strength during the audit period is less than or equal to the average signal strength threshold, and the absolute value of the audit difference flow is less than the flow difference threshold, setting the first audit result to the second type of result; When the average signal strength during the audit period is less than or equal to the average signal strength threshold, and the audit difference flow is less than or equal to the negative flow difference threshold, setting the first audit result to the third category result; When the average signal strength during the audit period is less than or equal to the average signal strength threshold, and the audit difference flow is greater than or equal to the flow difference threshold, setting the first audit result to the fourth category result; When the average signal strength during the audit period is greater than the average signal strength threshold, and the audit difference flow is less than or equal to the negative flow difference threshold, setting the first audit result to the fifth category result; When the average signal strength during the audit period is greater than the average signal strength threshold, and the audit difference flow is greater than or equal to the flow difference threshold, the first audit result is set to the sixth category result.

10. The card resource allocation method of the Internet of Things device according to claim 2, characterized in that: The performing the new card resource switching process according to the first audit result when the first audit result is not a first type of result specifically includes: When the first audit result is not a first-category result, the IoT device sends a second new card application instruction carrying the first device identifier, the first network login card identifier, and the first audit result to the card resource server; and receives second new card data sent back by the card resource server; the second new card data includes a second new card identifier, a second new card operator identifier, a second new card package flow, and a second new card loading script; Performing script parsing and running processing on the second new card loading script of the second new card data; if the script parsing and running processing are successful, obtaining the current device system time as the corresponding fourth time and performing timestamp conversion on the fourth time to generate a corresponding fourth timestamp; The first card resource record whose first card identification field in the card resource list is the first login card identification is used as the corresponding old card resource record; the first card status field of the old card resource record is set to the inactive state; and the first inactivation timestamp field of the old card resource record is set to the fourth timestamp; Add a first card resource record with empty content to the card resource list as the corresponding new card resource record; and set the first card identification field, the first operator identification field and the first card package flow field of the new card resource record according to the second new card identification, the second new card operator identification and the second new card package flow of the second new card data; and set the first card type field of the new card resource record to a non-seed card type; and set the first card status field of the new card resource record to an activated state; and set the first activation timestamp field of the new card resource record to the fourth timestamp; and set the first deactivation timestamp field of the new card resource record to empty; The state of the IoT device is changed to the second state, and the device is reset after the state modification is successful.

11. The card resource allocation method of the Internet of Things device according to claim 2, characterized in that: The performing old card resource deletion processing according to the first old card identifier of the first old card recycling instruction specifically includes: The Internet of Things device extracts the first old card identifier from the first old card recycling instruction; deletes the first card resource record in the card resource list whose first card type field is a non-seed card type, whose first card status field is an inactive state, and whose first card identifier field matches the first old card identifier, and deletes the card data corresponding to the first old card identifier in the local storage space; sets the first recycling status to recycling success when data deletion is completed, and sends the first recycling receipt carrying the first device identifier and the first recycling status back to the card resource server.

12. The card resource allocation method of the Internet of Things device according to claim 2, characterized in that: The method further includes: the card resource server configures the card resource pool according to the resource card list entered by the administrator, specifically: The card resource server uses the resource card list entered by the administrator as the corresponding first list; the resource card list includes a plurality of entered resource card records; the entered resource card records include an entered resource card identification field, an entered resource card operation identification field, an entered resource card package flow field, and an entered resource card loading script field; Each of the input resource card records in the first list is used as the corresponding current input resource card record; and the input resource card identification field, the input resource card operation identification field, the input resource card package flow field and the input resource card loading script field of the current input resource card record are extracted as the corresponding current input resource card identification, the current input resource card operation identification, the current input resource card package flow and the current input resource card loading script; Confirm whether there is a first resource card record in the card resource pool whose first resource card identification field matches the currently entered resource card identification; if it is confirmed that it does not exist, add a new first resource card record to the card resource pool as the corresponding current resource card record; and set the first resource card identification field, the first resource card operation identification field, the first resource card package traffic field and the first resource card loading script field of the current resource card record to the corresponding currently entered resource card identification, the currently entered resource card operation identification, the currently entered resource card package traffic and the currently entered resource card loading script; and set the first resource card type field, the first resource card activation timestamp field and the first resource card deactivation timestamp field of the current resource card record to empty; and set the first resource card status field of the current resource card record to the deactivated state.

13. The card resource allocation method of the Internet of Things device according to claim 2, characterized in that: The method further includes: the card resource server manages the IoT device list and the card resource pool according to the initial device resource list entered by the administrator before each batch of IoT devices is put into use, specifically: Before each batch of IoT devices is put into use, the card resource server uses the device initial resource list entered by the administrator as the corresponding second list; the device initial resource list includes multiple device initial resource records; the device initial resource record includes a device identification field, a device seed card identification field and an initial login card identification field; Taking each of the device initial resource records in the second list as the corresponding current device initial resource record; and extracting the device identification field, the device seed card identification field and the initial login card identification field of the current device initial resource record as the corresponding current device identification, current device seed card identification and current initial login card identification; Confirm whether there is a first IoT device record in the IoT device list whose first device identification field matches the current device identification; if it is confirmed that there is, use the matched first IoT device record as the corresponding current IoT device record; if it is confirmed that there is not, add a new first IoT device record in the IoT device list as the corresponding current IoT device record and set the first device identification field of the newly added current IoT device record to the current device identification; set the first seed card identification field of the current IoT device record to the current device seed card identification; and set the first login card identification field of the current IoT device record to the current initial login card identification; The first resource card record whose first resource card identification field in the card resource pool matches the seed card identification of the current device is used as the corresponding first card record; and the current server system time is obtained as the corresponding first server time, and the first server time is converted into a timestamp to generate a corresponding first server timestamp; if the first resource card status field of the first card record is in an inactive state, the first resource card type field of the first card record is set to a seed card type, and the first resource card status field of the first card record is set to an activated state, and the first resource card activation timestamp field of the first card record is set to the first server timestamp, and the first resource card inactivation timestamp field of the first card record is set to empty; The first resource card record in the card resource pool whose first resource card identification field matches the current initial login card identification is used as the corresponding second card record; and the first resource card type field of the second card record is set to a non-seed card type.

14. The card resource allocation method of the Internet of Things device according to claim 2, characterized in that: The method further comprises: When receiving the first new card application instruction sent by the Internet of Things device, the card resource server extracts the first device identifier from the first new card application instruction; and extracts the first login card identifier field of the first Internet of Things device record whose first device identifier field in the Internet of Things device list matches the first device identifier as the corresponding first new card identifier; and extracts the first resource card operation identifier field, the first resource card package traffic field and the first resource card loading script field of the first resource card record whose first resource card identifier field in the card resource pool matches the first new card identifier as the corresponding first new card operator identifier, the first new card package traffic and the first new card loading script; and the corresponding first new card data composed of the obtained first new card identifier, the first new card operator identifier, the first new card package traffic and the first new card loading script is sent back to the Internet of Things device.

15. The card resource allocation method of the Internet of Things device according to claim 2, characterized in that: The method further comprises: When the card resource server receives the first new card binding instruction sent by the Internet of Things device, the card resource server extracts the first device identifier and the first network login card identifier from the first new card binding instruction; obtains the current server system time as the corresponding second server time, and performs timestamp conversion on the second server time to generate a corresponding second server timestamp; and uses the first Internet of Things device record whose first device identifier field in the Internet of Things device list matches the first device identifier as the corresponding current Internet of Things device record; and updates the first network login card identifier field of the current Internet of Things device record to the first network login card identifier; and uses the first resource card record whose first resource card identifier field in the card resource pool matches the first network login card identifier as the corresponding current resource card record; and updates the first resource card status field of the current resource card record to the activated status, and updates the first resource card activation timestamp field of the current resource card record to the second server timestamp; and sends the first binding receipt set as successful binding back to the Internet of Things device.

16. The card resource allocation method of the Internet of Things device according to claim 10, characterized in that: The method further comprises: When the card resource server receives the second new card application instruction sent by the IoT device, the card resource server extracts the first device identification, the first network login card identification and the first audit result from the second new card application instruction; and uses the first IoT device record whose first device identification field in the IoT device list matches the first device identification as the corresponding current IoT device record; and uses the first resource card record whose first resource card identification field in the card resource pool matches the first network login card identification as the corresponding current resource card record; and extracts the first resource card operation identification field and the first resource card package flow field of the current resource card record as the corresponding current resource card operation identification and current resource card package flow; When the first audit result is a second type result, select a first resource card record from the card resource pool, whose first resource card identification field has no corresponding second resource card identification field in the old card recycling list, whose first resource card type field is empty, whose first resource card status field is in an inactive state, whose first resource card operation identification field does not match the current resource card operation identification, and whose first resource card package flow field is closest to the current resource card package flow, as the corresponding switching resource card record; When the first audit result is a third - type result, calculate and generate a corresponding first package traffic according to the current resource card package traffic and a preset first increment percentage a, where the first package traffic = current resource card package traffic * (1 + a), 0 < a < 100%; and select from the card resource pool a first resource card record whose first resource card identification field has no corresponding second resource card identification field in the old card recycling list, whose first resource card type field is empty, whose first resource card status field is in an inactivated state, whose first resource card operation identification field does not match the current resource card operation identification, and whose first resource card package traffic field is closest to the first package traffic as the corresponding switching resource card record; When the first audit result is a fourth - type result, calculate and generate a corresponding second package traffic according to the current resource card package traffic and a preset first decrement percentage b, where the second package traffic = current resource card package traffic * (1 - b), 0 < b < 100%; and select from the card resource pool a first resource card record whose first resource card identification field has no corresponding second resource card identification field in the old card recycling list, whose first resource card type field is empty, whose first resource card status field is in an inactivated state, whose first resource card operation identification field does not match the current resource card operation identification, and whose first resource card package traffic field is closest to the second package traffic as the corresponding switching resource card record; When the first audit result is a fifth - type result, calculate and generate a corresponding third package traffic according to the current resource card package traffic and the first increment percentage a, where the third package traffic = current resource card package traffic * (1 + a); and select from the card resource pool a first resource card record whose first resource card identification field has no corresponding second resource card identification field in the old card recycling list, whose first resource card type field is empty, whose first resource card status field is in an inactivated state, whose first resource card operation identification field matches the current resource card operation identification, and whose first resource card package traffic field is closest to the third package traffic as the corresponding switching resource card record; When the first audit result is a sixth type result, the corresponding fourth package flow is calculated based on the current resource card package flow and the first reduction percentage b, where the fourth package flow = current resource card package flow * (1-b); and a first resource card record is selected from the card resource pool, whose first resource card identification field does not have a corresponding second resource card identification field in the old card recycling list, whose first resource card type field is empty, whose first resource card status field is in an inactive state, whose first resource card operation identification field matches the current resource card operation identification, and whose first resource card package flow field is closest to the fourth package flow as the corresponding switching resource card record; Acquire the current server system time as the corresponding third server time, and perform timestamp conversion on the third server time to generate a corresponding third server timestamp; In the card resource pool, the first resource card type field of the current resource card record is reset to empty; the first resource card status field of the current resource card record is updated to an inactivated state; the first resource card inactivation timestamp field of the current resource card record is updated to the third server timestamp; the first resource card identification field of the current resource card record is extracted as the corresponding second resource card identification field, the first device identification field of the current IoT device record is extracted as the corresponding second device identification field, and the first old card record corresponding to the obtained second resource card identification field and the second device identification field is added to the old card recycling list; In the card resource pool, the first resource card type field of the switching resource card record is updated to a non-seed card type; and the first resource card identification field, the first resource card operation identification field, the first resource card package flow field and the first resource card loading script field of the switching resource card record are extracted as the corresponding second new card identification, the second new card operator identification, the second new card package flow and the second new card loading script; The second new card data corresponding to the obtained second new card identifier, the second new card operator identifier, the second new card package traffic and the second new card loading script are sent back to the Internet of Things device.

17. The card resource allocation method of the Internet of Things device according to claim 11, characterized in that: The method further includes the card resource server periodically performing old card recycling processing according to the old card recycling list, specifically: The card resource server regularly traverses each of the first old card records in the old card recycling list according to a preset fourth time period; during the traversal, the first old card record currently traversed is used as the current old card record; and the second resource card identification field and the second device identification field of the current old card record are extracted as the corresponding current resource card identification and current device identification; and the first resource card operation identification field and the first resource card deactivation timestamp field of the first resource card record that matches the first resource card identification field in the card resource pool with the current resource card identification are extracted as the corresponding current operator identification and current deactivation timestamp; and the time difference between the current server system time and the current deactivation timestamp is calculated to generate a corresponding first time difference; and in the When the first time difference exceeds the preset first time period, the telecommunications operator interface corresponding to the current operator identifier is called to obtain the data traffic of the telecommunications card corresponding to the current resource card identifier in the most recent first time period to generate the corresponding first data traffic; and when the first data traffic is lower than the minimum traffic threshold, the current resource card identifier is used as the corresponding first old card identifier, and the first old card recycling instruction carrying the first old card identifier is issued to the Internet of Things device corresponding to the current device identifier; and the first recycling receipt sent back by the Internet of Things device corresponding to the current device identifier is received, and the first recycling status is extracted from the first recycling receipt; and when the first recycling status is successful recycling, the current old card record is deleted from the old card recycling list.

18. The card resource allocation method of the Internet of Things device according to claim 11, characterized in that: The method further includes the card resource server periodically performing capacity expansion management on the card resource pool, specifically: The card resource server regularly counts the total amount of all the first resource card records in the card resource pool according to a preset fifth time period to generate a corresponding first resource pool card total amount; and sums up the first resource card package flow field of all the first resource card records in the card resource pool to generate a corresponding first resource pool total flow; and counts the total amount of the first resource card records in the card resource pool whose first resource card status field is in an inactive state and whose first resource card type field is empty to generate a corresponding first unallocated card total amount; and sums up the first resource card records in the card resource pool whose first resource card status field is in an inactive state and whose first resource card type field is empty to generate a corresponding first unallocated card total amount. The first resource card package flow field of the first resource card record is statistically generated to generate a corresponding first unallocated total flow; and the ratio of the first unallocated card total amount to the first resource pool card total amount is used as the corresponding first effective card ratio, and the ratio of the first unallocated total flow to the first resource pool total flow is used as the corresponding first effective flow ratio; and when the first effective card ratio is lower than a preset card ratio threshold or the first effective flow ratio is lower than a preset flow ratio threshold, the card resource pool is expanded in resource card capacity until the latest effective card ratio is not lower than the card ratio threshold and the latest effective flow ratio is not lower than the flow ratio threshold.

19. An electronic device, characterized in that: include: memory, processors, and transceivers; The processor is used to couple with the memory, read and execute instructions in the memory, so as to implement the method steps described in any one of claims 1 to 18; The transceiver is coupled to the processor, and the processor controls the transceiver to send and receive messages.

20. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, which, when executed by a computer, enable the computer to execute the method according to any one of claims 1 to 18.

Citation Information

Patent Citations

  • Internet of Things preset resource processing method and device

    CN103874051A

  • Seed code number management method of Internet of Things identity recognition module

    CN113688432A