Apn dynamic selection method and smart meter

CN122458129BActive Publication Date: 2026-09-25SHENZHEN CLOU ELECTRONICS +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202610884868.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-06-18
Publication Date
2026-09-25
Estimated Expiration
2046-06-18

AI Technical Summary

Technical Problem

[0004]本申请的主要目的在于提供一种APN动态选择方法及智能电表,旨在解决人工手动配置APN参数操作繁琐的技术问题

Benefits of technology

通过自动识别智能电表所插入SIM卡的运营商标识,并与预设APN列表进行动态匹配,实现了APN参数的自动配置与网络连接的自动建立,从而避免了与预设单一APN参数不匹配时,无法完成网络注册与激活,以及避免人工手动配置APN参数的繁琐操作,提升了智能电表在不同运营商网络环境下的自适应能力和即插即用性能,保障了网络连接效率和可靠性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122458129B_ABST
    Figure CN122458129B_ABST
Patent Text Reader

Abstract

The application discloses an APN dynamic selection method and a smart meter, relates to the access point selection technical field of a wireless communication network, and comprises the following steps: acquiring the operator identifier of the network registered by the SIM card currently inserted into the smart meter; matching the operator identifier corresponding to the SIM card with the operator identifier in a preset APN list; the APN list contains at least one record, and the record comprises an operator identifier and a corresponding APN parameter; if matching is successful in the APN list, the matched APN parameter is used as a target APN parameter; if matching fails in the APN list, a preset basic APN parameter is used as the target APN parameter; and network connection is established based on the target APN parameter. The application improves the self-adaptive capability and the plug-and-play performance of the smart meter in different operator network environments, and guarantees the network connection efficiency and reliability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of access point selection technology for wireless communication networks, and in particular to an APN dynamic selection method and a smart meter. Background Technology

[0002] In a smart electricity consumption information collection system, smart meters interact with the main station system via a built-in remote communication module, enabling automatic uploading of electricity consumption data and the issuance of control commands. When establishing a data transmission link based on a cellular mobile communication network, the remote communication module must be configured with the correct Access Point Name (APN). The APN parameter is a key parameter in the mobile communication core network used to distinguish service access types and divide data network domains. It determines whether the communication module can successfully complete network attachment and PDP (Packet Data Protocol) context activation, and is a prerequisite for establishing a valid data link.

[0003] Currently, the remote communication modules of smart meters generally rely on manual configuration of APN parameters. When it is necessary to change to a different operator's SIM card (Subscriber Identity Module), the manual configuration of APN parameters is cumbersome, resulting in low network connection efficiency for smart meters. Summary of the Invention

[0004] The main purpose of this application is to provide an APN dynamic selection method and a smart meter, which aims to solve the technical problem of cumbersome manual configuration of APN parameters.

[0005] To achieve the above objectives, this application proposes an APN dynamic selection method, which includes: Obtain the operator identifier of the network to which the currently inserted SIM card of the smart meter is registered; The operator identifier corresponding to the SIM card is matched with the operator identifier in the preset APN list; the APN list contains at least one record, and the record includes the operator identifier and the corresponding APN parameters; If a match is found in the APN list, the matched APN parameter will be used as the target APN parameter. If no match is found in the APN list, the preset base APN parameter will be used as the target APN parameter. Network connection is established based on the target APN parameters.

[0006] In one embodiment, the step of matching the operator identifier corresponding to the SIM card with the operator identifiers in a preset APN list includes: The operator identifier corresponding to the SIM card is compared sequentially with the operator identifiers of each record in the APN list; When a matching operator identifier is found, it is determined that a successful match has been made in the APN list; If, after comparing all records in the APN list, no matching operator identifier is found, it is determined that the matching in the APN list has failed. Following the step of establishing a network connection based on the target APN parameters, the method further includes: If establishing a network connection based on the target APN parameters fails, the system continues to traverse the records with the same operator identifier in the APN list, and retrieves the corresponding APN parameters in turn to retry establishing a network connection, until the network connection is successful or all records with the same operator identifier have been traversed.

[0007] In one embodiment, the step of sequentially comparing the operator identifier corresponding to the SIM card with the operator identifiers of each record in the APN list includes: Get the current matching index; Based on the current matching index, the operator identifier corresponding to the SIM card is compared sequentially with the operator identifiers of each record in the APN list; Following the step of establishing a network connection based on the target APN parameters, the method further includes: If a network connection is successfully established based on the target APN parameters, the matching index of the target APN parameters in the APN list is saved.

[0008] In one embodiment, after the step of sequentially comparing the operator identifier corresponding to the SIM card with the operator identifiers of each record in the APN list, the method further includes: If the operator identifier corresponding to the SIM card fails to match the operator identifier corresponding to the current matching index, or if the network connection based on the target APN parameter fails to be established, then the matching index is incremented by 1 to become the updated matching index. If the updated matching index is less than the total number of entries in the APN list, then return to the step of sequentially comparing the operator identifier corresponding to the SIM card with the operator identifier of each record in the APN list; If the updated matching index is equal to the total number of entries in the APN list, then it is determined that the match with the APN list has failed.

[0009] In one embodiment, after the step of establishing a network connection based on the target APN parameters, the method further includes: If the target APN parameter comes from the APN list and a network connection is successfully established based on the target APN parameter, then the target APN parameter and the corresponding matching index are saved.

[0010] In one embodiment, after the step of saving the target APN parameter and the corresponding matching index, the method further includes: If the smart meter restarts, it reads the saved target APN parameters to establish a network connection. If a network connection is successfully established using the saved target APN parameters, the current network will be maintained. If establishing a network connection using the saved target APN parameters fails, the matching process will begin from the next position of the matching index in the APN list.

[0011] In one embodiment, the step of matching the operator identifier corresponding to the SIM card with the operator identifiers in a preset APN list includes: Perform dual-mode matching between the operator identifier corresponding to the SIM card and the operator identifier of each record in the preset APN list; The dual-mode matching includes support for matching both number concatenation formats and string formats.

[0012] In one embodiment, the method further includes: Determine whether the APN list meets the preset valid state conditions; If the valid state conditions are not met, the basic APN parameters are invoked, and a network connection is established based on the basic APN parameters. If the valid state conditions are met, then the step of obtaining the operator identifier of the network registered by the SIM card currently inserted into the smart meter is executed.

