Comments (12)
There are two things:
-
Make a resource to be observable (for example https://github.com/ARMmbed/java-coap/blob/master/coap-core/src/test/java/com/mbed/coap/observe/SimpleObservableResourceTest.java#L52)
-
Subscribe to a resource from RestAPI: https://docs.mbed.com/docs/mbed-device-connector-web-interfaces/en/latest/api-reference/
from java-coap.
If the value of an observable resource changed from client and then we need to push that new value to mbed server what should be done? This we are trying to do once we receive sensor data after a period of every 15 seconds.
We are using like this:
if(startedCoapServer != null && registrationManager != null) { SimpleObservableResource obsResourceX = new SimpleObservableResource("/AndroidDevice/Gravity/X", startedCoapServer); try { obsResourceX.setBody(gravityData[0] + ""); } catch (CoapException e) { e.printStackTrace(); } SimpleObservableResource obsResourceY = new SimpleObservableResource("/AndroidDevice/Gravity/Y", startedCoapServer); try { obsResourceY.setBody(gravityData[1] + ""); } catch (CoapException e) { e.printStackTrace(); } SimpleObservableResource obsResourceZ = new SimpleObservableResource("/AndroidDevice/Gravity/Z", startedCoapServer); try { obsResourceZ.setBody(gravityData[2] + ""); } catch (CoapException e) { e.printStackTrace(); } startedCoapServer.addRequestHandler("/AndroidDevice/Gravity/X", obsResourceX); startedCoapServer.addRequestHandler("/AndroidDevice/Gravity/Y", obsResourceY); startedCoapServer.addRequestHandler("/AndroidDevice/Gravity/Z", obsResourceZ); registrationManager.register(); }
This don't seems to be correct. Please help.
from java-coap.
What kind of problems do you get?
from java-coap.
After some time keeping the application idle, a 502 error is received, even though de-registration is not done.
from java-coap.
Logs please.
from java-coap.
Note also that I added observable resource to example-client: https://github.com/ARMmbed/java-coap/blob/dev/example-client/example-client/src/main/java/com/mbed/coap/example/DeviceEmulator.java#L85
from java-coap.
We are able to send data continously every 15 seconds. Is there any parameter we need to set so that this happens for atleast, let's say, 30 minutes or one hour, without any interruption?
from java-coap.
Well, just set your scheduler to send notification as often as you need.
from java-coap.
We keep on sending the data every 15 sec. After about 10 minutes or so testing in the mbed server console, clicking the Test Api button keeps on trying to fetch the data for get resources, but with no result.
What could be wrong?
When does the onNoObservers method get called?
from java-coap.
Could you attached device logs?
from java-coap.
Now we are using the endpoint name, server key etc. from the security.h file from mbed portal. Is there a way to programmatically create the security.h file or the required keys?
We found that same endpoint name and keystore cannot be used for multiple android devices.
Please help.
from java-coap.
I'm sure there is a way to make a (bash) script that would do the job automatically. Any collaboration is more than welcome :).
Is original issue solved? If so could we close this ticket?
from java-coap.
Related Issues (20)
- Adding the library HOT 1
- Example Server HOT 2
- [Potential] Security Vulnerabilities within java-coap HOT 12
- Multicast server example HOT 2
- Support for websockets HOT 1
- How is it possible to send messages from server to client? HOT 1
- Difference with californium project ? HOT 2
- Support for broadcast HOT 2
- Bound to other IP-Addresses HOT 1
- Message ID can crash the io loop. HOT 4
- Timeout trying to connect to arm mbed remote server HOT 38
- Jar on jitpack.io appears to be missing classes HOT 1
- Service hangs? HOT 1
- Socket Closed when stop() HOT 3
- No feature about coapclient to cancel observation about a coapresource
- Could java-coap using SSL with my own CA certificate? HOT 7
- Is this project active ? HOT 9
- Blockwise transfer
- How is the end point name generated? HOT 20
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from java-coap.