-
Notifications
You must be signed in to change notification settings - Fork 314
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ppp pdp context number [backport release-5.2.0] (#4337)
* fix: Improved Modem PDP Context parsing (#4329) * fix: Improved Modem PDP Context parsing Signed-off-by: MMaiero <[email protected]> * fix: Copyright date Signed-off-by: MMaiero <[email protected]> Signed-off-by: MMaiero <[email protected]> * fix: merge problem Signed-off-by: MMaiero <[email protected]> * chore: copyright date update Signed-off-by: MMaiero <[email protected]> Signed-off-by: MMaiero <[email protected]>
- Loading branch information
Showing
9 changed files
with
70 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
.../org.eclipse.kura.net.admin/src/main/java/org/eclipse/kura/net/admin/util/PppPdpUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Eurotech and/or its affiliates and others | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Eurotech | ||
*******************************************************************************/ | ||
package org.eclipse.kura.net.admin.util; | ||
|
||
import static java.util.Objects.isNull; | ||
|
||
import org.apache.commons.lang3.math.NumberUtils; | ||
|
||
public class PppPdpUtil { | ||
|
||
private PppPdpUtil() { | ||
} | ||
|
||
public static int getPdpContextNumber(String dialString) { | ||
String pdpNum = "1"; | ||
if (!isNull(dialString) && !dialString.isEmpty() && dialString.toLowerCase().startsWith("atd*99***")) { | ||
pdpNum = dialString.substring("atd*99***".length(), dialString.length() - 1); | ||
} | ||
|
||
return NumberUtils.toInt(pdpNum, 1); | ||
} | ||
} |