[0013] In one embodiment, the step of determining whether the APN list meets the preset valid state conditions includes: Determine whether the APN list is empty and whether the data record format of the APN list conforms to preset rules; If the APN list is empty or the data record format does not conform to the preset rules, the APN list is determined to not meet the valid state conditions; if the APN list is not empty and the data record format conforms to the preset rules, the APN list is determined to meet the valid state conditions.

[0014] In addition, to achieve the above objectives, this application also proposes a smart meter, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the APN dynamic selection method as described above.

[0015] One or more technical solutions proposed in this application have at least the following technical effects: By automatically identifying the operator's identifier of the SIM card inserted into the smart meter and dynamically matching it with the preset APN list, the automatic configuration of APN parameters and the automatic establishment of network connection are realized. This avoids the inability to complete network registration and activation when the preset single APN parameter does not match, and avoids the tedious operation of manually configuring APN parameters. It improves the smart meter's adaptability and plug-and-play performance in different operator network environments, and ensures network connection efficiency and reliability. Attached Figure Description

[0016] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0017] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is a simplified flowchart illustrating the smart meter networking process provided in the APN dynamic selection method of this application. Figure 2 This is a flowchart illustrating an embodiment of the APN dynamic selection method of this application. Figure 3 This is a flowchart illustrating Embodiment 2 of the APN dynamic selection method of this application. Figure 4 This is a flowchart illustrating Embodiment 3 of the APN dynamic selection method of this application; Figure 5 This is a flowchart illustrating Embodiment 4 of the APN dynamic selection method of this application; Figure 6 This is a schematic diagram illustrating the specific process of Embodiment 4 of the APN dynamic selection method in this application. Figure 7 This is a schematic diagram of the device structure of the hardware operating environment involved in the APN dynamic selection method in this application embodiment.

[0019] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0020] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.

[0021] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.

[0022] The main solution of this application embodiment is as follows: obtain the operator identifier of the network registered by the SIM card currently inserted in the smart meter; match the operator identifier corresponding to the SIM card with the operator identifier in the preset APN list; the APN list contains at least one record, the record includes the operator identifier and the corresponding APN parameter; if the match is successful in the APN list, the matched APN parameter is used as the target APN parameter; if the match fails in the APN list, the preset basic APN parameter is used as the target APN parameter; establish a network connection based on the target APN parameter.

[0023] In this embodiment, for ease of description, the following description uses a smart meter as the execution subject.

[0024] This application provides a solution that automatically identifies the operator's identifier of the SIM card inserted into the smart meter and dynamically matches it with a preset APN list. This enables automatic configuration of APN parameters and automatic establishment of network connections, thereby avoiding the inability to complete network registration and activation when the parameters do not match a preset single APN. It also avoids the tedious operation of manually configuring APN parameters, improves the smart meter's adaptability and plug-and-play performance in different operator network environments, and ensures network connection efficiency and reliability.

[0025] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an electronic device or smart meter capable of performing the above functions. The following description uses a smart meter as an example to illustrate this embodiment and the subsequent embodiments.

[0026] Reference Figure 1 The hierarchical communication architecture of the electricity consumption information collection system Figure 1 This paper describes a typical architecture in which the master station establishes a communication connection with the smart meter by using a remote communication module as a relay or gateway.

[0027] The HES (Head End System) master station is located at the top level and serves as the central management or master station system. The HES master station is the core of the smart meter reading system, responsible for centrally collecting, processing, and managing data from meters such as water meters and gas meters, and providing billing, monitoring, analysis, and maintenance support.

[0028] The remote communication module is located in the middle layer and interacts with the HES master station via a remote communication link. This remote communication module can be a 4G module or a 5G module.

[0029] The smart meter is located at the lowest level and connects to the remote communication module via a local communication link. A smart meter is a digital metering device based on Internet of Things (IoT) technology, used to automatically collect, store, and transmit data on energy consumption such as water, electricity, gas, and heat. Compared to traditional mechanical meters, smart meters possess remote communication, real-time monitoring, and data analysis capabilities, making them a key infrastructure for smart cities and energy management.

[0030] The entire remote communication module and smart meter belong to the field terminal equipment side. The concentrator is the central management and control device of the remote centralized meter reading system, responsible for functions such as periodically reading meter data, transmitting and executing system commands, data communication, network management, event logging, and data transmission.

[0031] Based on this, embodiments of this application provide an APN dynamic selection method, referring to... Figure 2 , Figure 2 This is a flowchart illustrating the first embodiment of the APN dynamic selection method of this application.

[0032] In this embodiment, the APN dynamic selection method includes steps S10 to S50: Step S10: Obtain the operator identifier of the network registered to the SIM card currently inserted in the smart meter.

[0033] After the smart meter is powered on, the remote communication module first completes the basic network registration process. It queries the cellular network information registered to the current SIM card by sending standard AT commands and extracts the operator identifier from the returned information. AT commands are a standardized text command set used to control communication devices such as modems, cellular communication modules, Wi-Fi modules, and Bluetooth modules.

[0034] Carrier identifiers include MCC (Mobile Country Code) and MNC (Mobile Network Code). MCC indicates the country or region represented; MNC indicates the carrier represented. The carrier identifier uniquely identifies a specific carrier's network within a given country.

[0035] Optionally, the operator identifier can be a numerical concatenation format, such as directly concatenating MCC and MNC. The operator identifier can also be a string format, such as CHN-UNICOM, CHN-MOBILE, or CHN-CT. Both formats can be read or configured simultaneously to accommodate behavioral differences between different operator SIM cards or different module firmware.

[0036] In actual engineering deployments, an invalid APN list may be due to various reasons, including not being configured, incorrect configuration, data corruption, or being disabled. Not being configured means that the APN list may have been forgotten during smart meter production or field deployment, or the list may be empty. Incorrect configuration means the APN list data format does not conform to preset rules, such as missing required fields, incorrect field types, or corrupted JSON format. Data corruption means that the APN list data stored on the non-volatile storage medium is partially or completely corrupted due to abnormal power outages, aging, or other reasons. Being disabled means that maintenance personnel have temporarily disabled the APN list function to force the use of the basic APN.

[0037] Executing the traversal and matching process even when the APN list is invalid will result in meaningless processing overhead. Traversing an empty or malformed list will not produce any matching results, wasting CPU time and power. This can lead to program exceptions; if the code does not have defensive handling for empty lists or malformed lists, it may cause crashes such as memory access violations or parsing errors. It may also increase latency; although the matching process for an invalid list ultimately fails, it still takes time, extending the total time for the device to establish a network connection after power-on. Ultimately, this leads to a degraded user experience; users may mistakenly believe the device is malfunctioning when it is actually just a missing APN list configuration.

