def __init__(self, deviceName, ipAddress): ''' Constructor ''' SCCPMessage.__init__(self, SCCPMessageType.RegisterMessage) self.deviceName = deviceName self.ipAddress = IpAddress(ipAddress) self.stationUserId = self.STATION_USERID self.stationInstance = self.STATION_INSTANCE self.deviceType = self.TelecasterBus self.maxStreams = self.MAXSTREAMS
def __init__(self, deviceName, ipAddress): """ Constructor """ SCCPMessage.__init__(self, SCCPMessageType.RegisterMessage) self.deviceName = deviceName self.ipAddress = IpAddress(ipAddress) self.stationUserId = self.STATION_USERID self.stationInstance = self.STATION_INSTANCE self.deviceType = self.TelecasterBus self.maxStreams = self.MAXSTREAMS
class SCCPOpenReceiveChannelAck(SCCPMessage): def __init__(self, channelStatus, ipAddress, portNumber, passThruPartyId): SCCPMessage.__init__(self, SCCPMessageType.OpenReceiveChannelAck) self.channelStatus = channelStatus self.ipAddress = IpAddress(ipAddress) self.portNumber = portNumber self.passThruPartyId = passThruPartyId def pack(self): strPack = SCCPMessage.pack(self) strPack = strPack + pack("I",self.channelStatus) strPack = strPack + self.ipAddress.pack() strPack = strPack + pack("I",self.portNumber) strPack = strPack + pack("I",self.passThruPartyId) return strPack
class SCCPRegister(SCCPMessage): ''' sccp register message ''' TelecasterBus = 0x08 MAXSTREAMS = 0 STATION_INSTANCE = 1 STATION_USERID = 0 def __init__(self, deviceName, ipAddress): ''' Constructor ''' SCCPMessage.__init__(self, SCCPMessageType.RegisterMessage) self.deviceName = deviceName self.ipAddress = IpAddress(ipAddress) self.stationUserId = self.STATION_USERID self.stationInstance = self.STATION_INSTANCE self.deviceType = self.TelecasterBus self.maxStreams = self.MAXSTREAMS def __eq__(self, obj): if (self.deviceName != obj.deviceName): return False if (self.ipAddress != obj.ipAddress): return False return True def pack(self): strPack = SCCPMessage.pack(self) + self.deviceName + "\x00" strPack = strPack + pack("II", self.stationUserId, self.stationInstance) strPack = strPack + self.ipAddress.pack() strPack = strPack + pack("III", self.deviceType, self.maxStreams, 0) strPack = strPack + '\x0B' + '\x00' + '\x60' + '\x85' strPack = strPack + pack('IIII', 0, 0, 0, 0) return strPack
class SCCPRegister(SCCPMessage): """ sccp register message """ TelecasterBus = 0x08 MAXSTREAMS = 0 STATION_INSTANCE = 1 STATION_USERID = 0 def __init__(self, deviceName, ipAddress): """ Constructor """ SCCPMessage.__init__(self, SCCPMessageType.RegisterMessage) self.deviceName = deviceName self.ipAddress = IpAddress(ipAddress) self.stationUserId = self.STATION_USERID self.stationInstance = self.STATION_INSTANCE self.deviceType = self.TelecasterBus self.maxStreams = self.MAXSTREAMS def __eq__(self, obj): if self.deviceName != obj.deviceName: return False if self.ipAddress != obj.ipAddress: return False return True def pack(self): strPack = SCCPMessage.pack(self) + self.deviceName + "\x00" strPack = strPack + pack("II", self.stationUserId, self.stationInstance) strPack = strPack + self.ipAddress.pack() strPack = strPack + pack("III", self.deviceType, self.maxStreams, 0) strPack = strPack + "\x0B" + "\x00" + "\x60" + "\x85" strPack = strPack + pack("IIII", 0, 0, 0, 0) return strPack
def __init__(self, channelStatus, ipAddress, portNumber, passThruPartyId): SCCPMessage.__init__(self, SCCPMessageType.OpenReceiveChannelAck) self.channelStatus = channelStatus self.ipAddress = IpAddress(ipAddress) self.portNumber = portNumber self.passThruPartyId = passThruPartyId
def testPack(self): address = IpAddress("192.168.1.12") self.assertEquals("\xC0\xA8\x01\x0C",address.pack())