@@ -286,7 +286,12 @@ public void actionPerformed(ActionEvent arg0) {
286286 }
287287
288288 try {
289- ShimmerDevice device = btManager .getShimmerDeviceBtConnected (btComport );
289+ ShimmerDevice device = btManager .getShimmerDeviceBtConnectedFromMac (btComport );
290+ if (btComport .contains (PREFIX_COM ) || btComport .contains (PREFIX_DEV )) {
291+ device = btManager .getShimmerDeviceBtConnected (btComport );
292+ } else {
293+ device = btManager .getShimmerDeviceBtConnectedFromMac (btComport );
294+ }
290295 if (device instanceof VerisenseDevice ) {
291296 ((VerisenseDevice )device ).startStreaming ();
292297 }else {
@@ -418,7 +423,7 @@ public void actionPerformed(ActionEvent e) {
418423 frame .getContentPane ().add (lblFilePath );
419424
420425 chckbxWriteDataToFile = new JCheckBox ("Write Data to File" );
421- chckbxWriteDataToFile .setBounds (829 , 185 , 242 , 23 );
426+ chckbxWriteDataToFile .setBounds (829 , 185 , 116 , 23 );
422427 chckbxWriteDataToFile .addItemListener (new ItemListener () {
423428 public void itemStateChanged (ItemEvent e ) {
424429 if (e .getStateChange () == ItemEvent .SELECTED ) {
@@ -429,6 +434,46 @@ public void itemStateChanged(ItemEvent e) {
429434 }
430435 });
431436 frame .getContentPane ().add (chckbxWriteDataToFile );
437+
438+ JButton btnStartSDLogging = new JButton ("START SD" );
439+ btnStartSDLogging .addActionListener (new ActionListener () {
440+ public void actionPerformed (ActionEvent e ) {
441+ ShimmerDevice device = btManager .getShimmerDeviceBtConnectedFromMac (btComport );
442+ if (btComport .contains (PREFIX_COM ) || btComport .contains (PREFIX_DEV )) {
443+ device = btManager .getShimmerDeviceBtConnected (btComport );
444+ } else {
445+ device = btManager .getShimmerDeviceBtConnectedFromMac (btComport );
446+ }
447+ if (device instanceof VerisenseDevice ) {
448+ ((VerisenseDevice )device ).startSDLogging ();
449+ }else {
450+ ((ShimmerBluetooth )device ).startSDLogging ();
451+ }
452+ }
453+ });
454+ btnStartSDLogging .setBounds (951 , 181 , 91 , 31 );
455+ frame .getContentPane ().add (btnStartSDLogging );
456+
457+ JButton btnStopSd = new JButton ("STOP SD" );
458+ btnStopSd .addActionListener (new ActionListener () {
459+ public void actionPerformed (ActionEvent e ) {
460+
461+ ShimmerDevice device = btManager .getShimmerDeviceBtConnectedFromMac (btComport );
462+ if (btComport .contains (PREFIX_COM ) || btComport .contains (PREFIX_DEV )) {
463+ device = btManager .getShimmerDeviceBtConnected (btComport );
464+ } else {
465+ device = btManager .getShimmerDeviceBtConnectedFromMac (btComport );
466+ }
467+ if (device instanceof VerisenseDevice ) {
468+ ((VerisenseDevice )device ).stopSDLogging ();
469+ }else {
470+ ((ShimmerBluetooth )device ).stopSDLogging ();
471+ }
472+
473+ }
474+ });
475+ btnStopSd .setBounds (1043 , 181 , 82 , 31 );
476+ frame .getContentPane ().add (btnStopSd );
432477
433478 plotManager .setTitle ("Plot" );
434479 }
@@ -514,6 +559,8 @@ protected void processMsgFromCallback(ShimmerMsg shimmerMSG) {
514559 ShimmerDevice device = btManager .getShimmerDeviceBtConnectedFromMac (btComport );
515560 if (btComport .contains (PREFIX_COM ) || btComport .contains (PREFIX_DEV )) {
516561 device = btManager .getShimmerDeviceBtConnected (btComport );
562+ } else {
563+ device = btManager .getShimmerDeviceBtConnectedFromMac (btComport );
517564 }
518565
519566 if (device instanceof VerisenseDevice ) {
0 commit comments