diff --git a/location/agnss/bundle.json b/location/agnss/bundle.json index 0d4e45b894914e841acd5d82f53d9f4146879291..6969ee5c180c9e2a92db47e90fbba09bf7abcaa3 100644 --- a/location/agnss/bundle.json +++ b/location/agnss/bundle.json @@ -56,6 +56,30 @@ ], "header_base": "//drivers/interface/location/agnss" } + }, + { + "name": "//drivers/interface/location/agnss/v2_1:liblocation_agnss_proxy_2.1", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/location/agnss" + } + }, + { + "name": "//drivers/interface/location/agnss/v2_1:location_agnss_idl_headers", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/location/agnss" + } + }, + { + "name": "//drivers/interface/location/agnss/v2_1:liblocation_agnss_stub_2.1", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/location/agnss" + } } ] } diff --git a/location/agnss/v2_1/AGnssTypes.idl b/location/agnss/v2_1/AGnssTypes.idl new file mode 100644 index 0000000000000000000000000000000000000000..22f861c9a79f6dce12c526919c0e19a623d1b003 --- /dev/null +++ b/location/agnss/v2_1/AGnssTypes.idl @@ -0,0 +1,208 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * @addtogroup HdiAGnss + * @{ + * + * @brief Provides unified APIs for the AGNSS service. + * + * The upper layer can use the interfaces provided by this module to set the AGNSS callback, AGNSS server address, + * AGNSS reference information, and setId. + * + * @since 5.0 + */ + +/* + * @file AGnssTypes.idl + * + * @brief Defines the data structure used by the AGNSS module. + * + * @since 5.0 + * @version 2.0 + */ + +package ohos.hdi.location.agnss.v2_1; + +/* + * @brief Defines the AGNSS reference information type. + * + * @since 5.0 + */ +enum AGnssRefInfoType { + ANSS_REF_INFO_TYPE_CELLID = 1, + ANSS_REF_INFO_TYPE_MAC = 2, +}; + +/* + * @brief Defines the protocol type of the AGNSS user plane. + * + * @since 5.0 + */ +enum AGnssUserPlaneProtocol { + AGNSS_TYPE_SUPL = 1, + AGNSS_TYPE_C2K = 2, + AGNSS_TYPE_SUPL_IMS = 3, + AGNSS_TYPE_SUPL_EIMS = 4 +}; + +/* + * @brief Defines the action type for operating data services. + * + * @since 5.0 + */ +enum DataLinkSetUpType { + /* Request to establish a data connection. */ + ESTABLISH_DATA_CONNECTION = 1, + + /* Request to release a data connection. */ + RELEASE_DATA_CONNECTION = 2 +}; + +enum DataConnectionState { + DATA_CONNECTION_DISCONNECTED = 1, + DATA_CONNECTION_CONNECTED = 2, +}; + +/* + * @brief Defines the cell id type. + * + * @since 5.0 + */ +enum CellIdType { + CELLID_TYPE_GSM = 1, + CELLID_TYPE_UMTS = 2, + CELLID_TYPE_LTE = 3, + CELLID_TYPE_NR = 4, +}; + +/* + * @brief Defines the setid type. + * + * @since 5.0 + */ +enum SubscriberSetIdType { + AGNSS_SETID_TYPE_NULL = 0, + AGNSS_SETID_TYPE_IMSI = 1, + AGNSS_SETID_TYPE_MSISDN = 2, +}; + +/* + * @brief Defines the APN IP type. + * + * @since 5.0 + */ +enum ApnIpCategory { + APN_CATEGORY_INVALID = 0, + APN_CATEGORY_IPV4 = 1, + APN_CATEGORY_IPV6 = 2, + APN_CATEGORY_IPV4V6 = 3 +}; + +/* + * @brief Defines the cell information structure in the AGNSS reference information. + * + * @since 5.0 + */ +struct AGnssRefCellId { + enum CellIdType type; + + /* Mobile Country Code. */ + unsigned short mcc; + + /* Mobile Network Code. */ + unsigned short mnc; + + /* Location Area Code in 2G, 3G and LTE. */ + unsigned short lac; + + /* Cell id in 2G. Utran Cell id in 3G. Cell Global Id EUTRA in LTE. */ + unsigned int cid; + + /* Tracking Area Code in LTE. */ + unsigned short tac; + + /* Physical Cell id in LTE. */ + unsigned short pcid; + + /* NR Cell ID */ + unsigned int nci; +}; + +/* + * @brief Defines the AGNSS server information. + * + * @since 5.0 + */ +struct AGnssServerInfo { + enum AGnssUserPlaneProtocol type; + String server; + int port; +}; + +/* + * @brief Defines the AGNSS setid information. + * + * @since 5.0 + */ +struct SubscriberSetId { + enum SubscriberSetIdType type; + String id; +}; + +/* + * @brief Defines the AGNSS mac information. + * + * @since 5.0 + */ +struct AGnssRefMac { + unsigned char[] mac; +}; + +/* + * @brief Defines the AGNSS reference information structure. + * + * @since 5.0 + */ +struct AGnssRefInfo { + enum AGnssRefInfoType type; + struct AGnssRefCellId cellId; + struct AGnssRefMac mac; +}; + +/* + * @brief Defines the structure of the request for operating the data service. + * + * @since 5.0 + */ +struct AGnssDataLinkRequest { + enum AGnssUserPlaneProtocol agnssType; + enum DataLinkSetUpType setUpType; + unsigned char[] serverIpAddr; + unsigned char[] serverIpV6Addr; +}; + +/* + * @brief Defines the structure of Data service network state. + * + * @since 5.0 + */ +struct NetworkState { + int netId; + enum ApnIpCategory apnIpCategory; + String apn; + enum DataConnectionState state; +}; +/** @} */ \ No newline at end of file diff --git a/location/agnss/v2_1/BUILD.gn b/location/agnss/v2_1/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..f50732495525e45e45a04fb6734bb41b6ee0d9d1 --- /dev/null +++ b/location/agnss/v2_1/BUILD.gn @@ -0,0 +1,27 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//drivers/hdf_core/adapter/uhdf2/hdi.gni") +hdi("location_agnss") { + module_name = "location_agnss" + + sources = [ + "AGnssTypes.idl", + "IAGnssCallback.idl", + "IAGnssInterface.idl", + ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_location_agnss" +} diff --git a/location/agnss/v2_1/IAGnssCallback.idl b/location/agnss/v2_1/IAGnssCallback.idl new file mode 100644 index 0000000000000000000000000000000000000000..369d3290232e8a5f74dd897731a0ef2775211a07 --- /dev/null +++ b/location/agnss/v2_1/IAGnssCallback.idl @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * @addtogroup HdiAGnss + * @{ + * + * @brief Provides unified APIs for the AGNSS service. + * + * The upper layer can use the interfaces provided by this module to set the AGNSS callback, AGNSS server address, + * AGNSS reference information, and setId. + * + * @since 5.0 + */ + +/* + * @file IAGnssCallback.idl + * + * @brief Defines the agnss callback to request the upper layer to establish or release data services, + * request the upper layer to deliver setId, and request the upper layer to deliver the agnss reference information. + * + * @since 5.0 + * @version 2.1 + */ + +package ohos.hdi.location.agnss.v2_1; + +import ohos.hdi.location.agnss.v2_1.AGnssTypes; + +/* + * @brief Defines the agnss callback to request the upper layer to establish or release data services, + * request the upper layer to deliver setId, and request the upper layer to deliver the agnss reference information. + * + * @since 5.0 + */ +[callback] interface IAGnssCallback { + /* + * @brief Request the upper layer to establish or release data services. + * + * @param request Indicates the request information for operating the data service. + * For details, see {@link AGnssDataLinkRequest}. + * @return Returns 0 if send request successed; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + RequestSetUpAgnssDataLink([in] struct AGnssDataLinkRequest request); + + /* + * @brief Request the upper layer to deliver the subscriber identity. + * + * @param type Indicates the type of setId. For details, see {@link SubscriberSetIdType}. + * @return Returns 0 if send request successed; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + RequestSubscriberSetId([in] enum SubscriberSetIdType type); + + /* + * @brief Request upper-layer ingest reference information. + * + * @param type Indicates the type of reference information. For details, see {@link AGnssRefInfoType}. + * @return Returns 0 if send request successed; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + RequestAgnssRefInfo([in] enum AGnssRefInfoType type); + + /* + * @brief Request the upper layer to perform DNS query. + * + * @param fqdn Indicates the domain name for DNS query. + * @return Returns 0 if send request successed; returns a negative value otherwise. + * + * @since 6.0 + * @version 1.0 + */ + RequestSuplDns([in] String fqdn); +} +/** @} */ \ No newline at end of file diff --git a/location/agnss/v2_1/IAGnssInterface.idl b/location/agnss/v2_1/IAGnssInterface.idl new file mode 100644 index 0000000000000000000000000000000000000000..d0fc170a761f03b1490c95ebb5b115c3d0481e2a --- /dev/null +++ b/location/agnss/v2_1/IAGnssInterface.idl @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * @addtogroup HdiAGnss + * @{ + * + * @brief Provides unified APIs for the AGNSS service. + * + * The upper layer can use the interfaces provided by this module to set the AGNSS callback, AGNSS server address, + * AGNSS reference information, and setId. + * + * @since 5.0 + */ + +/* + * @file IAGnssInterface.idl + * + * @brief Defines the agnss interfaces to set the AGNSS callback, AGNSS server address, AGNSS reference information, + * and setId. + * + * @since 5.0 + * @version 2.1 + */ + +package ohos.hdi.location.agnss.v2_1; + +import ohos.hdi.location.agnss.v2_1.IAGnssCallback; +import ohos.hdi.location.agnss.v2_1.AGnssTypes; + +/* + * @brief Defines the agnss interfaces to set the AGNSS callback, AGNSS server address, AGNSS reference information, + * and setId. + * + * @since 5.0 + */ +interface IAGnssInterface { + /* + * @brief Set the agnss callback function. + * + * @param callback Indicates the agnss callback to request the upper layer to establish or release data services, + * request the upper layer to deliver setId, and request the upper layer to deliver the agnss reference information. + * For details, see {@link IAGnssCallback}. + * @return Returns 0 if setup callback successed; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + SetAgnssCallback([in] IAGnssCallback callbackObj); + + /* + * @brief Set the Agnss Server Information. + * + * @param server Indicates the AGNSS server information. + * For details, see {@link AGnssServerInfo}. + * @return Returns 0 if setup callback successed; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + SetAgnssServer([in] struct AGnssServerInfo server); + + /* + * @brief Ingesting Reference Information. + * + * @param refInfo Indicates the AGNSS reference information structure. + * For details, see {@link AGnssRefInfo}. + * @return Returns 0 if setup callback successed; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + SetAgnssRefInfo([in] struct AGnssRefInfo refInfo); + + /* + * @brief Set Subscriber Identity. + * + * @param id Indicates the AGNSS setid information. + * For details, see {@link SubscriberSetId}. + * @return Returns 0 if setup callback successed; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + SetSubscriberSetId([in] struct SubscriberSetId id); + + /* + * @brief Send network state to AGNSS module. + * + * @param state Indicates the network state. For details, see {@link NetworkState}. + * @return Returns 0 if send successed; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + SendNetworkState([in] struct NetworkState state); + + /* + * @brief Send ipAddr to AGNSS module. + * + * @param ipAddr Indicates the ip address. + * @return Returns 0 if send successed; returns a negative value otherwise. + * + * @since 6.0 + * @version 1.0 + */ + SetSuplDnsResult([in] String ipAddr); +} +/** @} */ \ No newline at end of file