You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
2.0 KiB

4 years ago
  1. class UPnPErrorCodeDescriptions(object):
  2. _descriptions = {
  3. 401: 'No action by that name at this service.',
  4. 402: ('Could be any of the following: not enough in args, args in the wrong order, one or m'
  5. 'ore in args are of the wrong data type.'),
  6. 403: '(Deprecated - no not use)',
  7. 501: 'MAY be returned if current state of service prevents invoking that action.',
  8. 600: 'The argument value is invalid',
  9. 601: ('An argument value is less than the minimum or more than the maximum value of the all'
  10. 'owed value range, or is not in the allowed value list.'),
  11. 602: 'The requested action is optional and is not implemented by the device.',
  12. 603: ('The device does not have sufficient memory available to complete the action. This MA'
  13. 'Y be a temporary condition; the control point MAY choose to retry the unmodified req'
  14. 'uest again later and it MAY succeed if memory is available.'),
  15. 604: ('The device has encountered an error condition which it cannot resolve itself and req'
  16. 'uired human intervention such as a reset or power cycle. See the device display or d'
  17. 'ocumentation for further guidance.'),
  18. 605: 'A string argument is too long for the device to handle properly.'
  19. }
  20. def __getitem__(self, key):
  21. if not isinstance(key, int):
  22. raise KeyError("'key' must be an integer")
  23. if 606 <= key <= 612:
  24. return 'These ErrorCodes are reserved for UPnP DeviceSecurity.'
  25. elif 613 <= key <= 699:
  26. return 'Common action errors. Defined by UPnP Forum Technical Committee.'
  27. elif 700 <= key <= 799:
  28. return 'Action-specific errors defined by UPnP Forum working committee.'
  29. elif 800 <= key <= 899:
  30. return 'Action-specific errors for non-standard actions. Defined by UPnP vendor.'
  31. return self._descriptions[key]
  32. ERR_CODE_DESCRIPTIONS = UPnPErrorCodeDescriptions()