kumuda
Posts: 8
Joined: Thu Feb 20, 2020 1:07 pm

How to transmit data trough an access point without protocol

Mon Feb 24, 2020 1:01 pm

Hi,

I have one Rpi and mobile app. I setup Rpi as access point after that mobile app connected successfully with Rpi.

My question is after successful connection RPi want to send one message to mobile app " I am successfully connected ". How to send this acknowledgement message to mobile app.

Please help me in this

User avatar
topguy
Posts: 6463
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: How to transmit data trough an access point without protocol

Mon Feb 24, 2020 1:05 pm

What kind of phone ? If the app is running on the phone it is the phones operating system that should inform the app that the phone is now connected to a WiFi.

kumuda
Posts: 8
Joined: Thu Feb 20, 2020 1:07 pm

Re: How to transmit data trough an access point without protocol

Tue Feb 25, 2020 4:57 am

Thanks for your reply.

We are developing one android app . That app wants to connect to RPi access point once it connected successfully the mobile app want some authentication like successfully connected message from RPi side

Why we want this because after that mobile app want to start TCP/ip socket communication so it need IP address and port number . By authentication i need to send ip address and port number .

Or else i need without any protocol how to send data over access point

PhatFil
Posts: 1672
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: How to transmit data trough an access point without protocol

Tue Feb 25, 2020 7:02 am

you will probably have to employ some protocols, but you can probably not need to get too involved with the mechanics unless you want to

mqtt would probably be the easiest to implement and use. you would only need to install a broker and some tools with a couple of apt install commands.

Using a python script to publish the data from your Pi should be straight forward enough
http://www.steves-internet-guide.com/pu ... tt-client/


UDP could work too if you can determine the phones ip addy so you can send the data directly..

User avatar
topguy
Posts: 6463
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: How to transmit data trough an access point without protocol

Tue Feb 25, 2020 10:06 am

kumuda wrote:
Tue Feb 25, 2020 4:57 am
- That app wants to connect to RPi access point.
- once it connected successfully the mobile app want some authentication like successfully connected message from RPi side
I'm pretty sure the app can tell Android that it wants to connect to the AP, and Android will probably do it and should afterwards also be able to tell you the status of the Wifi connection and which IP it was assigned. That should be enough IMO.

kumuda
Posts: 8
Joined: Thu Feb 20, 2020 1:07 pm

Re: How to transmit data trough an access point without protocol

Tue Feb 25, 2020 11:20 am

1) How RPI access point will get to know it connected to some device. Is any interrupt mechanism is there

2)How to get to know which are the devices is connected to RPi access point.

User avatar
topguy
Posts: 6463
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: How to transmit data trough an access point without protocol

Tue Feb 25, 2020 12:39 pm

What are you really trying to make/do ?
Has the app no other purpose than to connect to the RPi AP ?

There is a command "hostapd_cli" that can print informatiion about connected clients.

kumuda
Posts: 8
Joined: Thu Feb 20, 2020 1:07 pm

Re: How to transmit data trough an access point without protocol

Tue Feb 25, 2020 12:50 pm

topguy wrote:
Tue Feb 25, 2020 12:39 pm
What are you really trying to make/do ?
Has the app no other purpose than to connect to the RPi AP ?

What actually i wants is once the RPi access point with any device suddenly i want to sent success message in that message i want to broadcast my RPi ip address

There is a command "hostapd_cli" that can print informatiion about connected clients.
Thanks for your reply

instead of command in which path that information will available

User avatar
topguy
Posts: 6463
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: How to transmit data trough an access point without protocol

Tue Feb 25, 2020 1:24 pm

want to broadcast my RPi ip address
Why ? There are better ways of letting the app know the ip-address..
- use "raspberrypi.local" or https://developer.android.com/training/ ... lessly/nsd
- use DNS.
- use the gateway address for the Wifi connection and assume that this is the Pi address.

PhatFil
Posts: 1672
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: How to transmit data trough an access point without protocol

Tue Feb 25, 2020 11:25 pm

Most command line commands that produce cli output and terminate can have their output (stdout) redirected to a file for further programmatic analysis Using the ">" and ">>" redirect operators
">" will overwrite/create the file while
">>" will append to an existing file and create it if not there..

Code: Select all

$ ls -l > /home/pi/directorylist.txt
or

Code: Select all

$ ls -l >> /home/pi/directorylist.txt


so

Code: Select all

$ hostapd_cli > /home/pi/myapp/WifiClientList.txt
should save the hospad_cli output to a file you can open and process...

also look up stderr output too..

kumuda
Posts: 8
Joined: Thu Feb 20, 2020 1:07 pm

Re: How to transmit data trough an access point without protocol

Wed Feb 26, 2020 4:41 am

1) What actually i wants is once the RPi access point is connected with any device suddenly i want to sent success message to that device in that message i want to broadcast my RPi ip address.

2) Once RPi access point connected to any device i want to generate an interrupt . how to do this

User avatar
DougieLawson
Posts: 38854
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How to transmit data trough an access point without protocol

Wed Feb 26, 2020 12:08 pm

kumuda wrote:
Wed Feb 26, 2020 4:41 am
1) What actually i wants is once the RPi access point is connected with any device suddenly i want to sent success message to that device in that message i want to broadcast my RPi ip address.

2) Once RPi access point connected to any device i want to generate an interrupt . how to do this
You can't. Your approaching this from the wrong direction. An access point is network layer two.
http://www.steves-internet-guide.com/in ... explained/
Part of connecting at layer two already sends your IP address to the client system.

For messaging you need a service running at network layer four. That could be a webserver or [better] an MQTT broker.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Return to “Beginners”