Ejemplo n.º 1
0
    def setup_all(self):
        self.getControl(MAIN_LABEL).setLabel("Radio RDS")

        # try to connect to dbus, if fails, then error message
        try:

            openbm.setOnTitleChange(self.onTitleChange)
            openbm.setOnDisconnect(self.onStop)
            openbm.setOnButtonFieldChange(self.onButtonFieldChange)
            openbm.setOnRadioStateChange(self.onRadioState)
            openbm.setOnMessage(self.onIBusMessage)
            openbm.midEnableEmulation()
            openbm.start()
            openbm.midReqUpdateFields()

        except openbm.error, e:
            dialog = xbmcgui.Dialog()
            dialog.ok("connection to gateway failed", str(e))
            xbmc.output(str(e), xbmc.LOGDEBUG)
Ejemplo n.º 2
0
Archivo: gui.py Proyecto: Inz999/OpenBM
	def setup_all( self ):
		self.getControl( MAIN_LABEL ).setLabel( "Radio RDS")
		
		# try to connect to dbus, if fails, then error message
		try:	
			
			openbm.setOnTitleChange(self.onTitleChange)
			openbm.setOnDisconnect(self.onStop)
			openbm.setOnButtonFieldChange(self.onButtonFieldChange)
			openbm.setOnRadioStateChange(self.onRadioState)
			openbm.setOnMessage(self.onIBusMessage)
			openbm.midEnableEmulation()
			openbm.start()
			openbm.midReqUpdateFields()
			
		except openbm.error,e:
			dialog = xbmcgui.Dialog()
			dialog.ok("connection to gateway failed", str(e))	
			xbmc.output(str(e), xbmc.LOGDEBUG)
Ejemplo n.º 3
0
	# write file to lock execution (remove previous one)
	if os.path.exists(_processPID):
		os.remove(_processPID)        
	file( _processPID , "w" ).write( "" )

	try:
		openbm.setOnDisconnect(onDisconnect)
		openbm.midEnableEmulation()
		openbm.setOnRadioStateChange(onRadioState)
		openbm.setOnMessage(onMessage)
		_connectionLost = True
		
		# try to connect to IBus client, repeat the retries
		while (_connectionLost == True):
			try:	
				openbm.start()
				_connectionLost = False
						
				xbmc.executebuiltin("XBMC.Notification(%s,%s,2000,%s)"%("Connected", "BMW I-Bus connected...", bmwLogoSmallImg))		
			
			except openbm.error,e:
				xbmc.executebuiltin("XBMC.Notification(%s,%s,2000,%s)"%("Wait for I-BUS", "BMW I-Bus not found, connect...", bmwLogoSmallImg))		
				xbmc.sleep(2000)
				
				#dialog = xbmcgui.Dialog()
				#dialog.ok("Connection to IBus failed!", str(e), "Please restart the application and the I-Bus gateway!")	
				#raise
			
		# perform greetings and say current time
		#xbmc.executebuiltin("XBMC.Notification(%s,%s,2000,'')"%("Settings", __settings__.getSetting( "speech.greetings")))	
		if (__settings__.getSetting( "speech.greetings") == 'true'):
Ejemplo n.º 4
0
if (__name__ == "__main__"):

    # write file to lock execution (remove previous one)
    if os.path.exists(_processPID):
        os.remove(_processPID)
    file(_processPID, "w").write("")

    try:
        openbm.setOnDisconnect(onDisconnect)
        openbm.midEnableEmulation()
        openbm.setOnRadioStateChange(onRadioState)
        openbm.setOnMessage(onMessage)

        # try to connect to IBus client, repeat the retries
        try:
            openbm.start()
            _connectionLost = False

            # perform greetings and say current time
            #xbmc.executebuiltin("XBMC.Notification(%s,%s,2000,'')"%("Settings", __settings__.getSetting( "speech.greetings")))
            if (__settings__.getSetting("speech.greetings") == 'true'):
                now = datetime.datetime.now()
                greeting = ""
                if (now.hour < 4):
                    greeting = 'Good night, '
                elif (now.hour < 12):
                    greeting = 'Good morning, '
                elif (now.hour < 18):
                    greeting = 'Good afternoon, '
                else:
                    greeting = 'Good evening, '