Photon softAP usage?

I am trying the SoftAP on 0.4.7, when I point the browser to 192.168.0.1/ I get a blank page r"=-1}

@hine the link is broken, can you please repost the code?

Thanks

Here is a different version that I stripped out of the app we are building. Let me know if it works!

thanks iā€™ll download it and check it outā€¦

I am working on a C# Photon setup library. I am using the HTTP commands for setup [enter link description here][1]

[1]: https://github.com/spark/firmware/blob/develop/hal/src/photon/soft-ap.md "docs"When I call configure-ap and connect-ap I get resturn code 0, but the photon still breathing blue and not connecting to the WiFi network. Wy do you think itā€™s not connecting?
Steps:

  1. Scan APs
  2. Get public key
  3. Configure selected AP with password (encrypted using public-key)
  4. connect-ap

Thanks

hey @msolters,

your meteor advertising campaign finally came to frution :stuck_out_tongue: (at least in my case).

Iā€™m a JS beginner but have knowledge in other programming languages so hopefully i get to it.

I successfully cloned your (amazing!) git and it worked, However - since i am a beginner i am not so comfortable with coffe script neither with the rather ā€œadvancedā€ project structure i decided to start from scratch - which is better for learning purposes anyways.

I am already able to call functions on my photons - which is great - but iā€™m struggling to include the softap-js solution.

When i include the softap.browserify.js with

SoftAPSetup = require("softap-setup");

i get the follwing errors

W20160105-11:07:51.969(0)? (STDERR)           
W20160105-11:07:51.972(0)? (STDERR) /home/ubuntu/.meteor/packages/meteor-tool/.1.1.9.ltydx3++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
W20160105-11:07:51.972(0)? (STDERR)                                             throw(ex);
W20160105-11:07:51.972(0)? (STDERR)                                                   ^
W20160105-11:07:52.384(0)? (STDERR) TypeError: undefined is not a function
W20160105-11:07:52.384(0)? (STDERR)     at Object.<anonymous> (../../../../../.meteor/packages/cosmos_browserify/.0.8.2.t3wlc6++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/CosmosBrowserify/node_modules/browserify/node_modules/stream-http/lib/capability.js:9:1)
W20160105-11:07:52.385(0)? (STDERR)     at Object.<anonymous> (../../../../../.meteor/packages/cosmos_browserify/.0.8.2.t3wlc6++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/CosmosBrowserify/node_modules/browserify/node_modules/stream-http/lib/capability.js:41:1)
W20160105-11:07:52.385(0)? (STDERR)     at s (../../../../../.meteor/packages/cosmos_browserify/.0.8.2.t3wlc6++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/CosmosBrowserify/node_modules/browserify/node_modules/browser-pack/_prelude.js:1:1)
W20160105-11:07:52.385(0)? (STDERR)     at ../../../../../.meteor/packages/cosmos_browserify/.0.8.2.t3wlc6++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/CosmosBrowserify/node_modules/browserify/node_modules/browser-pack/_prelude.js:1:1
W20160105-11:07:52.385(0)? (STDERR)     at Object.<anonymous> (../../../../../.meteor/packages/cosmos_browserify/.0.8.2.t3wlc6++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/CosmosBrowserify/node_modules/browserify/node_modules/stream-http/lib/request.js:2:1)
W20160105-11:07:52.386(0)? (STDERR)     at Object../capability (../../../../../.meteor/packages/cosmos_browserify/.0.8.2.t3wlc6++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/CosmosBrowserify/node_modules/browserify/node_modules/stream-http/lib/request.js:279:1)
W20160105-11:07:52.386(0)? (STDERR)     at s (../../../../../.meteor/packages/cosmos_browserify/.0.8.2.t3wlc6++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/CosmosBrowserify/node_modules/browserify/node_modules/browser-pack/_prelude.js:1:1)
W20160105-11:07:52.386(0)? (STDERR)     at ../../../../../.meteor/packages/cosmos_browserify/.0.8.2.t3wlc6++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/CosmosBrowserify/node_modules/browserify/node_modules/browser-pack/_prelude.js:1:1
W20160105-11:07:52.387(0)? (STDERR)     at Object../lib/request (../../../../../.meteor/packages/cosmos_browserify/.0.8.2.t3wlc6++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/CosmosBrowserify/node_modules/browserify/node_modules/stream-http/index.js:1:1)
W20160105-11:07:52.387(0)? (STDERR)     at s (../../../../../.meteor/packages/cosmos_browserify/.0.8.2.t3wlc6++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/CosmosBrowserify/node_modules/browserify/node_modules/browser-pack/_prelude.js:1:1)
=> Exited with code: 8
=> Your application is crashing. Waiting for file change.

Maybe you can help? Or am i supposed to include the whole locally browserified file? (which at least @ c9.io takes like forever to compile)

Thanks in advance for a short hint.

edit: iā€™m using meteor 1.2.0.2 and tried browserify 0.8.1 & 0.8.2

First off, letā€™s try to keep sidebar discussions off the main thread here ā€“ itā€™s epic enough as-is. Feel free to message me or to open an issue on the GitHub repo itself.

