Skip to content

Commit

Permalink
Merge pull request #221 from timvlaer/update_dialup_profile
Browse files Browse the repository at this point in the history
Update dialup profile
  • Loading branch information
Salamek authored Aug 19, 2024
2 parents 788471c + db4dfb2 commit 8c741f8
Showing 1 changed file with 38 additions and 3 deletions.
41 changes: 38 additions & 3 deletions huawei_lte_api/api/DialUp.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ def set_mobile_dataswitch(self, dataswitch: int = 0) -> SetResponseType:
'dataswitch': dataswitch
})

def set_default_profile(self, default: int = 0) -> SetResponseType:
def set_default_profile(self, index: int = 0) -> SetResponseType:
return self._session.post_set('dialup/profiles', {
'SetDefault': default,
'SetDefault': index,
'Delete': 0,
'Modify': 0
}, is_encrypted=True)
Expand All @@ -63,7 +63,7 @@ def create_profile(self,
is_default: bool = False
) -> SetResponseType:
return self._session.post_set('dialup/profiles', {
'SetDefault': 1 if is_default else 0,
'SetDefault': 1 if is_default else 0, # For E5576, the new profile will always become the default (See #221)
'Delete': 0,
'Modify': 1,
'Profile': {
Expand All @@ -86,6 +86,41 @@ def create_profile(self,
}
}, is_encrypted=True)

def update_profile(self,
index: int,
name: str,
username: Optional[str] = None,
password: Optional[str] = None,
apn: Optional[str] = None,
dialup_number: Optional[str] = None,
auth_mode: AuthModeEnum = AuthModeEnum.AUTO,
ip_type: IpType = IpType.IPV4_IPV6,
is_default: bool = False
) -> SetResponseType:
return self._session.post_set('dialup/profiles', {
'SetDefault': index if is_default else 0,
'Delete': 0,
'Modify': 2,
'Profile': {
'Index': index,
'IsValid': 1,
'Name': name,
'ApnIsStatic': 1 if apn else 0,
'ApnName': apn,
'DialupNum': dialup_number,
'Username': username,
'Password': password,
'AuthMode': auth_mode.value,
'IpIsStatic': '',
'IpAddress': '',
'DnsIsStatic': '',
'PrimaryDns': '',
'SecondaryDns': '',
'ReadOnly': '0',
'iptype': ip_type.value
}
}, is_encrypted=True)

def set_connection_settings(
self,
roam_auto_connect_enable: bool = True,
Expand Down

0 comments on commit 8c741f8

Please sign in to comment.