Android bluetooth socket share throught activities - android-bluetooth

I have created an BT connection and I can successfully connect via BT with the other device and exchange messages. What I need is to use this socket in another activity. How can I do that? Thanks for all the help.

Related

How to connecting my web application to socket io in frappe (Docker local development)

So I want to connect my web application that was made from react to frappe. I have already installed the socket io client and connected it to the other socket io server. It was successful when I tried to connect socket io frappe(Docker local development). It always showed "Unable to join chat room. ECONNREFUSED 127.0.0.1:3002". Is there any guide to testing socket io from local? I have already read this wiki https://github.com/frappe/frappe/wiki/How-to-setup-Socketio-for-development-mode
but it's not solving my problem.
this is an error from socket io client
Please anyone help me, thank you in advance!

aws_sdk: how can I identify if my device is connected to the aws server

I have a device (esp32s2) which is IoT enabled and communicating with AWS server.
The device is connecting to the internet via router. I want to check from the device, if the router is connected to the internet or not. If not connected, I need to disconnect mqtt broker instantly.
I know there is aws_iot_yield happening, but it is taking too much of time to change the client state (~5-10 mins) after disconnection. So, is there is any other way in which I can come to know if the device is connected to the mqtt broker or not using AWS sdk?
I want to avoid using pinging to some address/server as it will increase the usage of resources.
Thanks in advance!
Since the connectivity to the AWS server trough internet depends on the network elements, the only reliable way to know if you are connected to internet is to send a package to a know address and receive the response. Simplest way to do this is to use ICMP (ping) protocol. Usually the most reliable destination to ping is the Google DNS server 8.8.8.8 or 8.8.4.4 which is a cluster service and it's always replying on the ping.
You can control the pause between two pings and how many pings you will send in one session in order to preserve the resources.
Alternative approach is to use a router that can send messages to a monitoring device that the link state was changed (by example SNMP trap). But this is not fully reliable method since the router can not detect all scenarios where the connectivity to your AWS server is lost.

How the client can know when the server send a message?

I will try to express it as good as a can. I need to create an online chat but NOT a group chat, but a private one.I mean i need a server where a lot of client can connect and each one of them can send a message to another client(if he knows his IP or Username). If the receiver is offline he will receive the message when he will connect to the serve(the easy part). If he is online he could do 2 jobs:
1.Send message to another client
2.Receive a message from another client.
My problem is how to interupt the sending process and tell the client that he has a new unread message?
I am looking up to use the SIGIO signal,but i am really not familiar.Am i in the right way?
PS:The server is running in an embedded system.

Client Server program using messages queues

I am trying to design a Client Server kind of application in which my Server is a daemon that accepts client requests, send client's data over a serial channel to the other side(which is an MCU and its firmware will reply to the Server request over the same serial channel). My client can be a CLI application or any other system program.
My idea of design is -
Use message queues for communication between Client and Server since this is a local application and message queues are bidirectional and fast.
Implement a LIBRARY that acts as an interface between multiple clients and the server. This basically does the stuff of packetizing client data into a message(own defined protocol), create message queues, connect to server, send/receive data and then pass it to the respective client(using call backs). This library also exposes API that can be used by clients. Thus this library gives me the flexibility to add support for any new clients keeping the server program unchanged.
Server gets the data over serial from other side and passes it to the library over message queue. The library uses callbacks to send data to the client.
EDIT:
I am thinking of creating Message queues on the fly when any client requests arrive. If I do this, how does the Server daemon(which has already started at linux boot up) gets information about this message queue? Does the message queue has a name that is persistent across and used by other programs? I want to implement clients that will be blocked until it gets response from the server.
Could you guys please review this design and tell me whether my approach is correct. Please reply if you have any other recommendations.
Thanks in advance.

Any reason why latency in updating timelineitem to my glass device?

i see latency issue - when i send a timelineitem from my glassware app, it takes a long time to appear on glass device.
I see the item in developer playground (https://developers.google.com/glass/playground)
Is it isolated issue on my WiFi (unlikely)? or some optimization done at Mirror server which queues timelineitems and sending in a specific interval to glass device?
Thanks
After doing some more investigation (In my case, i have setup private network inside enterprise network), i found out that some of the ports are blocked by firewall settings for incoming traffic from outside network, so glass device was not getting notifications from the Mirror Server.
It is possible either Channel API or XMPP is used in receiving notification messages from Mirror server to Glass. Those ports might have blocked by my firewall settings. I ran wireshark, still it is not clear which protocol or port is used in receiving notifications.
Also it is possible that glass device could get (HTTP GET) newly available cards from the mirror server by polling on specific time interval or other cases(changing WIFI network, etc).
I called Glass help, i could not get any feedback.
I would really appreciate if someone (from Google) could shed some light (port and protocol details) on how Glass gets notification from mirror server when new timeline card is available.
This is a known issue:
https://code.google.com/p/google-glass-api/issues/detail?id=185
Issue has been fixed by updating to XE10.

Resources