Data couldn't be retrieved from Watch

Bug #839082 reported by Stefan Willems
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
PySleep
Fix Committed
High
Christian Hintze

Bug Description

Traceback (most recent call last):
  File "src/st_web.py", line 123, in <module>
    data = watch.getData()
  File "/home/stefan/PySleep-basic/src/format_data.py", line 143, in getData
    std.fill(dat)
  File "/home/stefan/PySleep-basic/src/format_data.py", line 85, in fill
    self.awakemoments[1].append(ord(dat[it.next()]))
StopIteration

Changed in pysleep:
assignee: nobody → hintze (hintze)
Revision history for this message
Christian Hintze (hintze) wrote :

hi, thank you for your bug report. we are sorry that we are kind of inactive for quiet a long time now, but maybe ill have time to do some programming next month. would be great.
as long as i have other dutys, could you kindly provide the version of the watch you are using? did you try it several times to read the data from the watch?
we are far away from some kind of official release and im sorry that such basic things do not work reliably yet.

Revision history for this message
Christian Hintze (hintze) wrote :

oh and i forgot, im interested in how you got to our little project? =)

Revision history for this message
Stefan Willems (st-willems) wrote : Re: [Bug 839082] Re: Data couldn't be retrieved from Watch

Hi.

Yes, I tried it several times, version is V1. I bought the clock some
years ago, I guess about 3, so I have no further info about the
version.

I'm a programmer by myself, so if I can get some of the specs about
what you are doing (mainly about comunication with the watch) I can
try to fix the bug.

Nice sideeffect would be learning Phyton (a bit).

Kindly regards,
Stefan

2011/9/1 hintze <email address hidden>:
> hi, thank you for your bug report. we are sorry that we are kind of inactive for quiet a long time now, but maybe ill have time to do some programming next month. would be great.
> as long as i have other dutys, could you kindly provide the version of the watch you are using? did you try it several times to read the data from the watch?
> we are far away from some kind of official release and im sorry that such basic things do not work reliably yet.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/839082
>
> Title:
>  Data couldn't be retrieved from Watch
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/pysleep/+bug/839082/+subscriptions
>

Revision history for this message
Christian Hintze (hintze) wrote :

ok. thank you very much for your offer :) i would appreciate if you could provide some debugging. ok ill try to explain the communication in some short sentences.

first of all, the watches communicate with your PC by an USB-serial-adapter, which is located inside the clamb you use to attach your watch. with some really basic communication, one can retrieve data from the watch in simple ASCII-characters, which can be 'translated' into an integer[1].
to trigger the data transfer, one has to write a 'V' onto a watch of V1 or '\xC0\x04\x00\xC0' (in HEX) onto a watch of V2. (this happens in communication.py). the string which is returned by the watch has a specific length depending of how many awakemoments one have had.
this is also the cause of your bug. the length of the string has not been determined correctly, so there is a loop running behind the length of the string.

<<self.awakemoments[1].append(ord(dat[it.next()]))
StopIteration>>

'it' is an iterator which is iterated by 'it.next'. dat is the string containing the data. ord converts the ASCII to an integer. 'self' is the object, containing the data. the attribute 'awakemoments' is an 2D-array. the first index are the hours, the second one the minutes, which are referenced by 'awakemoments[0][X]' and 'awakemoments[1][X]' respectively. X starts with length zero, the function 'append' does what it says :D it appends the next hour / minute.

to begin to resolve this bug, im interested in what your terminal says. it has to respond with 'Watch uses protocol V1'. if it does not, the string is not filled anyway and cannot be used furtheron, which could cause such an error.
we are not that much into exception handling, this is something one has to do in the future, maybe by implementing some kind of easy check. dunno right now.

feel free to make some proposals. if you want to read the sourcecode and get stuck at some point, i would pe pleased to help you.

best regards,
christian.

[1]: http://docs.python.org/library/functions.html#ord

Revision history for this message
Stefan Willems (st-willems) wrote :
Download full text (3.3 KiB)

Hi,

today I was able to debug a little:

Script says this:

Lade Daten von der Uhr herunter...
Uhr benutzt Protokoll V1
V1
0
23
1
32
1
41
2
13
2
21
2
58
3
10
3
20
3
40
4
4
4
17
4
36
4
48
5
25
5
47
6
16
6

After putting it in a readable format:

Lade Daten von der Uhr herunter...
Uhr benutzt Protokoll V1
V1
0:23
1:32
1:41
2:13
2:21
2:58
3:10
3:20
3:40
4:4
4:17
4:36
4:48
5:25
5:47
6:16
6

