def __init__(self, name, callback_function, rgbmatrix, rgbm, queue):
		LEDMatrixBase.__init__(self, name=name, callback_function=callback_function, rgbmatrix=rgbmatrix)
		self.rgbm = rgbm
		self.queue = queue
		self.bufferdict = {} #dictionary that keeps each clients buffer when the received data becomes segmented
		self.cmdqueue = QueueList()
		self.queuethread = None
 def __init__(self, name, callback_function, rgbmatrix, rgbm, queue):
     LEDMatrixBase.__init__(self,
                            name=name,
                            callback_function=callback_function,
                            rgbmatrix=rgbmatrix)
     self.rgbm = rgbm
     self.queue = queue
     self.bufferdict = {
     }  #dictionary that keeps each clients buffer when the received data becomes segmented
     self.cmdqueue = QueueList()
     self.queuethread = None
	def run(self): #TODO: wrap most of this in a try with logging and maybe thread shutdown on exceptions
		self.queuethread = SocketCommandThread(self)
		#self.queuethread.daemon = True
		self.queuethread.start()
		self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
		#for tcp set option to reuse
		self.sock.bind(SOCKET_UDP_LISTEN_ADDR)
		logging.info('SocketServiceUDP listening on ' + str(SOCKET_UDP_LISTEN_ADDR))
		self.sock.setblocking(0)
		while not self.stop_event.is_set():
			ready = select.select([self.sock], [], [], 1)
			if ready[0]:
				data, addr = self.sock.recvfrom(1024*16)
				self.bufferhandler(data, addr)
				
		if self.queuethread != None and self.queuethread.isAlive():
			self.queuethread.stop_event.set()
		LEDMatrixBase.finalize(self)
    def run(
        self
    ):  #TODO: wrap most of this in a try with logging and maybe thread shutdown on exceptions
        self.queuethread = SocketCommandThread(self)
        #self.queuethread.daemon = True
        self.queuethread.start()
        self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        #for tcp set option to reuse
        self.sock.bind(SOCKET_UDP_LISTEN_ADDR)
        logging.info('SocketServiceUDP listening on ' +
                     str(SOCKET_UDP_LISTEN_ADDR))
        self.sock.setblocking(0)
        while not self.stop_event.is_set():
            ready = select.select([self.sock], [], [], 1)
            if ready[0]:
                data, addr = self.sock.recvfrom(1024 * 16)
                self.bufferhandler(data, addr)

        if self.queuethread != None and self.queuethread.isAlive():
            self.queuethread.stop_event.set()
        LEDMatrixBase.finalize(self)
Пример #5
0
    def __init__(self,
                 name,
                 callback_function,
                 rgbmatrix,
                 sharedqueue,
                 filepath,
                 beatEnabled=None,
                 singleLine=None,
                 colormap=None):
        LEDMatrixBase.__init__(self,
                               name=name,
                               callback_function=callback_function,
                               rgbmatrix=rgbmatrix)

        self.sharedqueue = sharedqueue
        self.filepath = filepath
        self.beatEnabled = beatEnabled == True  #coalesce None/False into False and keep True.. true
        self.singleLine = singleLine == True
        if colormap == None: self.colormap = CreateColormap()
        else: self.colormap = colormap
        self.paused = False
        self.freq_step = 156

        #this section initiates the beat thread if required
        self.lights = []
        self.beat = None
        self.beatInitialized = False
        if self.beatEnabled and self.beatInitialized == False:
            self.initBeat()

        #matrix, power, weighting vars.. these should be changeable on runtime to adjust the visualizer
        self.matrix = [
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0
        ]
        self.power = []
        self.weighting = [
            2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8,
            8, 8, 16, 16, 16, 16, 16, 16, 16, 16
        ]  # Change these according to taste
	def __init__(self, name, callback_function, rgbmatrix, g_rgbm, g_queue):
		LEDMatrixBase.__init__(self, name=name, callback_function=None, rgbmatrix=rgbmatrix)

		global WebServiceDefinitions
		WebServiceDefinitions = WebServiceDefinitionList()
		
		WebServiceDefinitions.append(WebServiceDefinition(
			'/state/', 'WebService_State_JSONP', '/state/', 'wsState'))
		
		#TODO: iterate over settings module list and load urls from each of those, then append them like this
		
		WebServiceDefinitions.append(WebServiceDefinition(
			'/audioPlay/(.*)', 'WebService_PlayWav_And_State_JSONP', '/audioPlay/', 'wsAudioPlay'))
		WebServiceDefinitions.append(WebServiceDefinition(
			'/audioStop/', 'WebService_AudioStop_And_State_JSONP', '/audioStop/', 'wsAudioStop'))
		WebServiceDefinitions.append(WebServiceDefinition(
			'/audioTest/', 'WebService_AudioTest_And_State_JSONP', '/audioTest/', 'wsAudioTest'))
		WebServiceDefinitions.append(WebServiceDefinition(
			'/audioToggleSingleLine/', 'WebService_AudioToggleSingleLine_And_State_JSONP', '/audioToggleSingleLine/', 'wsAudioToggleSL'))
		WebServiceDefinitions.append(WebServiceDefinition(
			'/audioToggleBeat/', 'WebService_AudioToggleBeat_And_State_JSONP', '/audioToggleBeat/', 'wsAudioToggleBeat'))
		WebServiceDefinitions.append(WebServiceDefinition(
			'/audioPause/', 'WebService_AudioPause_And_State_JSONP', '/audioPause/', 'wsAudioPause'))
		WebServiceDefinitions.append(WebServiceDefinition(
			'/audioResume/', 'WebService_AudioResume_And_State_JSONP', '/audioResume/', 'wsAudioResume'))
		WebServiceDefinitions.append(WebServiceDefinition(
			'/audioSetColormap/(.*)', 'WebService_AudioSetColormap_And_State_JSONP', '/audioSetColormap/', 'wsAudioSetColormap'))
		WebServiceDefinitions.append(WebServiceDefinition(
			'/audioSetMaxFreq/(.*)', 'WebService_AudioSetMaxFreq_And_State_JSONP', '/audioSetMaxFreq/', 'wsAudioSetMaxFreq'))
		
		WebServiceDefinitions.append(WebServiceDefinition(
			'/ImageSetBase64Data/(.*)', 'WebService_ImageSetBase64Data_And_State_JSONP', '/ImageSetBase64Data/', 'wsImageSetBase64Data'))

		global rgbm
		rgbm = g_rgbm
		
		global queue
		queue = g_queue
