Coverage for aiocoap/numbers/types.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.5.4, created at 2024-07-10 11:47 +0000

1# SPDX-FileCopyrightText: Christian Amsüss and the aiocoap contributors 

2# 

3# SPDX-License-Identifier: MIT 

4 

5"""List of known values for the CoAP "Type" field. 

6 

7As this field is only 2 bits, its valid values are comprehensively enumerated 

8in the `Type` object. 

9""" 

10 

11from enum import IntEnum 

12 

13 

14class Type(IntEnum): 

15 CON = 0 # Confirmable 

16 NON = 1 # Non-confirmable 

17 ACK = 2 # Acknowledgement 

18 RST = 3 # Reset 

19 

20 def __str__(self): 

21 return self.name 

22 

23 

24CON, NON, ACK, RST = Type.CON, Type.NON, Type.ACK, Type.RST 

25 

26__all__ = ["Type", "CON", "NON", "ACK", "RST"]