[0038] Before performing any matching operation involving the APN list, the system first checks whether the APN list itself is in a valid and usable state. If invalid, the entire APN list matching process is skipped, and the basic APN parameters are used to establish a connection. Only when the list is valid will the subsequent process of obtaining the operator identifier and matching proceed. This mechanism constitutes the first level of fault tolerance in the entire APN selection scheme, preventing invalid processing due to incorrect or missing APN list configurations. By pre-checking the validity of the APN list, and directly downgrading to use the basic APN parameters to establish a network connection when the list is abnormal, the risk of the entire dynamic matching mechanism being paralyzed due to the unavailability of the APN list is avoided. This improves the fault tolerance and communication reliability of smart meters in extreme scenarios such as data anomalies or storage failures, and achieves anomaly prediction and degradation protection, ensuring that the device always has basic network access capabilities.

[0039] In an optional embodiment, the method further includes: determining whether the APN list meets preset valid state conditions; if not, calling the basic APN parameters and establishing a network connection based on the basic APN parameters; if yes, performing the step of obtaining the operator identifier of the network registered by the SIM card currently inserted into the smart meter.

[0040] During the power-on or network connection initialization phase of the smart meter, the remote communication module first reads the APN list data stored on non-volatile media, such as an array or a JSON object. Then, it calls a validity check function to verify the data.

[0041] By pre-judging the validity status of the APN list, if the list is abnormal, it directly falls back to the basic APN parameters to establish a network connection to avoid invalid matching. If the list is valid, it automatically identifies the SIM card operator identifier and dynamically matches it with the preset APN list. If the match is successful, the corresponding APN parameters are used; if the match fails, it also falls back to the basic APN parameters to ensure that the device always has network connectivity, thereby improving the connection success rate in complex network environments.

[0042] Optionally, the step of determining whether the APN list meets the preset valid state conditions includes: determining whether the APN list is empty and whether the data record format of the APN list conforms to the preset rules; wherein, if the APN list is empty or the data record format does not conform to the preset rules, the APN list is determined not to meet the valid state conditions; if the APN list is not empty and the data record format conforms to the preset rules, the APN list is determined to meet the valid state conditions.

[0043] The validity checks include, but are not limited to: whether the list data is empty (i.e., it contains at least one record); whether the list data structure conforms to a predefined format; whether each record contains a carrier identifier and APN parameter fields, and whether the field types are correct; and whether the value of each record in the list is within a reasonable range, for example, the APN name length does not exceed 100 characters, and the carrier identifier format conforms to numeric or string specifications.

[0044] Optionally, valid status conditions can be further subdivided into multiple levels. Valid status conditions include fully valid, non-empty list, all records in the correct format, and the matching process can be used normally. Valid status conditions include partially valid, non-empty list, but a few records with incorrect format, such as a record missing an APN field; invalid records can be filtered out, and only valid records are used for matching. Valid status conditions include completely invalid, empty list, or all records with incorrect format; the basic APN parameters are used directly.

[0045] If the APN list is determined to be valid, step S10 and subsequent related steps are executed. If the APN list is determined to be invalid, the entire APN dynamic selection process will not execute the subsequent operator identifier acquisition and matching steps, and will instead read the preset basic APN parameters. The communication module uses these basic APN parameters to attempt to establish a network connection. If the connection is successful, the network is maintained; if the connection fails, a retry mechanism is triggered or a fault is reported. This ensures that even in the extreme case of a completely lost or corrupted APN list, the device can still hope to establish a basic data connection.

[0046] When an invalid APN list is detected, in addition to downgrading to the basic APN list, the device can also restore the factory default list. If a default APN list is pre-configured in the device firmware, this default list is written to non-volatile storage, replacing the corrupted list, and marked as valid. Alternatively, the device can remotely request a list. After successfully connecting to the network using the basic APN, the device can request an updated APN list configuration from a remote server and write it to storage, thereby automatically repairing invalid local lists.

[0047] When an invalid APN list is detected, the event can be logged in the device log. An alarm can be issued via a specific indicator light or by reporting to the master station, prompting on-site or remote maintenance personnel to check the configuration.

[0048] By effectively verifying the status of the APN list from two dimensions—namely, the non-emptiness of the list and the compliance of the data record format—a dual check on the completeness and correctness of the APN list is achieved. When the list is empty or the record format is abnormal, it is promptly determined to be invalid and the basic APN degradation strategy is triggered. This effectively avoids matching failures or system anomalies caused by missing data, format errors, or corrupted records, thereby improving the robustness, data security, and anomaly defense capabilities of the smart meter's dynamic APN selection process and ensuring that the entire dynamic matching mechanism operates on a reliable data foundation.

[0049] Step S20: Match the operator identifier corresponding to the SIM card with the operator identifier in the preset APN list; the APN list contains at least one record, and the record includes the operator identifier and the corresponding APN parameters.

[0050] Before smart meter production or on-site deployment, the equipment manufacturer or power company pre-configures an APN list based on the actual SIM card used and its corresponding APN parameters. This list is stored in the non-volatile memory of the communication module. The APN list includes at least one record, which includes the operator identifier and the corresponding APN parameters. Optional fields for the record also include: username, password, authentication method, etc. The APN parameters include the access point name corresponding to the operator.

[0051] The system reads a pre-defined APN list and uses a traversal comparison algorithm to compare the operator identifier corresponding to the SIM card with the operator identifier field of each record in the APN list. If the SIM card returns a numeric format, it prioritizes matching numeric records in the list; if no match is found, it converts string formats in the list to their corresponding numeric codes before matching. If the SIM card returns a string format, it prioritizes matching string formats in the list; alternatively, it can convert the string format and then match numeric formats.

[0052] Optionally, the matching result may include a successful match in the APN list, indicating that a record matching the SIM card operator's identifier was found. A matching result may also include a failed match in the APN list, indicating that no match was found after traversing the entire APN list.

[0053] If the matching result is successful, the matched APN parameter is determined as the target APN parameter. If the matching result fails, and the APN list does not contain an operator identifier corresponding to the current SIM card, the APN parameter cannot be directly obtained from the list. Optionally, a preset base APN parameter is invoked to attempt to establish a network connection. This base APN can be considered as a last resort channel. The system automatically switches to the pre-configured base APN and attempts to connect to ensure the device remains online as much as possible. Optionally, if a default wildcard record exists in the APN list, the APN parameter in that record is used. Optionally, a matching failure event is reported, triggering manual remote configuration or waiting for a backup plan.

