Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
DDC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GOKA HARSHITH
DDC
Commits
baee4c7b
Commit
baee4c7b
authored
Jun 29, 2016
by
Harshith Goka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Still in debugging, queue to be implemented
parent
15e7149c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
88 additions
and
57 deletions
+88
-57
.idea/misc.xml
.idea/misc.xml
+1
-1
app/src/main/java/com/example/harshith/ddc/DTWtwoD.java
app/src/main/java/com/example/harshith/ddc/DTWtwoD.java
+1
-1
app/src/main/java/com/example/harshith/ddc/DynamicPrime.java
app/src/main/java/com/example/harshith/ddc/DynamicPrime.java
+11
-11
app/src/main/java/com/example/harshith/ddc/DynamicQueue.java
app/src/main/java/com/example/harshith/ddc/DynamicQueue.java
+18
-6
app/src/main/java/com/example/harshith/ddc/ReceiveDataThread.java
...main/java/com/example/harshith/ddc/ReceiveDataThread.java
+51
-37
app/src/main/java/com/example/harshith/ddc/ReceiveService.java
...rc/main/java/com/example/harshith/ddc/ReceiveService.java
+6
-1
No files found.
.idea/misc.xml
View file @
baee4c7b
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
<ConfirmationsSetting
value=
"0"
id=
"Add"
/>
<ConfirmationsSetting
value=
"0"
id=
"Add"
/>
<ConfirmationsSetting
value=
"0"
id=
"Remove"
/>
<ConfirmationsSetting
value=
"0"
id=
"Remove"
/>
</component>
</component>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_
8
"
default=
"true"
assert-keyword=
"true"
jdk-15=
"true"
project-jdk-name=
"1.8"
project-jdk-type=
"JavaSDK"
>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_
7
"
default=
"true"
assert-keyword=
"true"
jdk-15=
"true"
project-jdk-name=
"1.8"
project-jdk-type=
"JavaSDK"
>
<output
url=
"file://$PROJECT_DIR$/build/classes"
/>
<output
url=
"file://$PROJECT_DIR$/build/classes"
/>
</component>
</component>
<component
name=
"ProjectType"
>
<component
name=
"ProjectType"
>
...
...
app/src/main/java/com/example/harshith/ddc/DTWtwoD.java
View file @
baee4c7b
...
@@ -22,7 +22,7 @@ class DTWtwoD extends DTW {
...
@@ -22,7 +22,7 @@ class DTWtwoD extends DTW {
totalSquared
+=
Math
.
pow
(
a
[
p
][
i
]
-
b
[
q
][
i
],
2
);
totalSquared
+=
Math
.
pow
(
a
[
p
][
i
]
-
b
[
q
][
i
],
2
);
}
}
return
Math
.
sqrt
(
totalSquared
);
return
Math
.
sqrt
(
Math
.
sqrt
(
totalSquared
)
);
}
}
public
int
sdtwDistance
(){
public
int
sdtwDistance
(){
...
...
app/src/main/java/com/example/harshith/ddc/DynamicPrime.java
View file @
baee4c7b
...
@@ -70,16 +70,16 @@ class DynamicPrime{
...
@@ -70,16 +70,16 @@ class DynamicPrime{
a[1].printData();*/
a[1].printData();*/
DynamicQueue
q
=
new
DynamicQueue
(
a
);
//
DynamicQueue q = new DynamicQueue(a);
Live
dynamiclive
=
new
Live
();
//
Live dynamiclive = new Live();
//
q
.
foremostElement
=
0
;
//
q.foremostElement = 0;
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
//
for (int i=0; i<5; i++) {
dynamiclive
.
update
(
i
*
2
);
//
dynamiclive.update(i*2);
q
.
updateQueue
(
dynamiclive
);
//
q.updateQueue(dynamiclive);
q
.
processQueue
();
//
q.processQueue();
q
.
proceedExecution
();
//
q.proceedExecution();
q
.
print
();
// q.print();
}
//
}
}
}
}
}
\ No newline at end of file
app/src/main/java/com/example/harshith/ddc/DynamicQueue.java
View file @
baee4c7b
package
com.example.harshith.ddc
;
package
com.example.harshith.ddc
;
import
java.lang.reflect.Array
;
import
java.util.Queue
;
class
DynamicQueue
{
class
DynamicQueue
{
public
int
noOfSlots
=
2000
;
public
int
noOfSlots
=
2000
;
public
int
noOfGestures
;
public
int
noOfGestures
;
...
@@ -10,10 +13,12 @@ class DynamicQueue{
...
@@ -10,10 +13,12 @@ class DynamicQueue{
public
int
latestElement
=
0
;
public
int
latestElement
=
0
;
public
int
foremostElement
=
0
;
public
int
foremostElement
=
0
;
public
int
[]
threshold
;
public
DynamicQueue
(
DynamicGesture
[]
gest
){
public
DynamicQueue
(
DynamicGesture
[]
gest
,
int
[]
threshold
){
gesture
=
gest
.
clone
();
gesture
=
gest
.
clone
();
noOfGestures
=
gesture
.
length
;
noOfGestures
=
gesture
.
length
;
this
.
threshold
=
threshold
.
clone
();
liveElement
=
new
Live
[
noOfSlots
];
liveElement
=
new
Live
[
noOfSlots
];
for
(
int
i
=
0
;
i
<
noOfSlots
;
i
++)
{
for
(
int
i
=
0
;
i
<
noOfSlots
;
i
++)
{
...
@@ -110,8 +115,6 @@ class DynamicQueue{
...
@@ -110,8 +115,6 @@ class DynamicQueue{
}
}
public
void
processLive
(
int
slotNo
,
int
livesTailNo
){
public
void
processLive
(
int
slotNo
,
int
livesTailNo
){
int
threshold
=
30
;
DTW
x
;
DTW
x
;
for
(
int
i
=
0
;
i
<
noOfGestures
;
i
++)
{
for
(
int
i
=
0
;
i
<
noOfGestures
;
i
++)
{
...
@@ -124,19 +127,28 @@ class DynamicQueue{
...
@@ -124,19 +127,28 @@ class DynamicQueue{
dtwGap
[
slotNo
][
i
]
=
x
.
sdtwDistance
();
dtwGap
[
slotNo
][
i
]
=
x
.
sdtwDistance
();
}
}
for
(
int
i
=
0
;
i
<
noOfGestures
;
i
++)
{
for
(
int
i
=
0
;
i
<
noOfGestures
;
i
++)
{
if
(
dtwGap
[
slotNo
][
i
]>=
threshold
)
shortlist
[
slotNo
][
i
]
=
false
;
if
(
dtwGap
[
slotNo
][
i
]>=
threshold
[
i
]
)
shortlist
[
slotNo
][
i
]
=
false
;
}
}
}
}
public
void
processQueue
(){
public
void
processQueue
(){
for
(
int
i
=
foremostElement
;
i
!=
latestElement
;
i
=(
i
+
1
)%
noOfSlots
)
{
// int no;
// if(latestElement > foremostElement){
// no = Math.max(foremostElement,latestElement-20)%noOfSlots;
// }
// else {
// no = (latestElement - 20)%noOfSlots;
// }
for
(
int
i
=
foremostElement
;
i
!=
latestElement
;
i
=(
i
+
1
)%
noOfSlots
)
{
processLive
(
i
,
latestElement
);
processLive
(
i
,
latestElement
);
}
}
}
}
public
int
proceedExecution
(){
public
int
proceedExecution
(){
for
(
int
i
=
foremostElement
;
i
!=
latestElement
;
i
=(
i
+
1
)%
noOfSlots
)
{
int
no
;
no
=
Math
.
max
((
latestElement
-
20
)%
noOfSlots
,
foremostElement
);
for
(
int
i
=
foremostElement
;
i
!=
no
;
i
=(
i
+
1
)%
noOfSlots
)
{
if
(
getShortlistCount
(
i
)==
0
)
foremostElement
=
(
foremostElement
+
1
)%
noOfSlots
;
if
(
getShortlistCount
(
i
)==
0
)
foremostElement
=
(
foremostElement
+
1
)%
noOfSlots
;
else
if
(
getShortlistCount
(
i
)==
1
)
{
else
if
(
getShortlistCount
(
i
)==
1
)
{
//gesture execute
//gesture execute
...
...
app/src/main/java/com/example/harshith/ddc/ReceiveDataThread.java
View file @
baee4c7b
...
@@ -20,13 +20,15 @@ public class ReceiveDataThread extends Thread {
...
@@ -20,13 +20,15 @@ public class ReceiveDataThread extends Thread {
GlobalClass
globalClass
;
GlobalClass
globalClass
;
public
int
readStatus
;
public
int
readStatus
;
private
StringBuilder
stringBuilder
=
null
;
private
StringBuilder
stringBuilder
=
null
;
boolean
isFirstTime
;
int
[]
readings
;
int
[]
readings
;
int
[]
threshold
;
public
ReceiveDataThread
(
BluetoothSocket
bluetoothSocket
,
Handler
handler
,
GlobalClass
globalClass
)
{
public
ReceiveDataThread
(
BluetoothSocket
bluetoothSocket
,
Handler
handler
,
GlobalClass
globalClass
,
boolean
b
)
{
this
.
bluetoothSocket
=
bluetoothSocket
;
this
.
bluetoothSocket
=
bluetoothSocket
;
this
.
handler
=
handler
;
this
.
handler
=
handler
;
this
.
globalClass
=
globalClass
;
this
.
globalClass
=
globalClass
;
stringBuilder
=
new
StringBuilder
();
stringBuilder
=
new
StringBuilder
();
isFirstTime
=
b
;
}
}
@Override
@Override
...
@@ -35,13 +37,16 @@ public class ReceiveDataThread extends Thread {
...
@@ -35,13 +37,16 @@ public class ReceiveDataThread extends Thread {
InputStream
tempIn
=
null
;
InputStream
tempIn
=
null
;
tempIn
=
bluetoothSocket
.
getInputStream
();
tempIn
=
bluetoothSocket
.
getInputStream
();
inputStream
=
tempIn
;
inputStream
=
tempIn
;
if
(!
isFirstTime
)
{
byte
[]
clearing
=
new
byte
[
1000
];
inputStream
.
read
(
clearing
);
}
int
noOfGestures
=
12
;
int
noOfGestures
=
12
;
int
indx
;
int
[][]
array
;
int
indx
;
int
[][]
array
;
int
[]
cons
;
int
[]
cons
;
DynamicGesture
[]
a
=
new
DynamicGesture
[
noOfGestures
];
DynamicGesture
[]
a
=
new
DynamicGesture
[
noOfGestures
];
threshold
=
new
int
[
noOfGestures
];
// initialising the 11 gestures
// initialising the 11 gestures
indx
=
0
;
indx
=
0
;
...
@@ -58,17 +63,16 @@ public class ReceiveDataThread extends Thread {
...
@@ -58,17 +63,16 @@ public class ReceiveDataThread extends Thread {
cons
=
new
int
[]
{
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
0
};
cons
=
new
int
[]
{
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
0
};
a
[
indx
].
updateFrame
(
array
,
cons
);
a
[
indx
].
updateFrame
(
array
,
cons
);
a
[
indx
].
printData
();
threshold
[
indx
]
=
40
;
indx
=
1
;
indx
=
1
;
array
=
new
int
[
201
][
11
];
array
=
new
int
[
201
][
11
];
setValue
(
array
,
2
0
,
0
,
201
);
setValue
(
array
,
0
,
0
,
201
);
setValue
(
array
,
9
0
,
1
,
201
);
setValue
(
array
,
10
0
,
1
,
201
);
setValue
(
array
,
9
0
,
2
,
201
);
setValue
(
array
,
10
0
,
2
,
201
);
setValue
(
array
,
9
0
,
3
,
201
);
setValue
(
array
,
10
0
,
3
,
201
);
setValue
(
array
,
9
0
,
4
,
201
);
setValue
(
array
,
10
0
,
4
,
201
);
lineDraw
(
array
,
0
,
0
,
51
,
5
,
false
);
lineDraw
(
array
,
50
,
-
50
,
101
,
5
,
true
);
lineDraw
(
array
,
150
,
50
,
51
,
5
,
false
);
lineDraw
(
array
,
0
,
0
,
51
,
5
,
false
);
lineDraw
(
array
,
50
,
-
50
,
101
,
5
,
true
);
lineDraw
(
array
,
150
,
50
,
51
,
5
,
false
);
setValue
(
array
,
0
,
8
,
201
);
setValue
(
array
,
0
,
8
,
201
);
setValue
(
array
,
0
,
9
,
201
);
setValue
(
array
,
0
,
9
,
201
);
...
@@ -77,8 +81,8 @@ public class ReceiveDataThread extends Thread {
...
@@ -77,8 +81,8 @@ public class ReceiveDataThread extends Thread {
cons
=
new
int
[]
{
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
1
,
1
,
0
};
cons
=
new
int
[]
{
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
1
,
1
,
0
};
a
[
indx
].
updateFrame
(
array
,
cons
);
a
[
indx
].
updateFrame
(
array
,
cons
);
a
[
indx
].
printData
();
//
a[indx].printData();
threshold
[
indx
]
=
40
;
indx
=
2
;
indx
=
2
;
array
=
new
int
[
51
][
11
];
array
=
new
int
[
51
][
11
];
...
@@ -93,8 +97,8 @@ public class ReceiveDataThread extends Thread {
...
@@ -93,8 +97,8 @@ public class ReceiveDataThread extends Thread {
cons
=
new
int
[]
{
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
1
,
1
,
0
};
cons
=
new
int
[]
{
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
1
,
1
,
0
};
a
[
indx
].
updateFrame
(
array
,
cons
);
a
[
indx
].
updateFrame
(
array
,
cons
);
a
[
indx
].
printData
();
//
a[indx].printData();
threshold
[
indx
]
=
40
;
indx
=
3
;
indx
=
3
;
array
=
new
int
[
101
][
11
];
array
=
new
int
[
101
][
11
];
...
@@ -110,8 +114,8 @@ public class ReceiveDataThread extends Thread {
...
@@ -110,8 +114,8 @@ public class ReceiveDataThread extends Thread {
cons
=
new
int
[]
{
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
0
};
cons
=
new
int
[]
{
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
0
};
a
[
indx
].
updateFrame
(
array
,
cons
);
a
[
indx
].
updateFrame
(
array
,
cons
);
a
[
indx
].
printData
();
//
a[indx].printData();
threshold
[
indx
]
=
40
;
indx
=
4
;
indx
=
4
;
array
=
new
int
[
101
][
11
];
array
=
new
int
[
101
][
11
];
...
@@ -127,7 +131,8 @@ public class ReceiveDataThread extends Thread {
...
@@ -127,7 +131,8 @@ public class ReceiveDataThread extends Thread {
cons
=
new
int
[]
{
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
0
};
cons
=
new
int
[]
{
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
0
};
a
[
indx
].
updateFrame
(
array
,
cons
);
a
[
indx
].
updateFrame
(
array
,
cons
);
a
[
indx
].
printData
();
// a[indx].printData();
threshold
[
indx
]
=
40
;
indx
=
5
;
indx
=
5
;
...
@@ -145,7 +150,8 @@ public class ReceiveDataThread extends Thread {
...
@@ -145,7 +150,8 @@ public class ReceiveDataThread extends Thread {
cons
=
new
int
[]
{
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
1
,
1
,
0
};
cons
=
new
int
[]
{
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
1
,
1
,
0
};
a
[
indx
].
updateFrame
(
array
,
cons
);
a
[
indx
].
updateFrame
(
array
,
cons
);
a
[
indx
].
printData
();
// a[indx].printData();
threshold
[
indx
]
=
40
;
indx
=
6
;
indx
=
6
;
...
@@ -165,7 +171,8 @@ public class ReceiveDataThread extends Thread {
...
@@ -165,7 +171,8 @@ public class ReceiveDataThread extends Thread {
cons
=
new
int
[]
{
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
1
,
1
,
0
};
cons
=
new
int
[]
{
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
1
,
1
,
0
};
a
[
indx
].
updateFrame
(
array
,
cons
);
a
[
indx
].
updateFrame
(
array
,
cons
);
a
[
indx
].
printData
();
// a[indx].printData();
threshold
[
indx
]
=
40
;
indx
=
7
;
indx
=
7
;
...
@@ -184,7 +191,8 @@ public class ReceiveDataThread extends Thread {
...
@@ -184,7 +191,8 @@ public class ReceiveDataThread extends Thread {
cons
=
new
int
[]
{
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
1
,
1
,
0
};
cons
=
new
int
[]
{
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
1
,
1
,
0
};
a
[
indx
].
updateFrame
(
array
,
cons
);
a
[
indx
].
updateFrame
(
array
,
cons
);
a
[
indx
].
printData
();
// a[indx].printData();
threshold
[
indx
]
=
40
;
indx
=
8
;
indx
=
8
;
...
@@ -201,7 +209,8 @@ public class ReceiveDataThread extends Thread {
...
@@ -201,7 +209,8 @@ public class ReceiveDataThread extends Thread {
cons
=
new
int
[]
{
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
0
};
cons
=
new
int
[]
{
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
0
};
a
[
indx
].
updateFrame
(
array
,
cons
);
a
[
indx
].
updateFrame
(
array
,
cons
);
a
[
indx
].
printData
();
// a[indx].printData();
threshold
[
indx
]
=
40
;
indx
=
9
;
indx
=
9
;
...
@@ -218,7 +227,8 @@ public class ReceiveDataThread extends Thread {
...
@@ -218,7 +227,8 @@ public class ReceiveDataThread extends Thread {
cons
=
new
int
[]
{
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
0
};
cons
=
new
int
[]
{
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
0
};
a
[
indx
].
updateFrame
(
array
,
cons
);
a
[
indx
].
updateFrame
(
array
,
cons
);
a
[
indx
].
printData
();
// a[indx].printData();
threshold
[
indx
]
=
40
;
indx
=
10
;
indx
=
10
;
...
@@ -235,7 +245,8 @@ public class ReceiveDataThread extends Thread {
...
@@ -235,7 +245,8 @@ public class ReceiveDataThread extends Thread {
cons
=
new
int
[]
{
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
0
};
cons
=
new
int
[]
{
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
0
};
a
[
indx
].
updateFrame
(
array
,
cons
);
a
[
indx
].
updateFrame
(
array
,
cons
);
a
[
indx
].
printData
();
// a[indx].printData();
threshold
[
indx
]
=
40
;
indx
=
11
;
indx
=
11
;
...
@@ -252,17 +263,18 @@ public class ReceiveDataThread extends Thread {
...
@@ -252,17 +263,18 @@ public class ReceiveDataThread extends Thread {
cons
=
new
int
[]
{
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
0
};
cons
=
new
int
[]
{
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
0
};
a
[
indx
].
updateFrame
(
array
,
cons
);
a
[
indx
].
updateFrame
(
array
,
cons
);
a
[
indx
].
printData
();
//
a[indx].printData();
threshold
[
indx
]
=
40
;
DynamicQueue
q
=
new
DynamicQueue
(
a
);
threshold
=
new
int
[]{
5
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
30
,
10
};
DynamicQueue
q
=
new
DynamicQueue
(
a
,
threshold
);
Live
dynamiclive
=
new
Live
();
Live
dynamiclive
=
new
Live
();
byte
[]
buffer
=
new
byte
[
64
];
byte
[]
buffer
=
new
byte
[
64
];
int
bytes
=
-
1
;
int
bytes
=
-
1
;
String
readMessage
;
String
readMessage
;
int
i
;
int
i
,
counter
=
1
;
convert
();
convert
();
while
(
true
)
{
while
(
true
)
{
bytes
=
inputStream
.
read
(
buffer
);
bytes
=
inputStream
.
read
(
buffer
);
...
@@ -273,16 +285,18 @@ public class ReceiveDataThread extends Thread {
...
@@ -273,16 +285,18 @@ public class ReceiveDataThread extends Thread {
if
(
readings
!=
null
&&
readings
.
length
==
11
)
{
if
(
readings
!=
null
&&
readings
.
length
==
11
)
{
dynamiclive
.
update
(
readings
);
dynamiclive
.
update
(
readings
);
q
.
updateQueue
(
dynamiclive
);
q
.
updateQueue
(
dynamiclive
);
q
.
processQueue
();
if
(
counter
>
20
)
{
i
=
q
.
proceedExecution
();
q
.
processQueue
();
if
(
i
!=
-
1
){
i
=
q
.
proceedExecution
();
Looper
.
prepare
();
if
(
i
!=
-
1
)
{
handler
.
obtainMessage
(
Constants
.
READ_STATUS
,
readStatus
,
i
,
null
).
sendToTarget
();
Looper
.
prepare
();
L
.
m
(
"Gesture "
+
i
+
" is executed"
);
handler
.
sendMessageDelayed
(
handler
.
obtainMessage
(
Constants
.
READ_STATUS
,
readStatus
,
i
,
null
),
10000
);
q
.
gestureStatusPrint
();
L
.
m
(
"Gesture "
+
i
+
" is executed"
);
Looper
.
loop
();
q
.
gestureStatusPrint
();
Looper
.
loop
();
}
}
}
counter
++;
// q.print();
// q.print();
}
}
}
}
...
...
app/src/main/java/com/example/harshith/ddc/ReceiveService.java
View file @
baee4c7b
...
@@ -22,6 +22,7 @@ public class ReceiveService extends Service {
...
@@ -22,6 +22,7 @@ public class ReceiveService extends Service {
private
static
final
UUID
uuid
=
UUID
.
fromString
(
"00001101-0000-1000-8000-00805F9B34FB"
);
private
static
final
UUID
uuid
=
UUID
.
fromString
(
"00001101-0000-1000-8000-00805F9B34FB"
);
public
Handler
handler
;
public
Handler
handler
;
GlobalClass
globalClass
;
GlobalClass
globalClass
;
BluetoothSocket
bluetoothSocket
;
@Override
@Override
public
void
onCreate
()
{
public
void
onCreate
()
{
...
@@ -31,7 +32,8 @@ public class ReceiveService extends Service {
...
@@ -31,7 +32,8 @@ public class ReceiveService extends Service {
if
(
message
.
what
==
Constants
.
CONNECTION_STATUS
)
{
if
(
message
.
what
==
Constants
.
CONNECTION_STATUS
)
{
if
(
message
.
arg1
==
Constants
.
CONNECTION_STATUS_OK
){
if
(
message
.
arg1
==
Constants
.
CONNECTION_STATUS_OK
){
Toast
.
makeText
(
getApplicationContext
(),
"Connected"
,
Toast
.
LENGTH_LONG
).
show
();
Toast
.
makeText
(
getApplicationContext
(),
"Connected"
,
Toast
.
LENGTH_LONG
).
show
();
receiveDataThread
=
new
ReceiveDataThread
((
BluetoothSocket
)
message
.
obj
,
handler
,
globalClass
);
bluetoothSocket
=
(
BluetoothSocket
)
message
.
obj
;
receiveDataThread
=
new
ReceiveDataThread
((
BluetoothSocket
)
message
.
obj
,
handler
,
globalClass
,
true
);
receiveDataThread
.
start
();
receiveDataThread
.
start
();
}
}
else
if
(
message
.
arg1
==
Constants
.
CONNECTION_STATUS_NOT_CONNECTED
){
else
if
(
message
.
arg1
==
Constants
.
CONNECTION_STATUS_NOT_CONNECTED
){
...
@@ -40,7 +42,10 @@ public class ReceiveService extends Service {
...
@@ -40,7 +42,10 @@ public class ReceiveService extends Service {
}
}
else
if
(
message
.
what
==
Constants
.
READ_STATUS
)
{
else
if
(
message
.
what
==
Constants
.
READ_STATUS
)
{
if
(
message
.
arg1
==
Constants
.
READ_STATUS_OK
){
if
(
message
.
arg1
==
Constants
.
READ_STATUS_OK
){
Toast
.
makeText
(
getBaseContext
(),
"Gesture "
+
message
.
arg2
+
" is executed"
,
Toast
.
LENGTH_SHORT
).
show
();
receiveDataThread
=
new
ReceiveDataThread
(
bluetoothSocket
,
handler
,
globalClass
,
false
);
receiveDataThread
.
start
();
}
}
else
if
(
message
.
arg1
==
Constants
.
READ_STATUS_NOT_OK
){
else
if
(
message
.
arg1
==
Constants
.
READ_STATUS_NOT_OK
){
L
.
s
(
getBaseContext
(),
"Connection Lost"
);
L
.
s
(
getBaseContext
(),
"Connection Lost"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment