@@ -3,6 +3,7 @@ import Network.GetterRequest 1.0
3
3
import CustomerTimer 1.0 //QTIMER TIMER class
4
4
import QTimerLibrary 1.0 //QTIMER class
5
5
import bb.system 1.2
6
+ import "asset:///otherfunctions.js" as CamFunctions
6
7
7
8
Page {
8
9
id: startpage
@@ -23,18 +24,13 @@ Page {
23
24
24
25
onStatsReceived: {
25
26
// reset NoStat counter
26
- Settings .setSettings (" GetStats" , 0 )
27
-
28
- buttonsContainer .enabled = true
29
-
30
- responseArea .text = info
31
- batteryLabel .text = info2 + " %"
32
- camMode .text = info3
27
+ CamFunctions .StatsReceived (response, batterypercent, mode)
33
28
}
34
29
35
30
onPasswordReceived: {
36
31
inProcess .stop ()
37
32
seTimer .start ()
33
+ sxTimer .Start ()
38
34
responseArea .text = " Connecting..."
39
35
}
40
36
@@ -44,45 +40,16 @@ Page {
44
40
}
45
41
46
42
onSignalNotGetPassword: {
47
- var pcount = Settings .getSettings (" GetPassword" , 0 )
48
- // console.debug("pcount:", pcount)
49
- pcount++
50
- Settings .setSettings (" GetPassword" , pcount)
51
-
52
- if (pcount != 3 ) {
53
- // console.debug("pcount:", pcount)
54
- // console.debug("2nd or 3rd Getpassword")
55
- GetPassword ()
56
- responseArea .text = " Attempt to get password..."
57
- }
58
- if (pcount == 3 ) {
59
- // console.debug("Start retryDialog and pcount=",pcount)
60
- inProcess .stop ()
61
- retryDialog .open ()
62
- responseArea .text = " Cannot connect to GoPro"
63
- }
43
+ CamFunctions .NotGetPassword ()
44
+
64
45
}
65
46
66
47
onSignalNotGetStats: {
67
- responseArea .text = " Problem with connection..."
68
-
69
- var scount = Settings .getSettings (" GetStats" , 0 )
70
- scount++
71
- console .debug (" SCOUNT: " ,scount)
72
- Settings .setSettings (" GetStats" , scount)
73
-
74
- if (scount == 3 ) {
75
- deactAllButPower ()
76
- resetNumbers ()
77
- powerButton .setChecked (false )
78
- responseArea .text = " Disconnected!"
79
- seTimer .stop ()
80
- getPasswordwithCounter ()
81
- }
48
+ CamFunctions .NotGetStats ()
82
49
}
83
50
84
51
},
85
- QTimer {
52
+ Timer {
86
53
id: sxTimer
87
54
interval: 35000
88
55
onTimeout: {
@@ -93,12 +60,12 @@ Page {
93
60
RetryConnectionDialog {
94
61
id: retryDialog
95
62
onSendRestart: {
96
- getPasswordwithCounter ()
63
+ CamFunctions . getPasswordwithCounter ()
97
64
}
98
65
onCancelRestart: {
99
66
inProcess .stop ()
100
- // deactAllButPower()
101
- deactAllbuttons ()
67
+ // CamFunctions. deactAllButPower()
68
+ CamFunctions . deactAllbuttons ()
102
69
cancelledAlert .show ()
103
70
}
104
71
}
@@ -373,40 +340,7 @@ Page {
373
340
374
341
onCreationCompleted: {
375
342
// getThis.GetPassword()
376
- getPasswordwithCounter ()
343
+ CamFunctions . getPasswordwithCounter ()
377
344
}
378
345
379
- // GetPassword with Counter up to 3 times
380
- function getPasswordwithCounter ()
381
- {
382
- inProcess .start ()
383
- Settings .setSettings (" GetPassword" , 0 )
384
- var pcount = Settings .getSettings (" GetPassword" , 0 )
385
- console .debug (" pcount:" , pcount)
386
-
387
- console .debug (" First Getpassword" )
388
-
389
- // reset failed stat counter
390
- Settings .setSettings (" GetStats" , 0 )
391
-
392
- getThis .GetPassword ()
393
- }
394
-
395
- function deactAllButPower ()
396
- {
397
- batteryImage .imageSource = " asset:///images/battery-full-icon0.png"
398
- buttonsContainer .enabled = false
399
- responseArea .text = " Please restart DoIt GoPro to retry to connect..."
400
- }
401
-
402
- function resetNumbers ()
403
- {
404
- batteryLabel .text = " -%"
405
- camMode .text = " Unknown"
406
- }
407
-
408
- function deactAllbuttons ()
409
- {
410
- rootContainer .enabled = false
411
- }
412
346
}
0 commit comments