Bluetooth SPP

Hello all,
Newby programmer here and I have a question about Bluetooth SPP in Enyo 2.0. Right now I have an app programed in Enyo 1.0 that uses Bluetooth SPP similar to the GPS example in the SDK and I would like to rewrite it using 2.0. I have been searching on here and the rest of the web and I can’t find anywhere if it is still possible to access the Bluetooth services in Enyo 2.0. Has that feature been removed from Enyo 2.0? If not, does it work the same way as it does in 1.0?
Thanks!
-J

Comments

  • Enyo 2 doesn't have built-in support for webOS services, as that's outside the scope of a cross-platform UI framework. However, we've been maintaining a webOS version of Cordova at https://github.com/webOS-DevRel/cordova-js that has code for doing service calls.
  • Okay, thanks! On looking over that link I am seeing code for other webOS services such as camera, accelerometer etc. but no mention of Bluetooth service. Am I missing something? I am still wrapping my head around the whole enyo/cordova thing so maybe I am looking right at the answer to my question.
  • The Bluetooth service wasn't specifically supported by Enyo -- it's on the Luna Service Bus, and you send it messages and get responses just like any other service.

    Cordova does wrap some of the webOS services specifically where they map to things on other platforms too, but there's no specific Cordova support for Bluetooth SPP.
  • Okay, thanks so much for your help! I will keep working to educate myself on all of this. I am thinking the only way to get Bluetooth support over different platforms is to build using native code rather than using a cross-platform framework.
  • Yeah, there's no standard web framework for that; it's all specific to the OS.
  • Got it, thank you so much for your time!
  • I know this is a different topic so I can start a new thread if needed.

    I have a flot graph in my app and I would like to be able to click on the data points and retrieve the series and datapoint I clicked on. Here is a fiddle example with the jquery alert showing the data I need.

    http://jsfiddle.net/UncleJ/cdMLt/6/

    I am not sure how to get that info over to the main ex.app kind. Any thoughts? I know I am probably looking right at the answer in the documentation but it is not clicking in my head how to do that.

    Thanks for any thoughts!
  • Thanks, I did see that discussion before but that is for 2.0 if I am not mistaken. My app is in enyo 1.0, does that make a difference?
  • Ya, enyo.dispatcher.listen doesn't exist in 1.0.

    Try document.addEventListener("plotclick", enyo.dispatch, false) like it's used here
  • Sorry for my ignorance but where would be the right place to put that line? I have been trying everything I can think of and now I am not even sure what I need and where I need it. I really do appreciate all the help but for some reason the whole event/handler thing has me so confused.
  • After enyo.js is loaded. If you have a main view that you render into the document.body, you could override its create method to do it:
    create: function() {
       this.inherited(arguments);  // make sure the regular create method runs
       document.addEventListener("plotclick", enyo.dispatch, false);
    }
  • edited February 2014
    That should work. You could also use enyo.requiresWindow() and put it outside of a kind to ensure it only ran once.
    enyo.requiresWindow(function() {
      document.addEventListener("plotclick", enyo.dispatch, false);
    });
    
  • Ok, great! So like this? http://jsfiddle.net/UncleJ/cdMLt/7/

    Am I missing something else?
  • nope, seems right to me.
  • hmm, seems I am still not getting a response when clicking on the graph. I must be missing something. Kind of a mystery to me. :/
Sign In or Register to comment.