Skip to content

Commit

Permalink
dbus command error checking
Browse files Browse the repository at this point in the history
  • Loading branch information
isra67 committed Feb 1, 2017
1 parent 0b86dab commit 8138bd6
Show file tree
Hide file tree
Showing 9 changed files with 182 additions and 154 deletions.
22 changes: 0 additions & 22 deletions evidenceup.sh

This file was deleted.

Binary file added hid
Binary file not shown.
15 changes: 15 additions & 0 deletions hid_init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
HID=./hid
OUTPUT_CONTROL=0x1019
EQ_GAIN_LOW=0x10D7
EQ_GAIN_HIGH=0x10D8
DSP_ENABLE_R1=0x117A
DSP_ENABLE_R2=0x117B
DSP_INIT_1=0x117C
DSP_INIT_2=0x117D

$HID w $OUTPUT_CONTROL 0x88
$HID w $EQ_GAIN_LOW 0xB2
$HID w $EQ_GAIN_HIGH 0x3F
$HID w $DSP_ENABLE_R1 0x05
$HID w $DSP_INIT_2 0x1

4 changes: 2 additions & 2 deletions indoor.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ sip_p4ssw0rd =
[devices]
sound_device_in =
sound_device_out =
volume = 40
volume = 60

[gui]
btn_call_hangup = HangUp Call
Expand Down Expand Up @@ -49,5 +49,5 @@ inet = dhcp
serial = 0000000066c8dcbe
app_name = Indoor 2.0
app_ver = 2.0.0.0
uptime = 21:17:15.730000
uptime = 0:55:29.490000

3 changes: 3 additions & 0 deletions my_lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@

# ### tools ###
from itools import *

# ### watches classes ###
from watches import *
21 changes: 2 additions & 19 deletions my_lib/itools.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def whoami():

def playWAV(dt):
"start play"
# global RING_WAV
send_command(RING_WAV)


Expand All @@ -83,25 +82,9 @@ def send_dbus(dst,args):
print whoami(), dst,args, ':', 'out:',proc
except subprocess.CalledProcessError as e:
print whoami(), dst,args, ':', 'ERR:',e.output
return False

# proc = subprocess.Popen([DBUSCONTROL_SCRIPT, dst] + args, stdout=subprocess.PIPE, shell=True)
# (out, err) = proc.communicate()
# print whoami(), dst,args, ':', 'out:',out, 'err:',err

return

errs = ''
outs = ''

try:
proc = subprocess.Popen([DBUSCONTROL_SCRIPT, dst] + args)
try:
outs, errs = proc.communicate(timeout=2)
except TimeoutExpired:
proc.kill()
print whoami(), 'timeout'
except:
pass
return True


# ##############################################################################
Expand Down
129 changes: 129 additions & 0 deletions my_lib/watches.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
#!/bin/python

# ###############################################################
#
# Imports
#
# ###############################################################

import kivy
kivy.require('1.9.0')

from kivy.clock import Clock
from kivy.graphics import Color, Line, Rectangle, Ellipse
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.label import Label
from kivy.uix.screenmanager import Screen
from kivy.uix.widget import Widget

from math import cos, sin, pi

import datetime



###############################################################
#
# Declarations
#
# ###############################################################

ACTIVE_DISPLAY_BACKGROUND = Color(.0,.0,.9)
INACTIVE_DISPLAY_BACKGROUND = Color(.0,.0,.0)


# ###############################################################
#
# Classes
#
# ###############################################################

class DigiClockWidget(FloatLayout):
"Clock class - digital"
pass


# ##############################################################################

class DigiClock(Label):
"Label with date & time"
def __init__(self, **kwargs):
super(DigiClock, self).__init__(**kwargs)
Clock.schedule_interval(self.update, 1)

def update(self, *args):
t = datetime.datetime.now()
self.text = t.strftime("%H:%M:%S")
# if int(t.strftime('%S')) % 2:
# self.text = t.strftime("%H:%M:%S")
# else:
# self.text = t.strftime("%H:%M.%S")


# ##############################################################################

class MyClockWidget(FloatLayout):
"Clock class - analog"
pass


# ##############################################################################

class SetScreen(Screen):
"Settings screen"
pass


# ##############################################################################

class Ticks(Widget):
"Analog watches"
# galleryIndex = 0
# gallery = []
# ln = Label()

def __init__(self, **kwargs):
super(Ticks, self).__init__(**kwargs)
self.bind(pos = self.update_clock)
self.bind(size = self.update_clock)

# self.ln.pos = self.pos
# self.ln.size = self.size
# self.ln.font_size = '32sp'
# self.ln.text_size = self.size
# self.ln.halign = 'right'
# self.ln.valign = 'bottom'
# self.ln.markup = True

Clock.schedule_interval(self.update_clock, 1)


def update_clock(self, *args):
time = datetime.datetime.now()
self.canvas.clear()

# self.remove_widget(self.ln)
# self.ln.pos = self.pos
# self.ln.size = self.size
## self.ln.text = '[color=0000f0] ' + APP_NAME + ' [/color]'
# self.ln.text_size = self.size
# self.add_widget(self.ln)

with self.canvas:
Color(.1, .1, .6, .15)
Ellipse(pos={self.y + 19,self.width / 4}, size={self.width / 2, self.height - 38})

Color(0.6, 0.6, 0.9)
Line(points = [self.center_x, self.center_y, self.center_x+0.7*self.r*sin(pi/30*time.second),
self.center_y+0.7*self.r*cos(pi/30*time.second)], width=1, cap="round")
Color(0.5, 0.5, 0.8)
Line(points = [self.center_x, self.center_y, self.center_x+0.6*self.r*sin(pi/30*time.minute),
self.center_y+0.6*self.r*cos(pi/30*time.minute)], width=2, cap="round")
Color(0.4, 0.4, 0.7)
th = time.hour*60 + time.minute
Line(points = [self.center_x, self.center_y, self.center_x+0.5*self.r*sin(pi/360*th),
self.center_y+0.5*self.r*cos(pi/360*th)], width=3, cap="round")


# ##############################################################################

Loading

0 comments on commit 8138bd6

Please sign in to comment.