Exemple #1
0
	def setup_all( self ):
		
		tts.sayAsync("On board computer")
			
		# disable all subwindows
		for i in range(len(MODE)):		
			self.getControl(MODE[i]).setVisible(False)

		# activate default window			
		self.getControl(MODE[self.obcMode]).setVisible(True)
		self.setFocusId(MODE[self.obcMode])
		
		self.getControl(OBC_LIMIT_LOGO_ID).setVisible(False)
		
		# update all labels
		openbm.bcSetOnStateCallback(self.onOBCStateChange)
		openbm.bcReqOBCState()
		
		# first setup update methods for the OBC data
		for i in self.LabelList:
			openbm.bcSetOnValueCallback(i[1], i[2])
			openbm.bcReqOBCValue(i[1])
			xbmc.sleep(50)
		
		# set repeatable timer to update labels without any value
		self.updateTimer.start()
		
		pass
Exemple #2
0
    def setup_all(self):

        tts.sayAsync("On board computer")

        # disable all subwindows
        for i in range(len(MODE)):
            self.getControl(MODE[i]).setVisible(False)

        # activate default window
        self.getControl(MODE[self.obcMode]).setVisible(True)
        self.setFocusId(MODE[self.obcMode])

        self.getControl(OBC_LIMIT_LOGO_ID).setVisible(False)

        # update all labels
        openbm.bcSetOnStateCallback(self.onOBCStateChange)
        openbm.bcReqOBCState()

        # first setup update methods for the OBC data
        for i in self.LabelList:
            openbm.bcSetOnValueCallback(i[1], i[2])
            openbm.bcReqOBCValue(i[1])
            xbmc.sleep(50)

        # set repeatable timer to update labels without any value
        self.updateTimer.start()

        pass
Exemple #3
0
	def setData(self, value, push = False):
		if (push == False):
			return LBL_SET
			
		# what is the current value
		old = self.getControl(self.LabelList[value][0]).getLabel()
		
		# show dialog to set a value
		dialog = SetValueDialog("bc-setvalue.xml", os.getcwd())
		dialog.setLabel(self.getControl(self.LabelList[value][0]))
		dialog.setMaxLen(self.LabelList[value][4])
		dialog.doModal()
		
		# check if user liked to reset the value, then just restore old value
		if (dialog.canceled == True):
			self.getControl(self.LabelList[value][0]).setLabel(old)
		else:
			tts.sayAsync( ("%s set to %s")%(self.LabelList[value][6], self.getControl(self.LabelList[value][0]).getLabel()) )
			
			# set new value
			openbm.bcSetOBCValue(self.LabelList[value][1], int(self.getControl(self.LabelList[value][0]).getLabel()))
			self.getControl(self.LabelList[value][0]).setLabel("")
			
		
		# request of the value update
		openbm.bcReqOBCValue(self.LabelList[value][1])
			
		# release memory	
		del dialog
		
		pass
Exemple #4
0
    def setData(self, value, push=False):
        if (push == False):
            return LBL_SET

        # what is the current value
        old = self.getControl(self.LabelList[value][0]).getLabel()

        # show dialog to set a value
        dialog = SetValueDialog("bc-setvalue.xml", os.getcwd())
        dialog.setLabel(self.getControl(self.LabelList[value][0]))
        dialog.setMaxLen(self.LabelList[value][4])
        dialog.doModal()

        # check if user liked to reset the value, then just restore old value
        if (dialog.canceled == True):
            self.getControl(self.LabelList[value][0]).setLabel(old)
        else:
            tts.sayAsync(
                ("%s set to %s") %
                (self.LabelList[value][6],
                 self.getControl(self.LabelList[value][0]).getLabel()))

            # set new value
            openbm.bcSetOBCValue(
                self.LabelList[value][1],
                int(self.getControl(self.LabelList[value][0]).getLabel()))
            self.getControl(self.LabelList[value][0]).setLabel("")

        # request of the value update
        openbm.bcReqOBCValue(self.LabelList[value][1])

        # release memory
        del dialog

        pass
Exemple #5
0
	def resetData(self, value, push = False):
		if (push == False):
			return LBL_RESET
			
		tts.sayAsync(("%s reset")%self.LabelList[value][6])
		
		openbm.bcResetOBCValue(self.LabelList[value][1])
		pass
