PageRenderTime 39ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/src/java/org/smslib/USSDSessionStatus.java

http://smslib.googlecode.com/
Java | 81 lines | 32 code | 6 blank | 43 comment | 3 complexity | a218adf5681f0e76d6328bab06587cc4 MD5 | raw file
Possible License(s): Apache-2.0
  1. // SMSLib for Java v3
  2. // A Java API library for sending and receiving SMS via a GSM modem
  3. // or other supported gateways.
  4. // Web Site: http://www.smslib.org
  5. //
  6. // Copyright (C) 2002-2012, Thanasis Delenikas, Athens/GREECE.
  7. // SMSLib is distributed under the terms of the Apache License version 2.0
  8. //
  9. // Licensed under the Apache License, Version 2.0 (the "License");
  10. // you may not use this file except in compliance with the License.
  11. // You may obtain a copy of the License at
  12. //
  13. // http://www.apache.org/licenses/LICENSE-2.0
  14. //
  15. // Unless required by applicable law or agreed to in writing, software
  16. // distributed under the License is distributed on an "AS IS" BASIS,
  17. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18. // See the License for the specific language governing permissions and
  19. // limitations under the License.
  20. package org.smslib;
  21. /**
  22. * Enum representing the status of a GSM Unstructured Supplemental Service Data
  23. * (USSD) session.
  24. */
  25. public enum USSDSessionStatus
  26. {
  27. /**
  28. * No further user action required (network initiated USSD-Notify, or no
  29. * further information needed after mobile initiated operation)
  30. */
  31. NO_FURTHER_ACTION_REQUIRED(0),
  32. /**
  33. * Further user action required (network initiated USSD-Request, or further
  34. * information needed after mobile initiated operation
  35. */
  36. FURTHER_ACTION_REQUIRED(1),
  37. /**
  38. * USSD terminated by network
  39. */
  40. TERMINATED_BY_NETWORK(2),
  41. /**
  42. * Other local client has responded
  43. */
  44. OTHER_CLIENT_RESPONDED(3),
  45. /**
  46. * Operation not supported
  47. */
  48. OPERATION_NOT_SUPPORTED(4),
  49. /**
  50. * Network time out
  51. */
  52. NETWORK_TIMEOUT(5);
  53. private final int numeric;
  54. USSDSessionStatus(int aNumeric)
  55. {
  56. numeric = aNumeric;
  57. }
  58. public int getNumeric()
  59. {
  60. return numeric;
  61. }
  62. @Override
  63. public String toString()
  64. {
  65. return super.toString() + " (" + numeric + ")";
  66. }
  67. public static USSDSessionStatus getByNumeric(int aNumeric)
  68. {
  69. for (USSDSessionStatus status : USSDSessionStatus.values())
  70. {
  71. if (aNumeric == status.getNumeric()) return status;
  72. }
  73. return null;
  74. }
  75. }