@@ -1512,61 +1512,68 @@ const _processImpedanceCyton = (msg, client) => {
15121512const _processImpedanceGanglion = ( msg , client ) => {
15131513 switch ( msg . action ) {
15141514 case kTcpActionStart :
1515- ganglionBLE
1516- . impedanceStart ( )
1517- . then ( ( ) => {
1518- ganglionBLE . on (
1519- k . OBCIEmitterImpedance ,
1520- impedanceFunction . bind ( null , client )
1521- ) ;
1522- writeCodeToClientOfType (
1523- client ,
1524- kTcpTypeImpedance ,
1525- kTcpCodeSuccess ,
1526- {
1527- action : kTcpActionStart
1528- }
1529- ) ;
1530- } )
1531- . catch ( err => {
1532- writeCodeToClientOfType (
1533- client ,
1534- kTcpTypeImpedance ,
1535- kTcpCodeErrorImpedanceCouldNotStart ,
1536- {
1537- message : err . message
1538- }
1539- ) ;
1540- } ) ;
1515+ setTimeout ( ( ) => {
1516+ console . log ( 'start impedance check' ) ;
1517+ ganglionBLE
1518+ . impedanceStart ( )
1519+ . then ( ( ) => {
1520+ ganglionBLE . on (
1521+ k . OBCIEmitterImpedance ,
1522+ impedanceFunction . bind ( null , client )
1523+ ) ;
1524+ writeCodeToClientOfType (
1525+ client ,
1526+ kTcpTypeImpedance ,
1527+ kTcpCodeSuccess ,
1528+ {
1529+ action : kTcpActionStart
1530+ }
1531+ ) ;
1532+ } )
1533+ . catch ( err => {
1534+ writeCodeToClientOfType (
1535+ client ,
1536+ kTcpTypeImpedance ,
1537+ kTcpCodeErrorImpedanceCouldNotStart ,
1538+ {
1539+ message : err . message
1540+ }
1541+ ) ;
1542+ } ) ;
1543+ } , 2000 ) ;
15411544 break ;
15421545 case kTcpActionStop :
1543- ganglionBLE
1544- . impedanceStop ( )
1545- . then ( ( ) => {
1546- ganglionBLE . removeAllListeners ( k . OBCIEmitterImpedance ) ;
1547- writeCodeToClientOfType (
1548- client ,
1549- kTcpTypeImpedance ,
1550- kTcpCodeSuccess ,
1551- {
1552- action : kTcpActionStop
1553- }
1554- ) ;
1555- } )
1556- . catch ( err => {
1557- writeCodeToClientOfType (
1558- client ,
1559- kTcpTypeImpedance ,
1560- kTcpCodeErrorImpedanceCouldNotStop ,
1561- {
1562- message : err . message
1563- }
1564- ) ;
1565- } ) ;
1546+ setTimeout ( ( ) => {
1547+ console . log ( 'stop impedance check' ) ;
1548+ ganglionBLE
1549+ . impedanceStop ( )
1550+ . then ( ( ) => {
1551+ ganglionBLE . removeAllListeners ( k . OBCIEmitterImpedance ) ;
1552+ writeCodeToClientOfType (
1553+ client ,
1554+ kTcpTypeImpedance ,
1555+ kTcpCodeSuccess ,
1556+ {
1557+ action : kTcpActionStop
1558+ }
1559+ ) ;
1560+ } )
1561+ . catch ( err => {
1562+ writeCodeToClientOfType (
1563+ client ,
1564+ kTcpTypeImpedance ,
1565+ kTcpCodeErrorImpedanceCouldNotStop ,
1566+ {
1567+ message : err . message
1568+ }
1569+ ) ;
1570+ } ) ;
1571+ } , 2000 ) ;
15661572 break ;
15671573 }
15681574} ;
15691575
1576+
15701577const _processImpedanceWifi = ( msg , client ) => {
15711578 if ( wifi . getNumberOfChannels ( ) > k . OBCINumberOfChannelsGanglion ) {
15721579 _processImpedanceCyton ( msg , client ) ;
0 commit comments