...and fillig it up with data directly from the watch:

Lade Daten von der Uhr herunter...
Uhr benutzt Protokoll V1
V1
0:23
1:32
1:41
2:13
2:21
2:58
3:10
3:20
3:40
4:4
4:17
4:36
4:48
5:25
5:47
6:16
6

6:33
6:45
7:13
7:32
8:01

Data A 22:55

After modifying communication.py:
    print "Read 64"
    ser.write('V')
    data = ser.read(64)
    for i in range(len(data)):
        print ord(data[i])
        dat.append(data[i])

Lade Daten von der Uhr herunter...
Read 64
86
9
4
0
20
0
0
8
30
21
0
23
49
1
32
52
1
41
37
2
13
16
2
21
25
2
58
1
3
10
16
3
20
37
3
40
25
4
4
55
4
17
52
4
36
4
4
48
46
5
25
16
5
47
43
6
16
46
6
33
34
6
45
40
Uhr benutzt Protokoll V1
V1
0
23
52
1
13
16
2
58
16
3
40
25
4
17
4
4
25
16
6
16

Übertrage Daten zum Browser...

Hmm...

greetings,
Stefan

PS: Is german your native language? If, we can talk in german, that's
easier.

Am Freitag, den 02.09.2011, 07:41 +0000 schrieb hintze:
> ok. thank you very much for your offer :) i would appreciate if you
> could provide some debugging. ok ill try to explain the communication in
> some short sentences.
>
> first of all, the watches communicate with your PC by an USB-serial-adapter, which is located inside the clamb you use to attach your watch. with some really basic communication, one can retrieve data from the watch in simple ASCII-characters, which can be 'translated' into an integer[1].
> to trigger the data transfer, one has to write a 'V' onto a watch of V1 or '\xC0\x04\x00\xC0' (in HEX) onto a watch of V2. (this happens in communication.py). the string which is returned by the watch has a specific length depending of how many awakemoments one have had.
> this is also the cause of your bug. the length of the string has not been determined correctly, so there is a loop running behind the length of the string.
>
> <<self.awakemoments[1].append(ord(dat[it.next()]))
> StopIteration>>
>
> 'it' is an iterator which is iterated by 'it.next'. dat is the string
> containing the data. ord converts the ASCII to an integer. 'self' is the
> object, containing the data. the attribute 'awakemoments' is an 2D-
> array. the first index are the hours, the second one the minutes, which
> are referenced by 'awakemoments[0][X]' and 'awakemoments[1][X]'
> respectively. X starts with length zero, the function 'append' does what
> it says :D it appends the next hour / minute.
>
> to begin to resolve this bug, im interested in what your terminal says. it has to respond with 'Watch uses protocol V1'. if it does not, the string is not filled anyway and cannot be used furtheron, which could cause such an error.
> we are not that much into exception handling, this is something one has to do in the future, maybe by implementing some kind of easy check. dunno right now.
>
> feel free to make some proposals. if you want...

Read more...

Revision history for this message
Christian Hintze (hintze) wrote :
Download full text (5.1 KiB)

hi, yeah actually were germans and we can communicate in our language
therefor. but i would prefer to make the public communication in this
place international.

so what i see so far, the problem is located in the line

"data = ser.read(64)"

could you try to change 64 to, say 128? you had too much data points,
they couldnt fit into 64 characters. i thought we did change that
allready. but im a little bit confused :D if you do have that much
data now, than you can try if it works. but im sure that this is the
cause of the bug here.

