Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

#!/usr/bin/env python 

# -*- coding: utf-8 -*- 

""" GSM immediate assignment packets. 

 

""" 

 

import sys 

import logging 

 

from antikythera.packets.packet import Packet 

 

__copyright__ = "Finding Ray" 

__license__ = "gpl3" 

 

_logger = logging.getLogger(__name__) 

 

class Assign(Packet): 

""" Immediate assignment packet attributes and factory. 

 

""" 

def __init__(self): 

super().__init__() 

self.packet_class = "Immediate Assignment" 

 

class Factory: 

""" Immediate assignment packet factory. 

 

""" 

@staticmethod 

def create(type, data): 

""" Create an immediate assignment packet of the given type. 

 

Args: 

type (str): the type of packet subclass to create. 

data: the data to construct the packet with. 

 

""" 

38 ↛ 40line 38 didn't jump to line 40, because the condition on line 38 was never false if type == "Immediate": return Immediate(data) 

else: 

_logger.critical("Bad packet creation of type: " + type) 

sys.exit(127) 

 

class Immediate(Assign): 

""" GSM Immediate Assignment Packet. 

 

Args: 

data: the data to construct the packet with. 

 

Attributes: 

time_slot: When to connect. 

page_mode: Extended Paging. 

 

""" 

def __init__(self, data): 

super().__init__() 

self.data = self.decode(data) 

self.time_slot = None 

self.page_mode = None 

def __str__(self): 

return "Immediate assignment packet" 

def decode(self, data): 

return data