[0054] In an optional embodiment, step S20 includes: performing a dual-mode match between the operator identifier corresponding to the SIM card and the operator identifiers of each record in a preset APN list; wherein, the dual-mode match includes matching in both number concatenation format and string format. By employing a dual-mode matching mechanism, both number concatenation format and string format operator identifiers are simultaneously supported for comparison, thereby overcoming matching obstacles caused by inconsistencies in the identifier formats returned by different SIM cards or different communication modules.

[0055] In mobile communication networks, operator identifiers use a concatenated number format, such as MCC and MNC directly concatenated into a single number string. Operator identifiers also use a string format, combining the country code and the operator's name in letters, ensuring good readability.

[0056] A traversal comparison algorithm is employed to perform dual-pattern matching on either the concatenated number format or the string format in the APN list. The smart meter reads the operator identifier of the currently inserted SIM card through its communication module. The program accesses the APN list stored in the module, starting from the first record. The operator identifier in the current record is compared with the operator identifier of the SIM card. If they are equal, the correct record has been found. The algorithm immediately stops traversing and returns the APN parameters stored in this record. If they are not equal, the record does not match. If the current record does not match, the program moves to the next record in the APN list.

[0057] Dual-mode matching aims to support both formats simultaneously, ensuring correct identification and matching regardless of whether the SIM card returns a number or a string, or what format is stored in the APN list. In the number concatenation format, the number string returned by the SIM card is compared numerically or string-wise with the operator identifier field recorded in the APN list. In the string format, the string returned by the SIM card is compared with the string field recorded in the APN list.

[0058] To improve the matching success rate, dual-mode matching can also include cross-type comparison after format conversion. If the SIM card returns a number format but the APN list stores a string format, the number is converted to the corresponding string using the built-in operator mapping table before comparison. If the SIM card returns a string format but the APN list stores a number format, the string is converted to the corresponding number string using the mapping table before comparison.

[0059] When dual-mode matching fails, the original identifier returned by the SIM card and the format and value of all records in the APN list are recorded. This helps remote maintenance personnel analyze whether the mapping table is incomplete or the configuration is missing, and then update the APN list or mapping table.

[0060] By introducing a dual-mode matching mechanism that supports both digital splicing and string formats, the compatibility issues caused by inconsistent operator identifier storage formats in different operator networks or SIM cards are resolved. This improves the flexibility, accuracy, and universality of the APN dynamic matching process, avoids matching failures due to format differences, and further ensures the smart meter's adaptive access capability and communication stability in heterogeneous network environments.

[0061] Step S30: If a match is found in the APN list, the matched APN parameter is used as the target APN parameter.

[0062] After comparing the current SIM card's operator identifier with the operator identifiers in the preset APN list, if at least one record is found to have an operator identifier that matches the SIM card information, it is determined that the match in the APN list is successful.

[0063] From the successfully matched records in the APN list, read their corresponding APN parameter fields. If multiple records correspond to the same operator identifier in the list, for example, if the same operator provides multiple different APN parameters, the first matched APN parameter can be selected as the target APN parameter according to the record order or priority. In a more preferred embodiment, priority weights can be pre-configured for each record, prioritizing the use of higher-priority APN parameters. The APN parameter is then assigned to the target APN variable required for the current network connection establishment process.

[0064] The smart meter's communication module initiates PDP context activation using the target APN parameter to attempt to establish a data network connection. If the connection is successful, it is maintained for subsequent rapid recovery. If the connection fails, it can continue to try other APN records with the same operator identifier in the list, or perform subsequent fault tolerance processing.

[0065] Step S40: If a match fails in the APN list, the preset base APN parameter is used as the target APN parameter.

[0066] After comparing the current SIM card's operator identifier with the operator identifiers of all records in the APN list, if no operator identifier matches, it is determined that the matching in the APN list has failed.

[0067] The basic APN parameters are pre-stored in the non-volatile storage medium of the communication module, independently of the APN list. These basic APN parameters can be generic and widely supported public APN parameters. As a last resort, the basic APN parameters ensure that the device still has a chance to connect to the network when the APN list cannot be matched. The basic APN parameters are then assigned to the target APN variable.

[0068] Optionally, the preset base APN parameter can be a small list of backup APNs instead of a single value. After a matching failure, these backup APNs are tried sequentially until the connection succeeds or all connections fail, further improving fault tolerance.

[0069] The smart meter's communication module attempts to establish a network connection using basic APN parameters. If the connection is successful, it is maintained, and the basic APN parameters can be temporarily marked as valid for quick recovery next time. After successfully establishing a network connection using the basic APN parameters, the basic APN parameters can be associated with the current SIM card's carrier identifier and dynamically added to the APN list. This ensures that subsequent insertions of SIM cards from the same carrier will result in a direct match, eliminating reliance on the basic APN parameters and achieving self-learning capabilities. If the network connection still fails, more advanced fault-tolerance mechanisms can be implemented, such as delayed retries, module restarts, and reporting fault alarms.

[0070] When the operator identifier matches successfully, the corresponding precise APN parameters are used to ensure the targeting and optimization of the network connection. When the match fails, it automatically falls back to the preset basic APN parameters to ensure that the device can still establish a basic network connection. This improves the robustness and environmental adaptability of smart meters in abnormal scenarios such as unknown operators or outdated APN lists, achieving a balance between compatibility and reliability, and avoiding communication interruptions or device offline issues caused by matching failures.

[0071] Step S50: Establish a network connection based on the target APN parameters.

[0072] In this embodiment, the communication module of the smart meter uses the target APN parameter to initiate PDP context activation and attempt to establish a data network connection.

[0073] If the network connection is successful, it will be maintained, allowing the smart meter to interact with the master station. The APN parameters and the matched list indexes from this successful connection can be saved to non-volatile storage for quick recovery upon the next restart.

[0074] If the network connection fails, continue iterating through the next matching record in the APN list. The same operator identifier may correspond to multiple APN parameters, such as private network APN parameters and public network APN parameters. If it still fails after iterating through all matching records, it downgrades to the basic APN parameters. If the basic APN parameters also fail, it triggers a retry, a delayed restart, or reports the fault.

