File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -97,8 +97,9 @@ export class NaoRobotModel extends DOMWidgetModel {
97
97
98
98
// Handle connection failure
99
99
if ( ! this . qiSession . isConnected ( ) ) {
100
+ this . disconnect ( ) ;
100
101
console . error ( 'Connection to ' , ipAddress , ' could not be established.' ) ;
101
- this . changeStatus ( 'Unavailable ' ) ;
102
+ this . changeStatus ( 'Connection to ' + ipAddress + ' could not be established. ') ;
102
103
}
103
104
}
104
105
@@ -126,6 +127,8 @@ export class NaoRobotModel extends DOMWidgetModel {
126
127
127
128
// Reconnect if possible
128
129
if ( ! this . qiSession . isConnected ( ) ) {
130
+ this . set ( 'connected' , 'Disconnected' ) ;
131
+ this . save_changes ( ) ;
129
132
await this . connect ( this . _ipAddress , this . _port ) ;
130
133
}
131
134
return true ;
@@ -188,6 +191,11 @@ export class NaoRobotModel extends DOMWidgetModel {
188
191
189
192
// Timeout after ~10 seconds
190
193
for ( let i = 0 ; i < 100 ; i ++ ) {
194
+ // Do not wait for service if there is no connection
195
+ if ( ! this . qiSession . isConnected ( ) ) {
196
+ this . disconnect ( ) ;
197
+ break ;
198
+ }
191
199
if ( this . _services [ serviceName ] ) {
192
200
console . log ( 'Service available after ' , i / 10.0 , ' seconds.' ) ;
193
201
break ;
You can’t perform that action at this time.
0 commit comments