Пример #7
0
    def __init__(self, name, callback_function, rgbmatrix, sharedqueue, filepath, beatEnabled=None, singleLine=None, colormap=None):
        LEDMatrixBase.__init__(self, name=name, callback_function=callback_function, rgbmatrix=rgbmatrix)

        self.sharedqueue = sharedqueue
        self.filepath = filepath
        self.beatEnabled = beatEnabled == True #coalesce None/False into False and keep True.. true
        self.singleLine = singleLine == True
        if colormap == None: self.colormap = CreateColormap()
        else: self.colormap = colormap
        self.paused = False
        self.freq_step = 156

        #this section initiates the beat thread if required
        self.lights = []
        self.beat = None
        self.beatInitialized = False
        if self.beatEnabled and self.beatInitialized == False:
            self.initBeat()

        #matrix, power, weighting vars.. these should be changeable on runtime to adjust the visualizer
        self.matrix    = [0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0]
        self.power     = []
        self.weighting = [2,2,2,2,2,2,2,2, 4,4,4,4,4,4,4,4, 8,8,8,8,8,8,8,8, 16,16,16,16,16,16,16,16] # Change these according to taste
Пример #8
0
 def run(self):
     self.SetMatrixFromImgBase64()
     LEDMatrixBase.finalize(self)
Пример #9
0
 def __init__(self, name, callback_function, rgbmatrix, imagebase64):
     LEDMatrixBase.__init__(self, name=name, callback_function=callback_function, rgbmatrix=rgbmatrix)
     self.imagebase64 = imagebase64
Пример #10
0
    def __init__(self, name, callback_function, rgbmatrix, g_rgbm, g_queue):
        LEDMatrixBase.__init__(self,
                               name=name,
                               callback_function=None,
                               rgbmatrix=rgbmatrix)

        global WebServiceDefinitions
        WebServiceDefinitions = WebServiceDefinitionList()

        WebServiceDefinitions.append(
            WebServiceDefinition('/state/', 'WebService_State_JSONP',
                                 '/state/', 'wsState'))

        #TODO: iterate over settings module list and load urls from each of those, then append them like this

        WebServiceDefinitions.append(
            WebServiceDefinition('/audioPlay/(.*)',
                                 'WebService_PlayWav_And_State_JSONP',
                                 '/audioPlay/', 'wsAudioPlay'))
        WebServiceDefinitions.append(
            WebServiceDefinition('/audioStop/',
                                 'WebService_AudioStop_And_State_JSONP',
                                 '/audioStop/', 'wsAudioStop'))
        WebServiceDefinitions.append(
            WebServiceDefinition('/audioTest/',
                                 'WebService_AudioTest_And_State_JSONP',
                                 '/audioTest/', 'wsAudioTest'))
        WebServiceDefinitions.append(
            WebServiceDefinition(
                '/audioToggleSingleLine/',
                'WebService_AudioToggleSingleLine_And_State_JSONP',
                '/audioToggleSingleLine/', 'wsAudioToggleSL'))
        WebServiceDefinitions.append(
            WebServiceDefinition('/audioToggleBeat/',
                                 'WebService_AudioToggleBeat_And_State_JSONP',
                                 '/audioToggleBeat/', 'wsAudioToggleBeat'))
        WebServiceDefinitions.append(
            WebServiceDefinition('/audioPause/',
                                 'WebService_AudioPause_And_State_JSONP',
                                 '/audioPause/', 'wsAudioPause'))
        WebServiceDefinitions.append(
            WebServiceDefinition('/audioResume/',
                                 'WebService_AudioResume_And_State_JSONP',
                                 '/audioResume/', 'wsAudioResume'))
        WebServiceDefinitions.append(
            WebServiceDefinition(
                '/audioSetColormap/(.*)',
                'WebService_AudioSetColormap_And_State_JSONP',
                '/audioSetColormap/', 'wsAudioSetColormap'))
        WebServiceDefinitions.append(
            WebServiceDefinition('/audioSetMaxFreq/(.*)',
                                 'WebService_AudioSetMaxFreq_And_State_JSONP',
                                 '/audioSetMaxFreq/', 'wsAudioSetMaxFreq'))

        WebServiceDefinitions.append(
            WebServiceDefinition(
                '/ImageSetBase64Data/(.*)',
                'WebService_ImageSetBase64Data_And_State_JSONP',
                '/ImageSetBase64Data/', 'wsImageSetBase64Data'))

        global rgbm
        rgbm = g_rgbm

        global queue
        queue = g_queue