コード例 #1
0
ファイル: logger.py プロジェクト: pixma/seriallogger
        def run(self):

                try:
			#print "now Trying code from here"
                	__IsArmProcessor__ = functions.isProcessorType()                        
			#print "    " + str( __IsArmProcessor__ )
                        # on the led state of Led 1
                	if (__IsArmProcessor__ != 0):
				import RPi.GPIO as GPIO_RPI                                
				#GPIO_RPI.setwarnings( Flase )
				GPIO_RPI.setmode( GPIO_RPI.BOARD )
                        	GPIO_RPI.setup(int(self.gpioNum), GPIO_RPI.OUT )
                        	GPIO_RPI.output(int(self.gpioNum), self.isState)
                                # isState is 1, true, High.change thsi data according to led config. high or low.
				# alwasy on till this thread is on
			else:
                		print "This is always on till port is open"
		except:
			print "Something goes wrong"
			print sys.exc_info()
コード例 #2
0
ファイル: logger.py プロジェクト: ngcoders/seriallogger
    def run(self):

        try:
            #print "now Trying code from here"
            __IsArmProcessor__ = functions.isProcessorType()
            #print "    " + str( __IsArmProcessor__ )
            # on the led state of Led 1
            if (int(__IsArmProcessor__) != 0):
                import RPi.GPIO as GPIO_RPI
                #GPIO_RPI.setwarnings( Flase )
                GPIO_RPI.setmode(GPIO_RPI.BOARD)
                GPIO_RPI.setwarnings(0)
                GPIO_RPI.setup(int(self.gpioNum), GPIO_RPI.OUT)
                GPIO_RPI.output(int(self.gpioNum), int(self.isState))
        # isState is 1, true, High.change thsi data according to led config. high or low.
                # alwasy on till this thread is on
            else:
                print "This is always on till port is open, Identified as this script is not running on Raspberry Pi."
        except:
            print "Something goes wrong"
            print sys.exc_info()
コード例 #3
0
ファイル: server.py プロジェクト: ngcoders/seriallogger
        def run(self):

                try:
                        __IsArmProcessor__ = functions.isProcessorType()                        
                        # on the led state of Led 1
                        if (__IsArmProcessor__ != 0):
                                
                                import RPi.GPIO as GPIO_RPI    
				GPIO_RPI.setwarnings( 0 )                            
				GPIO_RPI.setmode( GPIO_RPI.BOARD )
                                GPIO_RPI.setup(int(self._machineStateLED_onGpio), GPIO_RPI.OUT )
				#print self.isState, self._machineStateLED_onGpio
                                GPIO_RPI.output(int(self._machineStateLED_onGpio), int(self.isState))
                                # isState is 0, false, low.change this data according to led config. high or low.
                                
                              # alwasy on till this thread is on
                        else:
                                print "	     This is always on as the server is On."
				print "      Detected That this is not an arm machine"

                except:
                        print "Something goes wrong"
			print sys.exc_info()
コード例 #4
0
ファイル: server.py プロジェクト: pixma/seriallogger
    def run(self):

        try:
            __IsArmProcessor__ = functions.isProcessorType()
            # on the led state of Led 1
            if __IsArmProcessor__ != 0:

                import RPi.GPIO as GPIO_RPI

                GPIO_RPI.setwarnings(0)
                GPIO_RPI.setmode(GPIO_RPI.BOARD)
                GPIO_RPI.setup(self._machineStateLED_onGpio, GPIO_RPI.OUT)
                # print self.isState, self._machineStateLED_onGpio
                GPIO_RPI.output(self._machineStateLED_onGpio, self.isState)
                # isState is 1, true, High.change thsi data according to led config. high or low.

            # alwasy on till this thread is on
            else:
                print "This is always on as the server is On."

        except:
            print "Something goes wrong"
            print sys.exc_info()
コード例 #5
0
ファイル: logger.py プロジェクト: ngcoders/seriallogger
	## call logger thread for log and then download.
	
	nThLen = len(thread_list)	
	for i in range(nThLen):
		thread_list[i].setWriteFlag()
	

if __name__ == "__main__":
	# Main Runtime parse config and dump in file
	#print "this is Logger"
	signal.signal(signal.SIGINT, signal_handler)
	# user defined signal for triggering the specified procedure.
	signal.signal(signal.SIGUSR1, writeBeforeDownload_Handler)

	try:
		theProcessor = functions.isProcessorType()
		#print "     " + str( theProcessor )
		sleep( 5 )
		if( theProcessor == 1):
			import RPi.GPIO as gpio_s
			#print "Cleaning up board"		
			gpio_s.setmode( gpio_s.BOARD )
			gpio_s.setwarnings( 0 )
			gpio_s.cleanup()
			sleep( 5 )
	except:
		print sys.exc_info()
		time.sleep( 2 )
	try:
		config = ConfigParser.ConfigParser()
		config.read('settings.cfg')
コード例 #6
0
ファイル: logger.py プロジェクト: ngcoders/seriallogger
    ## call logger thread for log and then download.

    nThLen = len(thread_list)
    for i in range(nThLen):
        thread_list[i].setWriteFlag()


if __name__ == "__main__":
    # Main Runtime parse config and dump in file
    #print "this is Logger"
    signal.signal(signal.SIGINT, signal_handler)
    # user defined signal for triggering the specified procedure.
    signal.signal(signal.SIGUSR1, writeBeforeDownload_Handler)

    try:
        theProcessor = functions.isProcessorType()
        #print "     " + str( theProcessor )
        sleep(5)
        if (theProcessor == 1):
            import RPi.GPIO as gpio_s
            #print "Cleaning up board"
            gpio_s.setmode(gpio_s.BOARD)
            gpio_s.setwarnings(0)
            gpio_s.cleanup()
            sleep(5)
    except:
        print sys.exc_info()
        time.sleep(2)
    try:
        config = ConfigParser.ConfigParser()
        config.read('settings.cfg')
コード例 #7
0
ファイル: server.py プロジェクト: ngcoders/seriallogger
        def __init__(self , gpioNumber):
		threading.Thread.__init__(self)
                self.isProcessor = functions.isProcessorType()                
                #_mStateLed_onGpio =  gpioState
		self._mgpioPinNumber = gpioNumber
コード例 #8
0
ファイル: server.py プロジェクト: pixma/seriallogger
 def __init(self, gpioNumber, gpioState):
     self.isProcessor = functions.isProcessorType()
     _mStateLed_onGpio = gpioState
     _mgpioPinNumber = gpioNumber