rzr / generic-sensors-lite

Naive implementation of w3c specs for IoT.js
https://purl.org/rzr/sensors
Apache License 2.0
10 stars 6 forks source link

Add a basic Geolocation Sensor API simulator #6

Closed Vinnl closed 5 years ago

Vinnl commented 5 years ago

Not sure how useful this is, nor exactly how to check whether this suits requirements, but... I think this is what you were looking for.

Fixes #4.

Vinnl commented 5 years ago

Could be improved

Then maybe add an index.js to abstract that simulator controller link done in:

You can copy this file to simulator/index.js https://github.com/SamsungInternet/color-sensor-js/blob/master/example/index.js

and then adjust ...

I don't see anything about a simulator in that file... Did you mean to link to this, perchance? https://github.com/SamsungInternet/color-sensor-js/blob/master/lib/index.js

rzr commented 5 years ago

try to rebase and squash commits and it should be good

Vinnl commented 5 years ago

Thanks for the controller skeleton, that helped me to understand what you needed there :)

Vinnl commented 5 years ago

With "clean style patch" do you mean "squash it all into a single commit"?

Vinnl commented 5 years ago

Ah, I see. The only errors I get on master, though, are about throwing literals, the unexpected console.log I'm still seeing on this branch, and about unimplemented code - the fixes to which are to actually implement it. The only linting error that was there before my changes is the function statement vs. declaration; I can rebase the fix for that?

rzr commented 5 years ago

Ah, I see. The only errors I get on master, though, are about throwing literals, the unexpected console.log I'm still seeing on this branch, and about unimplemented code - the fixes to which are to actually implement it. The only linting error that was there before my changes is the function statement vs. declaration; I can rebase the fix for that?

yea rebase is the way ;) actually many developers miss that awesome feature of git

Vinnl commented 5 years ago

Alright, I fixed that error with an earlier commit. Couldn't live without rebase :)

Vinnl commented 5 years ago

Alright, I've added it to /lib/index.js, but can't test it ("Error: Cannot find module '../build/Release/i2c'").

rzr commented 5 years ago

Ok I tested it seems to work except that it misses the type in constructor it should be 'geolocation' , also console.log are using "log: ..." prefix, I can merge now until you want to squash that upcoming fix. Then I will have release a package to NPM Thanks again for your patience

try:

npm install
node lib
rzr commented 5 years ago

Sorry to bother but also please can you sign your commit like I did

https://stackoverflow.com/questions/1962094/what-is-the-sign-off-feature-in-git-for

Vinnl commented 5 years ago

They actually were signed, I just hadn't told GitHub about my GPG key yet :) I have now, and prefixed log: to the log and added the type to the sensor.

Vinnl commented 5 years ago

Ah good catch, I did not mean to commit that - removed. I've also added the prefix.

And not to worry; it helps that I'm not actually using this package, so I'm not in a hurry ;)

rzr commented 5 years ago

Congratulation ;-)

For anyone inspired in this

I'll leave a couple of suggestions at: https://github.com/rzr/generic-sensors-lite/issues/4