[0075] In the technical solution of this embodiment, by automatically identifying the operator identifier of the SIM card inserted into the smart meter and dynamically matching it with the preset APN list, the automatic configuration of APN parameters and the automatic establishment of network connection are realized. This avoids the inability to complete network registration and activation when the preset single APN parameter does not match, and avoids the tedious operation of manually configuring APN parameters. It improves the smart meter's adaptability and plug-and-play performance in different operator network environments, and ensures network connection efficiency and reliability.

[0076] Based on any embodiment of this application, in the second embodiment of this application, the content that is the same as or similar to the above embodiments can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 3 Step S20 includes: Step S21: Compare the operator identifier corresponding to the SIM card with the operator identifiers of each record in the APN list in sequence; Step S22: When a matching operator identifier is found, it is determined that a successful match has been made in the APN list; Step S23: After comparing all records in the APN list, if no matching operator identifier is found, it is determined that the matching in the APN list has failed. After step S50, the following is also included: Step S60: If the network connection fails to be established based on the target APN parameter, continue to traverse the records with the same operator identifier in the APN list, and obtain the corresponding APN parameters in turn to retry establishing the network connection until the network connection is successful or all records with the same operator identifier have been traversed.

[0077] When multiple APN parameters correspond to the same operator identifier in the APN list, a sequential comparison is used to obtain the first matching APN parameter for connection establishment. If the network connection fails, it does not immediately degrade to the basic APN parameter, but continues to search for the next APN parameter in the same operator's records and retry until success or all alternative APN parameters for that operator fail. This mechanism significantly enhances fault tolerance in scenarios involving the same operator and improves the success rate of network connections.

[0078] In actual deployments, the same operator may provide multiple APN parameters for different services or different user groups. For smart meters, deployments by different power companies or in different regions may require the use of different APN parameters.

[0079] A sequential traversal approach is used to compare the operator identifier obtained by the current SIM card with the operator identifier field of each record in the APN list. The comparison order follows the storage order of the list, for example, indexes 0, 1, 2, 3...

[0080] When the operator identifier of a record matches the operator identifier of the SIM card for the first time, the corresponding APN parameter is obtained and used as the target APN parameter. At this point, instead of continuing to traverse subsequent records in the list, the APN parameter is immediately used to attempt to establish a network connection.

[0081] Based on the obtained APN parameters, the communication module initiates processes such as PDP context activation to attempt to establish a data network connection. If the network connection is successful, the process ends normally, maintaining the network connection, and optionally recording the APN and its index. If the network connection fails, a fault tolerance mechanism is triggered.

[0082] If establishing a network connection using the current APN parameters fails, the process does not immediately downgrade to the base APN parameters. Instead, the current index is recorded; let's say the index of the failed record is i. The process continues traversing, starting from index i+1, and continues scanning the APN list. Records with the same carrier identifier are searched. For each subsequent record, its carrier identifier is first checked to see if it matches the SIM card's carrier identifier. If they don't match, the record is skipped and the process continues. The next APN parameter is obtained. When another record with the same carrier identifier is found, its APN parameter is extracted as the new target APN parameter. The connection establishment process is retried using the newly obtained APN parameter.

[0083] The above process is repeated until a network connection is successfully established. At this point, the process ends, and the successfully used APN and its index are recorded. Alternatively, all records with the same operator identifier are traversed. If no other record of the same operator is found after reaching the end of the list, or if a record is found but all connections fail, then it is determined that all alternative APN parameters for that operator are unavailable.

[0084] Once all attempts to connect to records matching the SIM card carrier have failed, the process can proceed to a fault-tolerant phase. For example, it might continue iterating through records from other carriers in the APN list. Alternatively, it could attempt a final attempt using preset base APN parameters. If the base APN also fails, a retry mechanism is triggered, or a fault is reported.

[0085] In the technical solution of this embodiment, the operator identifier is quickly matched by sequential comparison, and multiple APN records are configured for the same operator to form a backup mechanism. When the network connection is established by the first matched APN parameter fails, other APN records under the same operator are automatically traversed and retried in turn until the connection is successful or the backup records are exhausted. This solves the communication interruption problem caused by the failure of a single APN, improves the success rate, fault tolerance and communication reliability of smart meter network connection, and realizes automatic recovery and self-healing in abnormal scenarios.

[0086] Based on any embodiment of this application, in the third embodiment of this application, the content that is the same as or similar to the above embodiments can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 4 Step S21 includes: Step S211: Obtain the current matching index; Step S212: Based on the current matching index, compare the operator identifier corresponding to the SIM card with the operator identifier of each record in the APN list in sequence; After step S50, the following is also included: Step S70: If a network connection is successfully established based on the target APN parameters, then the matching index of the target APN parameters in the APN list is saved.

[0087] In the actual operation of smart meters, there may be instances where the device suddenly loses power or restarts while running normally; or after failing to establish a connection using a certain APN, it needs to try the next APN in the list; or the device needs to quickly restore network connectivity after waking up from sleep mode. If the entire APN list is traversed from the beginning in each of these scenarios, it will cause unnecessary processing overhead and connection latency. Especially when the APN list is large, or the network environment is unstable and requires multiple attempts with different APNs, this repetitive traversal will significantly impact the user experience.

[0088] The match index is an integer value indicating the position of the record currently in use or last successfully matched in the APN list. The index typically starts at 0, corresponding to the first record in the list, and can be incremented as needed after each record is processed. This indexing mechanism allows for remembering the current match position in the APN list, enabling rapid resumption of the matching process after subsequent device restarts or connection failures. It avoids repeatedly traversing known invalid records, improving matching efficiency and connection recovery speed.

[0089] Before performing a match, a pre-stored variable, the current match index, is read from non-volatile storage. The meaning of this variable depends on the device's state—whether it's its first startup or has never successfully connected. If no index is stored, the current match index is set to a default value, such as 0 or -1. Preferably, it can be set to 0, meaning matching starts from the first record in the APN list. If a network connection was successfully established previously, the current match index stores the index of the successfully used record. If a connection using an APN using a particular record failed previously, and the system recorded the failure index, the current match index may point to the next record to be attempted, i.e., the failure index + 1. By obtaining this index, the matching process doesn't have to start from the head of the list each time; instead, it can start from the position indicated by the index or continue from there.

