Example #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)
Example #2
0
File: gui.py Project: 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)
Example #3
0
	
	
#---------------------------------------------------------------------
# Main Function - run a daemon checking for actions on ibus
#         it will execute corresponding scripts based on ibus messages
#---------------------------------------------------------------------
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)
		_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)
Example #4
0

#---------------------------------------------------------------------
# Main Function - run a daemon checking for actions on ibus
#         it will execute corresponding scripts based on ibus messages
#---------------------------------------------------------------------
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, '