Exemple #6
0
    def resetData(self, value, push=False):
        if (push == False):
            return LBL_RESET

        tts.sayAsync(("%s reset") % self.LabelList[value][6])

        openbm.bcResetOBCValue(self.LabelList[value][1])
        pass
Exemple #7
0
def onMessage(src, dst, data):

	# CLOCK button up (so just short press) -> say current time:
	if (src == 0xF0 and dst == 0xFF and data[0] == 0x48 and data[1] == 0x87):
		tts.sayAsync(datetime.datetime.now().strftime("Current time is %H:%M, on %d %B"))

	#50 04 C8 3B A0 07
	if (src == 0x50 and dst == 0xC8 and data[0] == 0x3B and data[1] == 0xA0):
		tts.sayAsync(datetime.datetime.now().strftime("Current time is %H:%M, on %d %B"))
				
	# CLOCK button down (long down), activate OBC
	if (src == 0xF0 and dst == 0xFF and data[0] == 0x48 and data[1] == 0x47):
		onOBCState()
				
	pass
Exemple #8
0
def onMessage(src, dst, data):

    # CLOCK button up (so just short press) -> say current time:
    if (src == 0xF0 and dst == 0xFF and data[0] == 0x48 and data[1] == 0x87):
        tts.sayAsync(datetime.datetime.now().strftime(
            "Current time is %H:%M, on %d %B"))

    #50 04 C8 3B A0 07
    if (src == 0x50 and dst == 0xC8 and data[0] == 0x3B and data[1] == 0xA0):
        tts.sayAsync(datetime.datetime.now().strftime(
            "Current time is %H:%M, on %d %B"))

    # CLOCK button down (long down), activate OBC
    if (src == 0xF0 and dst == 0xFF and data[0] == 0x48 and data[1] == 0x47):
        onOBCState()

    pass
Exemple #9
0
	def activateData(self, value, push = False):
		if (push == False):
			if (self.LabelList[value][5] == True):
				return LBL_DEACTIVATE
			else:
				return LBL_ACTIVATE

		if (self.LabelList[value][5] == True):
			tts.sayAsync(("%s disabled")%self.LabelList[value][6])
		
			openbm.bcDisableOBCValue(self.LabelList[value][1])
			openbm.bcReqOBCState()		
		else:
			tts.sayAsync(("%s activated")%self.LabelList[value][6])
		
			openbm.bcEnableOBCValue(self.LabelList[value][1])
			openbm.bcReqOBCState()
		pass
Exemple #10
0
    def activateData(self, value, push=False):
        if (push == False):
            if (self.LabelList[value][5] == True):
                return LBL_DEACTIVATE
            else:
                return LBL_ACTIVATE

        if (self.LabelList[value][5] == True):
            tts.sayAsync(("%s disabled") % self.LabelList[value][6])

            openbm.bcDisableOBCValue(self.LabelList[value][1])
            openbm.bcReqOBCState()
        else:
            tts.sayAsync(("%s activated") % self.LabelList[value][6])

            openbm.bcEnableOBCValue(self.LabelList[value][1])
            openbm.bcReqOBCState()
        pass
Exemple #11
0
				#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'):
			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, '
			tts.sayAsync(greeting + now.strftime("Current time is %H:%M, on %d %B"))
			
		# update BC's time and date
		openbm.bcSetTimeFromSystem()
		openbm.bcSetDateFromSystem()
		openbm.bcSetOnIgnitionStateCallback(onIgnitionState)
		
		# update MID's text fields	
		openbm.midReqUpdateFields()
		openbm.bcReqIgnitionState()
		
		# prepare time speak
		nextHour = (datetime.datetime.now().hour + 1) % 24
		
		# start main loop
		#while (not xbmc.abortRequested and os.path.exists(_processPID)):
Exemple #12
0
            _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, '
                tts.sayAsync(greeting +
                             now.strftime("Current time is %H:%M, on %d %B"))

            xbmc.executebuiltin(
                "XBMC.Notification(%s,%s,2000,%s)" %
                ("Connected", "BMW I-Bus connected...", bmwLogoSmallImg))

        except openbm.error, e:
            dialog = xbmcgui.Dialog()
            dialog.ok("Connection to IBus failed!", str(e),
                      "Please restart the application and the I-Bus gateway!")
            raise

        # update BC's time and date
        openbm.bcSetTimeFromSystem()
        openbm.bcSetDateFromSystem()
        openbm.bcSetOnIgnitionStateCallback(onIgnitionState)