[0090] Optionally, based on the obtained current matching index, the current matching index is used as the starting point, and matching is performed sequentially from that record. That is, if the connection failed at index i last time, it will continue to try from i+1 this time. Optionally, if the current matching index points to a record that has been successfully matched before, then matching and joining attempts are performed only on that record first, without traversing the entire list, which is suitable for fast recovery scenarios.

[0091] Once the carrier identifier matches and a network connection is successfully established using the APN parameters in the record, the record is indexed successfully. The position of the currently matched record in the APN list is written to non-volatile storage medium as the new value of the current matching index. This way, when the device restarts or needs to re-establish a connection, it can directly read this index and start matching from that index position, or directly use the stored APN parameters, thus skipping repeated matching of the first half of the list.

[0092] In an optional embodiment, after step S21, the method further includes: if the operator identifier corresponding to the SIM card fails to match the operator identifier corresponding to the current matching index, or if the network connection based on the target APN parameters fails to be established, then the matching index is incremented by 1 to become the updated matching index; if the updated matching index is less than the total number of entries in the APN list, then the method of sequentially comparing the operator identifier corresponding to the SIM card with the operator identifiers of each record in the APN list is returned; if the updated matching index is equal to the total number of entries in the APN list, then it is determined that the matching with the APN list has failed.

[0093] By automatically identifying the SIM card operator's identifier and dynamically matching it with a pre-set APN list, automated configuration and intelligent selection of APN parameters are achieved. When a match is successful, the corresponding APN parameters are used to establish a network connection directly. When a match fails, the connection falls back to the basic APN parameters to ensure that the device has basic network connectivity. At the same time, adaptive retrying is performed by traversing multiple backup APN records of the same operator, which improves the connection success rate in complex network environments. In addition, by saving the matching index of successful connections to accelerate subsequent access, the system achieves a highly reliable, low-latency, and maintenance-free adaptive network access effect for IoT terminals such as smart meters in multi-operator network environments.

[0094] When a match fails or a network connection fails to be established using a matched APN, an automatic retry process is formed by incrementing the matching index and checking whether the entire APN list has been traversed, until either a connection is successfully established or it is confirmed that there is no available configuration in the APN list, thus ensuring the integrity and determinism of the APN selection process.

[0095] During the matching process, for the record with index i in the APN list: the operator identifier of the SIM card is compared with the operator identifier of this record. If the comparison result is not equal, it means that the record is not suitable for the current SIM card. At this time, i = i + 1 is executed, and the matching index is pointed to the next record.

[0096] If a match is found, the APN parameter is retrieved from the record, and an attempt is made to establish a network connection. If the connection is successfully established, the process ends, the current network is maintained, and a success index is recorded.

[0097] If the connection fails to establish, it means that although the APN theoretically belongs to the current operator, it is unavailable in the current network environment. In this case, we still execute: i=i+1, pointing the matching index to the next record and preparing to continue trying. This avoids blocking the entire process due to the temporary unavailability of a single APN, and also provides opportunities for other APNs in the list.

[0098] After each index increment, a boundary judgment needs to be performed: i<N, where N is the total number of records in the APN list. If the condition is satisfied, it indicates that there are still records that have not been tried yet, and the process returns to step S21 to repeat the above matching and connection attempts for the next record. If the condition is not satisfied, it indicates that the entire APN list has been traversed, and each record either has an unmatched operator identifier, or matches but fails to connect, and no record can successfully establish a network connection. At this time, the algorithm determines that the overall matching with the APN list fails.

[0099] After determining that the matching with the APN list fails, preset basic APN parameters are called for a last attempt. If the basic APN parameters also fail, a retry or fault reporting process is entered.

[0100] Optionally, not all connection failures should trigger an immediate index increment. Some failures may be temporary, such as weak network signal and temporary congestion of the core network. Therefore, for temporary failures, after a failed attempt with the same index, the index is not incremented immediately, instead, retries are performed several times after waiting for a backoff period, and the index is incremented only if the attempt still fails. For permanent failures, such as error codes that explicitly indicate an invalid APN or rejection by the operator, the index can be incremented directly without retrying.

[0101] In extreme cases, if all records in the APN list have been tried but all fail, and the basic APN parameters also fail, the device may repeatedly execute the complete process. When the number of overall matching failures reaches a threshold, the process enters a long-term sleep mode or reports a fault, and no frequent retries are performed. After waiting for a period of time (e.g., 10 minutes), the index can be reset to 0, and the entire list is retried, because the network condition may have recovered.

[0102] When the current index matching fails or the network connection establishment fails, the index is automatically incremented to continue the attempt until the entire APN list is traversed, thereby ensuring the completeness and systematicity of the matching process with a concise and efficient index control logic, avoiding missing any potentially available APN records, improving the APN search efficiency and final connection success rate of smart meters in complex network environments, and at the same time realizing clear judgment of matching failure through a definite traversal termination condition.

[0103] In the technical solution of this embodiment, by introducing the acquisition and storage mechanism for the matching index, the current retrieval position is located before sequential comparison, and the valid index is recorded after the network connection is successful, thereby realizing the persistent memory of the APN optimization result; when the device initiates a network connection again, the stored successful index can be directly called to quickly locate valid APN parameters, which avoids the redundant operation of repeatedly traversing the entire APN list, shortens the time for subsequent network connection establishment, improves the startup efficiency and communication response speed of the smart meter, and further optimizes the intelligent level of dynamic APN selection by accumulating historical successful experience.

[0104] Based on any embodiment of this application, in the fourth embodiment of this application, the content that is the same as or similar to the above embodiments can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 5 After step S50, the following steps are also included: Step S80: If the target APN parameter comes from the APN list and a network connection is successfully established based on the target APN parameter, then save the target APN parameter and the corresponding matching index.

[0105] Smart meters may frequently restart due to maintenance, power outages, software upgrades, etc. Each restart requires re-traversing the APN list, causing unnecessary delays. When a temporary network failure causes a connection loss, the device needs to re-establish the connection. Matching from scratch each time results in lengthy recovery times. In most cases, the SIM card carrier used by the smart meter will not change frequently. Previously successfully connected APNs remain valid in the short term and should be used preferentially.

[0106] The target APN parameter may come from an APN list or basic APN parameters. After attempting to establish a network connection based on the target APN parameter, the communication module will obtain the connection result. A save operation is only triggered when the connection is successful. Criteria for determining a successful connection may include: successful PDP context activation, acquisition of an IP address, and the ability to communicate with the HES master station or a designated server, such as through heartbeat responses.

