| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- /***********************************//**
- * @file hw_device_mnt.h
- * @author Gifur
- * @email guifaliao@gmail.com
- * @version 1.1.0.0
- * @date 2020-07-23
- * @copyright China Merchants Bank Co.,Ltd All rights reserved
- *
- * @brief
- * @details
- **************************************/
- #pragma once
- #include <cstdio>
- #include <string>
- #include <vector>
- #ifdef HWMOBILEDLL_EXPORTS
- #define HWMOBILE_API _declspec(dllexport)
- #else
- #define HWMOBILE_API _declspec(dllimport)
- #pragma comment(lib, "HWMobileDll.lib")
- #endif
- namespace hw
- {
- enum auth_mode_em
- {
- auth_auto = 0,
- auth_pap,
- auth_chap,
- auth_none
- };
- enum ip_type_em
- {
- //0:ipv4; 1:ipv6; 2:ipv4&v6
- ipv4 = 0,
- ipv6,
- ipv46
- };
- enum connect_status_em
- {
- invalid = 0,
- connecting,
- connected,
- disconnected,
- disconnecting,
- connect_failed,
- connect_failed_with_poor,
- other,
- no_service,
- connect_dial_up_param_failed
- };
- enum sim_status_em
- {
- invalid_sim,
- valid_sim,
- sim_not_found
- };
- #define MBB_STR_BUF_LEN 256
- struct apn_config_t
- {
- wchar_t profile_name[MBB_STR_BUF_LEN];
- wchar_t apn_name[MBB_STR_BUF_LEN];
- wchar_t username[MBB_STR_BUF_LEN];
- wchar_t password[MBB_STR_BUF_LEN];
- auth_mode_em auth_mode;
- ip_type_em ip_type;
- };
- struct wlan_config_t
- {
- wchar_t ssid[MBB_STR_BUF_LEN];
- wchar_t password[MBB_STR_BUF_LEN];
- bool hidden;
- };
- struct connect_profile_t
- {
- uint32_t index;
- apn_config_t apn_config;
- bool is_default;
- };
- struct wlan_status_t
- {
- bool started;
- wlan_config_t wlan_config;
- };
- struct network_info_t
- {
- connect_status_em connect_status;
- uint8_t signal_strength;
- uint8_t network_type;
- uint8_t battery_percent;
- bool roaming;
- bool sim_locked;
- sim_status_em sim_status;
- bool wifi_status;
- int32_t wifi_current_user_count;
- bool usb_plug_in_status;
- wchar_t dev_name[MBB_STR_BUF_LEN];
- };
- struct dev_info_t
- {
- wchar_t dev_name[MBB_STR_BUF_LEN];
- wchar_t provider_name[MBB_STR_BUF_LEN];
- wchar_t sn[MBB_STR_BUF_LEN];
- wchar_t work_mode[MBB_STR_BUF_LEN];
- wchar_t hardware_version[MBB_STR_BUF_LEN];
- wchar_t iccid[MBB_STR_BUF_LEN];
- wchar_t imsi[MBB_STR_BUF_LEN];
- wchar_t extend_msg[MBB_STR_BUF_LEN];
- network_info_t network_status;
- };
- struct mac_filter_t
- {
- int mac_filter_mode;
- wchar_t mac_filter[MBB_STR_BUF_LEN];
- };
- #define CURRENT_NETWORK_NO_SERVICE 0
- #define SERVICE_DOMAIN_NO_SERVICE 0
- #define SERVICE_STATUS_AVAILABLE 2
- class HWMOBILE_API hw_device_mnt
- {
- public:
- hw_device_mnt();
- ~hw_device_mnt();
- /*检测MIFI设备是否存在*/
- bool detect_devices();
- /*登录到MIFI设备*/
- int login(std::wstring const& username, std::wstring const& password);
- /*更改MIFI的登录密码*/
- int change_password(std::wstring const& username, std::wstring const& current_password, std::wstring const& new_password);
- /*获取APN配置文件列表*/
- int get_connect_profiles(std::vector<connect_profile_t>& profiles);
- /*获取APN配置文件列表*/
- int get_profiles(connect_profile_t* profile, const int profile_capacity);
- /*设置当前的APN配置文件*/
- int set_default_profile_by(const uint32_t profile_idx);
- /*添加APN配置文件,set_as_default 指定是否将新添加的配置文件设备默认的*/
- int add_profile(const apn_config_t& config, bool set_as_default);
- /*更新APN配置文件*/
- int update_profile(const connect_profile_t& profile);
- /*根据APN配置文件的序号,删除指定的配置文件*/
- int delete_profile_by(const uint32_t profile_idx);
- /*根据APN配置文件的名称,删除指定的配置文件*/
- int delete_profile(std::wstring profile_name);
- /*切换是否自动连接(拨号)*/
- int switch_auto_dial(bool enable = true);
- /*断开网络拨号连接*/
- int disconnect();
- /*拨号连接*/
- int connect();
- /*判断用户是否已经登录*/
- bool has_login(bool& first_login);
- /*注销*/
- int logout();
- /*设置WIFI的SSID,密码等相关信息*/
- int set_wlan_config(const wlan_config_t& config, bool restart);
- /*获取WIFI的SSID,密码等相关信息*/
- int get_wlan_config(wlan_config_t& config);
- /*查询WIFI状态是否打开*/
- bool is_wlan_open();
- /*获取SIM卡和设备的一些信息*/
- int get_dev_info(dev_info_t& info);
- /*获取网络的一些信息*/
- int get_network_info(network_info_t& info);
- /*激活并将新条目加入白名单*/
- int insert_mac_filter(const mac_filter_t& info);
- private:
- int connect_pending(bool to_connect);
- };
- }
|