Check-in [7c22743d9a]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Sensor example
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7c22743d9ab2f4e70201960a34682e0a620862c9
User & Date: bernd 2014-01-21 01:02:55
Context
2014-01-23
15:35
Fixed scrolling check-in: ff69bb0126 user: bernd tags: trunk
2014-01-21
01:02
Sensor example check-in: 7c22743d9a user: bernd tags: trunk
00:18
Restore app cls stuff check-in: 823e61c19e user: bernd tags: trunk
Changes

Changes to gles2/jni-location.fs.

107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
: stop-sensor ( type -- )
    clazz >o
    sensorManager >o getDefaultSensor dup ref> to argsensor ]ref
    stopsensor gforth-handler >o post ref> drop o> ;

: .deg ( degree -- )
    fdup f0< IF ." -" fnegate THEN
    fdup floor fdup f>s 0 .r '°' xemit f-  60e f*
    fdup floor fdup f>s 0 .r ''' xemit f-  60e f*
    f. ;

: .location ( -- )  location >o
    o 0= IF  ." unknown" cr
    ELSE
	getProvider dup .jstring ]ref
	." Lat: " getLatitude .deg cr
	." Lon: " getLongitude .deg cr
	." Alt: " getAltitude f. cr
	." Spd: " getSpeed f. cr
	." Dir: " getBearing f. cr
	." Tme: " getTime d. cr
	." Acc: " getAccuracy f. cr
    THEN
    o> ;

: .sensor ( -- )  sensor >o
    o 0= IF  ." unknown"
    ELSE
	se-sensor >o getName .jstring space ref>
	se-values [f@ bounds DO  I sf@ f. 1 sfloats +LOOP
    THEN cr o> ;

: .sensors ( -- )  clazz >o sensorManager >o TYPE_ALL getSensorList >o
    [: cr getType . getName .jstring ;] o l-map ref> ref> o> ;

previous previous







|

|







|
|
|

|







|






107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
: stop-sensor ( type -- )
    clazz >o
    sensorManager >o getDefaultSensor dup ref> to argsensor ]ref
    stopsensor gforth-handler >o post ref> drop o> ;

: .deg ( degree -- )
    fdup f0< IF ." -" fnegate THEN
    fdup floor fdup f>s 0 .r '^' xemit f-  60e f*
    fdup floor fdup f>s 0 .r ''' xemit f-  60e f*
    7 4 0 f.rdp ;

: .location ( -- )  location >o
    o 0= IF  ." unknown" cr
    ELSE
	getProvider dup .jstring ]ref
	." Lat: " getLatitude .deg cr
	." Lon: " getLongitude .deg cr
	." Alt: " getAltitude 7 1 0 f.rdp cr
	." Spd: " getSpeed 8 2 0 f.rdp cr
	." Dir: " getBearing 8 2 0 f.rdp cr
	." Tme: " getTime d. cr
	." Acc: " getAccuracy 8 2 0 f.rdp cr
    THEN
    o> ;