[0107] When both conditions are met—the source being an APN list and the connection successful—the APN parameter string and the matching index are saved. The index is used to quickly locate the corresponding record in the list for easy subsequent verification. To ensure data is not lost after power failure, non-volatile storage media can be used. Furthermore, to prevent frequent writes from degrading the storage media's lifespan, it can be written only once after a successful connection.

[0108] If the target APN parameter comes from the APN list and a network connection is successfully established based on the target APN parameter, the system timestamp at the time of saving can also be stored. The timestamp is used to determine whether the stored APN has expired. The corresponding SIM card or carrier identifier can also be saved to verify whether the currently inserted SIM card is consistent with the SIM card used when storing the APN.

[0109] In an optional embodiment, if the smart meter restarts, the saved target APN parameters are read to establish a network connection; if the network connection is successfully established using the saved target APN parameters, the current network is maintained; if the network connection fails to be established using the saved target APN parameters, the APN list is traversed and matched starting from the next position of the matching index.

[0110] By automatically identifying the SIM card operator's identifier and dynamically matching it with a pre-set APN list, the system achieves automated configuration and intelligent selection of APN parameters. When a match is successful, the system directly uses the corresponding APN parameters to establish a network connection. When a match fails, it falls back to the basic APN parameters to ensure the device has basic network connectivity. At the same time, by traversing multiple backup APN records of the same operator for adaptive retries, the system improves the connection success rate in complex network environments. In addition, by saving the APN parameters of successfully connected devices and their matching indexes, the system can quickly reuse historically valid configurations to directly establish a network connection after a device restart. Only when reuse fails will the system continue traversing and matching from the next position of the original index. This significantly shortens the connection establishment time while ensuring highly reliable access. Overall, the system achieves highly reliable, low-latency, and maintenance-free adaptive network access for IoT terminals such as smart meters in multi-operator network environments.

[0111] Upon the device's next startup or when a network connection needs to be rebuilt, the target APN parameter and its corresponding matching index are first read from non-volatile storage. If the read is successful and the data is valid (e.g., the index is within the APN list range and the APN string is not empty), the APN parameter is used to attempt to establish a network connection. If the connection succeeds, the network is maintained without performing a matching process. If the connection fails (e.g., the APN has expired), invalid information in the storage is cleared, and the APN list is traversed or the base APN parameter is used.

[0112] By prioritizing the use of saved target APN parameters for rapid reconnection after a smart meter restarts, the redundant process of re-traversing the APN list every time the device starts is avoided, significantly shortening network recovery time and improving online efficiency after restarts. Simultaneously, when a saved APN becomes invalid due to changes in the network environment, the system automatically continues sequential traversal from the next position in the original matching index, rather than searching from the beginning. This skips previously invalid or inapplicable records, further improving APN search efficiency and matching speed in abnormal scenarios, achieving a dual optimization of rapid recovery and intelligent fault tolerance.

[0113] In the technical solution of this embodiment, the APN parameter and its matching index are saved only when the target APN comes from the preset APN list and the network connection is successful. This achieves accurate caching and persistent recording of effective configurations. On the one hand, it avoids mistakenly saving the preset basic APN or invalid parameters as the preferred configuration, ensuring the accuracy and reliability of the saved data. On the other hand, in subsequent network connections, the saved successful parameters and indexes can be directly called to achieve fast matching and one-click reconnection, significantly shortening the reconnection time and improving the efficiency and intelligence level of smart meter communication recovery.

[0114] In one specific embodiment, refer to Figure 6The process begins with configuration initialization, which presets two types of parameters: preset single APN parameters and basic single APN. The preset APN LIST parameter contains a list of multiple carrier identifiers and their corresponding APNs. After initialization is complete, network connection initialization begins.

[0115] After initialization, the system first checks if a previously stored APN exists. If so, it attempts to establish a network directly using the stored APN parameters. If successful, the current single APN parameters are stored, the network connection is established, and the process ends. If the connection fails, the system proceeds to the next step: determining whether to store the traversal index. If not, it checks the validity of the APN list.

[0116] If no APN is stored, or if storing an APN fails, the process checks if the APN list is valid. If invalid, it calls the single APN parameter to attempt to establish a network. If valid, it initializes the APN list, iterates through index n=0, and begins comparison. It checks if an APN match is successful; if so, it calls the corresponding APN parameter to attempt to establish a network. If successful, it stores the APN parameter corresponding to the current entry and the traversal index n, and the network connection is established. If the connection fails, the current traversal index n=n+1, and then it checks if the traversal index satisfies n>m. If a match fails, the current traversal index n=n+1 again, and then it checks if the traversal is complete. If the traversal is not complete (n≤m), it returns to continue comparison and tries the next record. If the traversal is complete (n>m), it determines that the APN list match failed, and then calls the single APN parameter.

[0117] When the APN list is invalid or iteration through all entries fails, the process calls a single APN parameter to attempt to establish a network. If successful, the current single APN parameter is stored, and the network connection is established. If the connection fails, a retry is triggered, and the process reverts to network connection initialization to restart.

[0118] After a failed connection attempt using stored APN parameters, the system checks if the traversal index is stored. If so, the process may jump to a specific position in the APN LIST traversal. If not, it proceeds to the APN LIST validity check and starts traversing from the beginning.

[0119] Furthermore, during module configuration initialization, smart meter manufacturers collaborate to collect the SIM card operator identifiers and corresponding APNs used on-site, and compile an APN list. Smart meter manufacturers, during the production phase, or the local authority, during the pre-installation configuration phase, preset the basic single APN and preset APN list parameters.

[0120] The smart meter's remote communication module is powered on, and the APN LIST parameters are valid. After network connection initialization, the operator identifier of the current SIM card is queried via AT. A traversal comparison algorithm is used to perform dual-mode matching on the numerical concatenation format or string format of the APN LIST information.

[0121] If a match is successful, record the current APN LSIT matching index, and use the found operator identifier to correspond to the APN to attempt to establish a network connection; if the network connection is successfully established, store the APN that successfully established the network connection and record the current APN LSIT matching index, and maintain the current network; if the network establishment fails, increment the APN LSIT matching index by 1, and proceed to the next entry in the APN LIST for dual-mode comparison and matching.

[0122] If all entries in the APN LIST form fail to match, or some entries match successfully but network establishment fails, and all entries in the APN LIST form have been traversed, the system will jump to call the basic single APN parameter to attempt to establish a network connection.