2011/9/4 Stefan Willems <email address hidden>:
> Hi,
>
> today I was able to debug a little:
>
> Script says this:
>
> Lade Daten von der Uhr herunter...
> Uhr benutzt Protokoll V1
> V1
> 0
> 23
> 1
> 32
> 1
> 41
> 2
> 13
> 2
> 21
> 2
> 58
> 3
> 10
> 3
> 20
> 3
> 40
> 4
> 4
> 4
> 17
> 4
> 36
> 4
> 48
> 5
> 25
> 5
> 47
> 6
> 16
> 6
>
> After putting it in a readable format:
>
> Lade Daten von der Uhr herunter...
> Uhr benutzt Protokoll V1
> V1
> 0:23
> 1:32
> 1:41
> 2:13
> 2:21
> 2:58
> 3:10
> 3:20
> 3:40
> 4:4
> 4:17
> 4:36
> 4:48
> 5:25
> 5:47
> 6:16
> 6
>
> ...and fillig it up with data directly from the watch:
>
> Lade Daten von der Uhr herunter...
> Uhr benutzt Protokoll V1
> V1
> 0:23
> 1:32
> 1:41
> 2:13
> 2:21
> 2:58
> 3:10
> 3:20
> 3:40
> 4:4
> 4:17
> 4:36
> 4:48
> 5:25
> 5:47
> 6:16
> 6
>
>
> 6:33
> 6:45
> 7:13
> 7:32
> 8:01
>
> Data A 22:55
>
> After modifying communication.py:
>    print "Read 64"
>    ser.write('V')
>    data = ser.read(64)
>    for i in range(len(data)):
>        print ord(data[i])
>        dat.append(data[i])
>
> Lade Daten von der Uhr herunter...
> Read 64
> 86
> 9
> 4
> 0
> 20
> 0
> 0
> 8
> 30
> 21
> 0
> 23
> 49
> 1
> 32
> 52
> 1
> 41
> 37
> 2
> 13
> 16
> 2
> 21
> 25
> 2
> 58
> 1
> 3
> 10
> 16
> 3
> 20
> 37
> 3
> 40
> 25
> 4
> 4
> 55
> 4
> 17
> 52
> 4
> 36
> 4
> 4
> 48
> 46
> 5
> 25
> 16
> 5
> 47
> 43
> 6
> 16
> 46
> 6
> 33
> 34
> 6
> 45
> 40
> Uhr benutzt Protokoll V1
> V1
> 0
> 23
> 52
> 1
> 13
> 16
> 2
> 58
> 16
> 3
> 40
> 25
> 4
> 17
> 4
> 4
> 25
> 16
> 6
> 16
>
> Übertrage Daten zum Browser...
>
>
> Hmm...
>
> greetings,
> Stefan
>
> PS: Is german your native language? If, we can talk in german, that's
> easier.
>
> Am Freitag, den 02.09.2011, 07:41 +0000 schrieb hintze:
>> ok. thank you very much for your offer :) i would appreciate if you
>> could provide some debugging. ok ill try to explain the communication in
>> some short sentences.
>>
>> first of all, the watches communicate with your PC by an USB-serial-adapter, which is located inside the clamb you use to attach your watch. with some really basic communication, one can retrieve data from the watch in simple ASCII-characters, which can be 'translated' into an integer[1].
>> to trigger the data transfer, one has to write a 'V' onto a watch of V1 or '\xC0\x04\x00\xC0' (in HEX) onto a watch of V2. (this happens in communication.py). the string which is returned by the watch has a specific length depending of how many awakemoments one have had.
>> this is also the cause of your bug. the length of the string has not been determined correctly, so there is a loop running behind the length of the string.
>>
>> <<self.awakemo...

Read more...

Revision history for this message
T-Lo (ausserirdischer) wrote :

Hey,

I think we ran into this problem with watches running on V2 earlier on. Can you specify the line where the change has to be made please? :)

Revision history for this message
Christian Hintze (hintze) wrote :

its in line 62 of communication.py. but in the current devel-branch
(at least rev 41) this is allready fixed (to 256) as i have just seen
:) we can close this bug.. but maybe we should release a new version?

2011/9/4 T-Lo <email address hidden>:
> Hey,
>
> I think we ran into this problem with watches running on V2 earlier on.
> Can you specify the line where the change has to be made please? :)
>
> --
> You received this bug notification because you are a member of PySleep-
> devs, which is subscribed to PySleep.
> https://bugs.launchpad.net/bugs/839082
>
> Title:
>  Data couldn't be retrieved from Watch
>
> Status in PySleep - Reading & Uploading Data from Sleeptracker Watches:
>  New
>
> Bug description:
>  Traceback (most recent call last):
>    File "src/st_web.py", line 123, in <module>
>      data = watch.getData()
>    File "/home/stefan/PySleep-basic/src/format_data.py", line 143, in getData
>      std.fill(dat)
>    File "/home/stefan/PySleep-basic/src/format_data.py", line 85, in fill
>      self.awakemoments[1].append(ord(dat[it.next()]))
>  StopIteration
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/pysleep/+bug/839082/+subscriptions
>

Revision history for this message
Stefan Willems (st-willems) wrote :
Download full text (5.7 KiB)

Hi,

yes, it runs.