That being said, thereā€™s two things you may be missing if youā€™re starting from scratch. Basically, to use cosmos:browserify to browserify an NPM package, you need to already have that NPM package.

  1. Install the NPM package for Meteor:

    meteor add meteorhacks:npm
    
  2. Define the NPM packages you need! Just make a packages.json file in your project root directory, and inside declare a JSON object containing each NPM packageā€™s name (key) and an explicit version number (value). Hereā€™s what mine looks like ā€“ the magic happens in line 3.

  3. For any package from the above list you want browserified, add a JS file to the client with the naming format packagename.browserify.js. Again, hereā€™s mine: https://github.com/msolters/softap-setup-meteor/blob/master/client/softap.browserify.js. Note: The naming of this file is important ā€“ it must end in .browserify.js, and secondly, do not load it on the server side! Put it under the /client dir of your project.

  4. Finally, add the cosmos:browserify package. It will tick through your files that end like .browserify.js, find the dependencies, and browserify them.

2 Likes

That did the trick! (started off with a root folder only solution - so no client or server folders) Thank you!

Hi all! Long-time, no-post. Got sidetracked on other projects and wasnā€™t working as actively on this one :smile:

Iā€™ve noticed the following issues with a browserified v3.0.2:

My Nexus 5 (Android 6.0.1) seems to just fail silently with no error message. The request just times out and nothing happens. I havenā€™t dug any deeper than that, but using @mebrunetā€™s vanillaJS implementation fails with a status code of 0 on the xmlhttp object.

Edit: It gets stranger! The Nexus 7 running the same version of Android works fine as well.

I noticed thereā€™s a different RSA library being used. The one that comes with the browserified soft-ap.js seems to crash on older versions of iOS (e.g. our iPhone 4 running 7.1.2). Iā€™ll be borrowing that :wink:

Anyone else having the Android issue?

I am getting {ā€œrā€:-1040} when I post the data to the ā€œconfigure-apā€ function. What does this error mean?

1 Like

The error -1040 (=-0x0410 =TROPICSSL_ERR_RSA_INVALID_PADDING) is returned when trying to decrypt the AP password on the latest iOS SDK.

I noticed the error was caused when a new device key-pair was created. In particular, the iOS app was not replacing the old device public key with the new one.

An interesting take by Google on this type of functionality :

Hello mebrunet, i realise this thread is old but i just where wondering.

Instead of flashing the firmware would it not be possible to use your connect html file
and host it on the Photon with help of the webserver library?

Maybe when connecting to the webserver via a webbrowser there is a index.htm with a link to the connect.htm.

What i was thinking of is that a client that do not have internet access can connect to the photons webserver and it opens the main page which shows the values i want to show from my photon and also use your connect file to connect the Photon.

I have not tried this yet but was thinking before i fall a sleep that this should be possible and i donā€™t have to do anything with the firmware.

What do you say about that?

BR
Dimi

@ido
Does that require a Wifi router or can 2 photons establish a connection and transmit data without Wifi? Do you know of any sample code/documentation to get started? Iā€™m new to this.

To clarify, I want to be able to send data from one photon to another via softAP/Wifi-Direct without using Wifi. So basically I'm wondering if it is necessary for a client to have WiFi in order for 2 photons to share information. Can the photons establish this type of connection?

It was stated that this was on the roadmap but I have not found any updates.

Can you please advise?

Hi
Did any reply to this - I have the same issue - I want to use 2-legged auth to associate a new customer with a photon. The SoftAP works fine (thanks @mebrunet). The photon connects fine, but I presume a claim code has already been used by this time and the device is connected to my account? I now need to reassign to a specific customer. Has anyone attempted this?

Thanks

Kevin

3 posts were merged into an existing topic: Configure wifi (only) via website and/or app: please help

This might be interesting in this regard
https://github.com/spark/firmware/pull/906

That is milestoned for 0.5.0, which should go public not too far from now.
https://github.com/spark/firmware/milestones


Sorry that reply was moved due to a double post redact

Hi,

I am confused as to how to use softap-setup-js ( https://github.com/spark/softap-setup-js )
I want to set photon as an access point to directly communicate with a phone. I have node.js, can use particle cli to connect to networks, but want to use photon without an external network. So I installed softap with ( npm install softap-setup ) but I canā€™t be able to use anything from the repo. I keep getting a terminal error: -bash: syntax error near unexpected token `(ā€™

I also tried using Meteor version of this library (https://github.com/msolters/softap-setup-meteor)
Here, the browser opens, and although I am to the photon wireless network with my computer, I get a red error at the bottom saying: "We werenā€™t able to find a Photon! ā€¦ "
The console displays these while I do so:
I20160330-20:07:59.457(3)? WiFiControl: Automatically located wireless interface en0.
I20160330-20:08:00.949(3)? INFO electrify:plugins: acquire
I20160330-20:08:00.949(3)? INFO electrify:plugins:mongodb: acquiring mongo
I20160330-20:08:00.950(3)? INFO electrify:plugins:nodejs: acquiring nodejs
I20160330-20:08:00.950(3)? INFO electrify:plugins: start
I20160330-20:08:00.950(3)? INFO electrify:plugins:mongodb: app in development mode, skipping start
I20160330-20:08:00.952(3)? INFO electrify:plugins:nodejs: app in development mode, skipping start
I20160330-20:08:00.954(3)? INFO electrify:app: ensuring electrify dependencies
I20160330-20:08:01.571(3)? INFO electrify:electron: launching electron
I20160330-20:08:04.558(3)? WiFiControl: Scanning for nearby WiFi Access Pointsā€¦
I20160330-20:08:07.967(3)? WiFiControl: Nearby WiFi APs successfully scanned (17 found).

@emilkl - Interesting idea. But does the user code run in SoftAP mode? I didnā€™t think so. If not, then this strategy would only be useful when the Photon already has credentials.