[0123] When the smart meter's remote communication module is powered on, the APN LIST parameters are invalid. An attempt is made to establish a network connection using the basic single APN parameters. If the network connection is successfully established, the current network is maintained. If the network connection fails to establish, a retry mechanism is triggered, and the process reverts to network connection initialization.

[0124] The smart meter's remote communication module is reconfigured and restarted. The process checks if the last successfully established network connection APN is stored and queries the last APN LSIT matching index. If neither is stored, the process jumps to connection initialization. If a record is stored, the parameters of the last successfully established network connection are called to attempt to establish a network connection. If the network connection is established successfully, the current network is maintained. If the network connection fails to establish, and the last traversal index is stored, the traversal index is incremented by 1, and the process jumps directly to the APN LIST traversal and comparison stage for the next comparison and matching. If the network connection fails to establish, and the last traversal index is not stored, the process jumps directly to determining if the APN LIST is valid, and then proceeds with the basic single APN process.

[0125] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the APN dynamic selection method of this application. Any simple modifications based on this technical concept are within the protection scope of this application.

[0126] This application provides a smart meter, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, which are executed by the at least one processor to enable the at least one processor to perform the APN dynamic selection method in Embodiment 1 above.

[0127] The following is for reference. Figure 7 It shows a schematic diagram of a structure suitable for implementing the embodiments of this application of a smart meter. Figure 7 The smart meter shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments of this application.

[0128] like Figure 7 As shown, a smart meter may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.) that can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1003 into a random access memory (RAM) 1004. The RAM 1004 also stores various programs and data required for the operation of the smart meter. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touchscreen, touchpad, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a speaker, vibrator, etc.; storage device 1003; and communication device 1009. The communication device 1009 allows the smart meter to communicate wirelessly or wiredly with other devices to exchange data. Although the diagram shows smart meters with various systems, it should be understood that it is not required to implement or have all of the systems shown. More or fewer systems may be implemented alternatively.

[0129] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.

[0130] The smart meter provided in this application employs the APN dynamic selection method described in the above embodiments, which solves the technical problem of cumbersome manual configuration of APN parameters. Compared with the prior art, the beneficial effects of the smart meter provided in this application are the same as those of the APN dynamic selection method provided in the above embodiments, and other technical features of this smart meter are the same as those disclosed in the previous embodiment method, and will not be repeated here.

[0131] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0132] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0133] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.

Claims

1. A dynamic APN selection method, characterized in that, The APN dynamic selection method includes: Determine whether the preset APN list meets the preset valid state conditions, the valid state conditions including whether the APN list is not empty and whether the data record format of the APN list conforms to the preset rules; If the valid state conditions are not met, the preset basic APN parameters are invoked, and a network connection is established based on the basic APN parameters. If the valid state conditions are met, the operator identifier of the network registered by the SIM card currently inserted into the smart meter is obtained. The operator identifier is in a number concatenation format and / or a string format. The system performs a dual-mode match between the operator identifier corresponding to the SIM card and the operator identifiers of each record in a preset APN list. This dual-mode match supports both number concatenation and string formats. When the format of the operator identifier corresponding to the SIM card differs from the format of the operator identifiers recorded in the APN list, the operator identifiers are converted to the same format using a built-in operator mapping table before comparison. The system then performs a sequential comparison between the operator identifier corresponding to the SIM card and the operator identifiers of each record in the APN list. If a matching operator identifier is found, the match in the APN list is considered successful. If no matching operator identifier is found after comparing all records in the APN list, the match in the APN list is considered unsuccessful. The APN list contains at least one record, which includes the operator identifier and the corresponding APN parameters. If a match is found in the APN list, the matched APN parameter will be used as the target APN parameter. If no match is found in the APN list, the preset base APN parameter will be used as the target APN parameter. Network connection is established based on the target APN parameters; If establishing a network connection based on the target APN parameters fails, the system continues to traverse the records with the same operator identifier in the APN list, and retrieves the corresponding APN parameters in turn to retry establishing a network connection, until the network connection is successful or all records with the same operator identifier have been traversed.

2. The APN dynamic selection method as described in claim 1, characterized in that, The step of sequentially comparing the operator identifier corresponding to the SIM card with the operator identifiers of each record in the APN list includes: Get the current matching index; Based on the current matching index, the operator identifier corresponding to the SIM card is compared sequentially with the operator identifiers of each record in the APN list; Following the step of establishing a network connection based on the target APN parameters, the method further includes: If a network connection is successfully established based on the target APN parameters, the matching index of the target APN parameters in the APN list is saved.

3. The APN dynamic selection method as described in claim 2, characterized in that, After the step of sequentially comparing the operator identifier corresponding to the SIM card with the operator identifiers of each record in the APN list, the method further includes: If the operator identifier corresponding to the SIM card fails to match the operator identifier corresponding to the current matching index, or if the network connection based on the target APN parameter fails to be established, then the matching index is incremented by 1 to become the updated matching index. If the updated matching index is less than the total number of entries in the APN list, then return to the step of sequentially comparing the operator identifier corresponding to the SIM card with the operator identifier of each record in the APN list; If the updated matching index is equal to the total number of entries in the APN list, then it is determined that the match with the APN list has failed.

4. The APN dynamic selection method as described in claim 2, characterized in that, Following the step of establishing a network connection based on the target APN parameters, the method further includes: If the target APN parameter comes from the APN list and a network connection is successfully established based on the target APN parameter, then the target APN parameter and the corresponding matching index are saved.

5. The APN dynamic selection method as described in claim 4, characterized in that, After the step of saving the target APN parameters and the corresponding matching index, the method further includes: If the smart meter restarts, it reads the saved target APN parameters to establish a network connection. If a network connection is successfully established using the saved target APN parameters, the current network will be maintained. If establishing a network connection using the saved target APN parameters fails, the matching process will begin from the next position of the matching index in the APN list.

6. The APN dynamic selection method as described in claim 1, characterized in that, The step of determining whether the APN list meets the preset valid status conditions includes: Determine whether the APN list is empty and whether the data record format of the APN list conforms to preset rules; If the APN list is empty or the data record format does not conform to the preset rules, the APN list is determined to not meet the valid state conditions; if the APN list is not empty and the data record format conforms to the preset rules, the APN list is determined to meet the valid state conditions.

7. A smart meter, characterized in that, The smart meter includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the APN dynamic selection method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • APN parameter configuration method and device, mobile terminal and readable storage medium

    CN109890066A