: .sensor ( -- )  sensor >o
    o 0= IF  ." unknown"
    ELSE
	se-sensor >o getName .jstring space ref>
	se-values [f@ bounds DO  I sf@ 10 4 0 f.rdp 1 sfloats +LOOP
    THEN cr o> ;

: .sensors ( -- )  clazz >o sensorManager >o TYPE_ALL getSensorList >o
    [: cr getType . getName .jstring ;] o l-map ref> ref> o> ;

previous previous

Changes to gles2/jni-tools.fs.

186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
comp: drop '"' parse cstring $0!
    cstring>sstring 1+ ]] SLiteral drop make-jstring [[ ;

Variable iscopy
2Variable to-release
: jfree ( -- )
    to-release 2@ 2dup d0= IF  2drop  EXIT  THEN  0. to-release 2!
    fieldenv JNIEnv-ReleaseStringUTFChars() ;
: jstring>sstring ( string -- addr u )  jfree
    dup >r iscopy fieldenv JNIEnv-GetStringUTFChars()
    r> over to-release 2! cstring>sstring ;
: .jstring ( string -- ) jstring>sstring type jfree ;

0 Value jniclass








|







186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
comp: drop '"' parse cstring $0!
    cstring>sstring 1+ ]] SLiteral drop make-jstring [[ ;

Variable iscopy
2Variable to-release
: jfree ( -- )
    to-release 2@ 2dup d0= IF  2drop  EXIT  THEN  0. to-release 2!
    over >r fieldenv JNIEnv-ReleaseStringUTFChars() r> ]ref ;
: jstring>sstring ( string -- addr u )  jfree
    dup >r iscopy fieldenv JNIEnv-GetStringUTFChars()
    r> over to-release 2! cstring>sstring ;
: .jstring ( string -- ) jstring>sstring type jfree ;

0 Value jniclass

Added gles2/sensors.fs.









































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
\ sensor example

require jni-location.fs

also jni also android

: .sensor-at ( -- ) 0 sensor >o se-sensor >o getType ref> o> at-xy
    .sensor ;

: .location-at ( -- )  0 15 at-xy .location ;

:noname  to sensor .sensor-at ; is android-sensor
:noname  to location .location-at ; is android-location

: +sensors ( -- )  clazz >o sensorManager >o TYPE_ALL getSensorList >o
    [: getType 1000000 start-sensor 10 ms ;] o l-map ref> ref> o> ;

page start-gps +sensors

previous previous

Changes to jni-location.fs.

107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
: stop-sensor ( type -- )
    clazz >o
    sensorManager >o getDefaultSensor dup ref> to argsensor ]ref
    stopsensor gforth-handler >o post ref> drop o> ;

: .deg ( degree -- )
    fdup f0< IF ." -" fnegate THEN
    fdup floor fdup f>s 0 .r '°' xemit f-  60e f*
    fdup floor fdup f>s 0 .r ''' xemit f-  60e f*
    f. ;

: .location ( -- )  location >o
    o 0= IF  ." unknown" cr
    ELSE
	getProvider dup .jstring ]ref
	." Lat: " getLatitude .deg cr
	." Lon: " getLongitude .deg cr
	." Alt: " getAltitude f. cr
	." Spd: " getSpeed f. cr
	." Dir: " getBearing f. cr
	." Tme: " getTime d. cr
	." Acc: " getAccuracy f. cr
    THEN
    o> ;

: .sensor ( -- )  sensor >o
    o 0= IF  ." unknown"
    ELSE
	se-sensor >o getName .jstring space ref>
	se-values [f@ bounds DO  I sf@ f. 1 sfloats +LOOP
    THEN cr o> ;

: .sensors ( -- )  clazz >o sensorManager >o TYPE_ALL getSensorList >o
    [: cr getType . getName .jstring ;] o l-map ref> ref> o> ;

previous previous







|

|







|
|
|

|







|






107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
: stop-sensor ( type -- )
    clazz >o
    sensorManager >o getDefaultSensor dup ref> to argsensor ]ref
    stopsensor gforth-handler >o post ref> drop o> ;

: .deg ( degree -- )
    fdup f0< IF ." -" fnegate THEN
    fdup floor fdup f>s 0 .r '^' xemit f-  60e f*
    fdup floor fdup f>s 0 .r ''' xemit f-  60e f*
    7 4 0 f.rdp ;

: .location ( -- )  location >o
    o 0= IF  ." unknown" cr
    ELSE
	getProvider dup .jstring ]ref
	." Lat: " getLatitude .deg cr
	." Lon: " getLongitude .deg cr
	." Alt: " getAltitude 7 1 0 f.rdp cr
	." Spd: " getSpeed 8 2 0 f.rdp cr
	." Dir: " getBearing 8 2 0 f.rdp cr
	." Tme: " getTime d. cr
	." Acc: " getAccuracy 8 2 0 f.rdp cr
    THEN
    o> ;

: .sensor ( -- )  sensor >o
    o 0= IF  ." unknown"
    ELSE
	se-sensor >o getName .jstring space ref>
	se-values [f@ bounds DO  I sf@ 10 4 0 f.rdp 1 sfloats +LOOP
    THEN cr o> ;

: .sensors ( -- )  clazz >o sensorManager >o TYPE_ALL getSensorList >o
    [: cr getType . getName .jstring ;] o l-map ref> ref> o> ;

previous previous