Greetings,
Stefan
Am Sonntag, den 04.09.2011, 11:59 +0000 schrieb hintze:
> hi, yeah actually were germans and we can communicate in our language
> therefor. but i would prefer to make the public communication in this
> place international.
>
> so what i see so far, the problem is located in the line
>
> "data = ser.read(64)"
>
> could you try to change 64 to, say 128? you had too much data points,
> they couldnt fit into 64 characters. i thought we did change that
> allready. but im a little bit confused :D if you do have that much
> data now, than you can try if it works. but im sure that this is the
> cause of the bug here.
>
> 2011/9/4 Stefan Willems <email address hidden>:
> > Hi,
> >
> > today I was able to debug a little:
> >
> > Script says this:
> >
> > Lade Daten von der Uhr herunter...
> > Uhr benutzt Protokoll V1
> > V1
> > 0
> > 23
> > 1
> > 32
> > 1
> > 41
> > 2
> > 13
> > 2
> > 21
> > 2
> > 58
> > 3
> > 10
> > 3
> > 20
> > 3
> > 40
> > 4
> > 4
> > 4
> > 17
> > 4
> > 36
> > 4
> > 48
> > 5
> > 25
> > 5
> > 47
> > 6
> > 16
> > 6
> >
> > After putting it in a readable format:
> >
> > Lade Daten von der Uhr herunter...
> > Uhr benutzt Protokoll V1
> > V1
> > 0:23
> > 1:32
> > 1:41
> > 2:13
> > 2:21
> > 2:58
> > 3:10
> > 3:20
> > 3:40
> > 4:4
> > 4:17
> > 4:36
> > 4:48
> > 5:25
> > 5:47
> > 6:16
> > 6
> >
> > ...and fillig it up with data directly from the watch:
> >
> > Lade Daten von der Uhr herunter...
> > Uhr benutzt Protokoll V1
> > V1
> > 0:23
> > 1:32
> > 1:41
> > 2:13
> > 2:21
> > 2:58
> > 3:10
> > 3:20
> > 3:40
> > 4:4
> > 4:17
> > 4:36
> > 4:48
> > 5:25
> > 5:47
> > 6:16
> > 6
> >
> >
> > 6:33
> > 6:45
> > 7:13
> > 7:32
> > 8:01
> >
> > Data A 22:55
> >
> > After modifying communication.py:
> > print "Read 64"
> > ser.write('V')
> > data = ser.read(64)
> > for i in range(len(data)):
> > print ord(data[i])
> > dat.append(data[i])
> >
> > Lade Daten von der Uhr herunter...
> > Read 64
> > 86
> > 9
> > 4
> > 0
> > 20
> > 0
> > 0
> > 8
> > 30
> > 21
> > 0
> > 23
> > 49
> > 1
> > 32
> > 52
> > 1
> > 41
> > 37
> > 2
> > 13
> > 16
> > 2
> > 21
> > 25
> > 2
> > 58
> > 1
> > 3
> > 10
> > 16
> > 3
> > 20
> > 37
> > 3
> > 40
> > 25
> > 4
> > 4
> > 55
> > 4
> > 17
> > 52
> > 4
> > 36
> > 4
> > 4
> > 48
> > 46
> > 5
> > 25
> > 16
> > 5
> > 47
> > 43
> > 6
> > 16
> > 46
> > 6
> > 33
> > 34
> > 6
> > 45
> > 40
> > Uhr benutzt Protokoll V1
> > V1
> > 0
> > 23
> > 52
> > 1
> > 13
> > 16
> > 2
> > 58
> > 16
> > 3
> > 40
> > 25
> > 4
> > 17
> > 4
> > 4
> > 25
> > 16
> > 6
> > 16
> >
> > Übertrage Daten zum Browser...
> >
> >
> > Hmm...
> >
> > greetings,
> > Stefan
> >
> > PS: Is german your native language? If, we can talk in german, that's
> > easier.
> >
> > Am Freitag, den 02.09.2011, 07:41 +0000 schrieb hintze:
> >> ok. thank you very much for your offer :) i would appreciate if you
> >> could provide some debugging. ok ill try to explain the communication in
> >> some short sentences.
> >>
> >> first of all, the watches communicate with your PC by an USB-serial-adapter, which is located inside the clamb you use to attach your watch. with some really basic communication, one can retrieve...

Read more...

Revision history for this message
Christian Hintze (hintze) wrote :

thank you very much!

fix committed. well release the fixed version in the near future.

Changed in pysleep:
status: New → Fix Committed
importance: Undecided → High
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.