Sockets on Wearos - Wear OS Q&A, Help & Troubleshooting

Is it possible to use IP/TCP to exchange data between a Wearos watch and a Smartphone?
From the following words in https://developer.android.com/training/wearables/data/data-layer I get the impression that is some how impossible:
"Warning: Because these APIs are designed for communication between handhelds and wearables, these are the only APIs you should use to set up communication between these devices. For instance, don't try to open low-level sockets to create a communication channel."

I have now tried low level sockets on Samsungs Wearos Watch4 and Linux send and recv syscalls work perfectly well. The problem I found is on the Android level, namely onAvailable(Network network) is never called, but onLost(Network network) is. This will give problems if you stop network operations after a call to onLost, you and start them again in onAvailable.
EDIT:
Now I also find onAvailable in my logs.

Related

Data Call between two XDA's

Hi
I am new to this form.
I had a look at the tsril.zip example as it seems from this forum that to make/receive a data call the ril is the only option. Unfortunately the documentation for ril is nonexistent and I want to ask if someone has done an example of a client/server data call, data transfer between to XDA's.
Thanks in advance.
Anton
It all depends on what type of data you want to transfer. I have never used RIL so I don't know the advantages of it, over the normal programming interface. I say normal, not thinking there is anything wrong with RIL but the little I do know is that RIL is operating system level and is normally hidden from the application programmer. There must be times when RIL must be used if Microsoft forgot functions in the normal APIs.
However I would say that for a data link between 2 devices then RAS seems the way forward. One device would be the Server and the other the Client. I have only ever programmed RAS from the client side, making a Telnet link to an already running server.
I just had a look at the help on Embedded Visual C++ 3.0 and under 'Creating a TCP Stream Socket Application' it explains the server side and then links to the client side. Have a read there.
RAS is not an option as it is a server consept, which I think does not even exist as a service on the desktop windows os let alone on a Pocket PC.
What I am looking for is something similar that you would be able to do with a landline modem or a gsm modem connected to a serial port of a pc (even a usb modem) which is to send AT commands to make/accept a call and then to make use of the serial port as if it is an io stream. This is possible on windows, linux using either c#, c++ or java. I can even do this with an embedded gsm module like the siemens TC45 java module.
What I can not understand is why Microsoft and the XDA suppliers (I am using a Qtex running Pocket PC 2002) is making it so difficult to make/answer a data call and let you run your own protocol over the connected stream.
RAS (Remote Access Services) is built into all Windows Operating Systems, including Windows CE. Did you look up the help example I pointed to ? What you do with RAS on an application level is for you to code but the connection itself is handled by the operating system.
As to making a connection similer to a modem and using AT commands. Then no you can't use AT commands directly, but you don't need to. To get that type of connection you need to use TAPI. Once Tapi has made a DATA_MODEM type connection, you use the TAPI callback connect event to then ask for a file handle that you can use with the normal WriteFile and ReadFile commands.
I already have something on this forum about that see:-
http://forum.xda-developers.com/viewtopic.php?p=7857&highlight=#7857
The problem is not so much making the data call but it is accepting/answering the data call that I can not get working on the XDA
Not sure if this is your problem, but in Australia they have a seperate "data" phone number for the same SIM. If yo call one number you get voice, if you call another number you get data on the same sim. Not sure if this may be effecting you.
I just looked into all this ras stuff a bit deeper, and yes I think I may of been talking rubbish. Although RAS does exist in PPC2002, it can't see any functions that allow the device to answer the line. I can see that PPC2003 has a Ras Server and RasIOControl that looks like the answer there.
Also looking into Tapi, I can't see how you answer a data call using that.
So I now understand your problem. It seems PPC is made as a client device.
Is GPRS the answer ? With that the link is always present and then you can use the built in Ras functions on seperate devices. Since you only pay for data actually sent then would it matter if the network link was always present ?
I have only worked out Tapi and Ras from the client side so I have never had this problem, but I agree it is an interesting one. I will have a bow out of this thread for a bit and see if anybody else knows how to Answer a Call.
Thanks for trying.
GPRS is also not the answer as you need a server in between that both XDA's can connect too and use as a router as the XDA's do not get fixed IP adresses but actually a NAT adres from the APN so you can not connect directly between the two.
Now that's an interesting thought, how about using some free web space to act as a pigion hole for your data ?
Believer: A seperate number? How do you know this, and what would the number be?
I can actually make two XDA connecting to each other using TCP. The trick is that I have one client always connect to a server to register it IP address with an ID. Then the caller send a query to the server to look up the callee's IP address.
In this way, accept() and connect() work fine.
I am using AT&T network and not sure about if other networks behave the same.
I wrote two application using TAPI. One is ModemDial and the other is ModemWatch, if I make a voice call the ModemDial dials the number successfully and ModemWatch reports that an incoming call exist. But when I change the behavior of call to DATAMODEM, the ModemWatch couldn't track any incoming call.
Is there any one, had some experience with pick a call for DataModem?
Best regards,
A. Riazi
riazi said:
I wrote two application using TAPI. One is ModemDial and the other is ModemWatch, if I make a voice call the ModemDial dials the number successfully and ModemWatch reports that an incoming call exist. But when I change the behavior of call to DATAMODEM, the ModemWatch couldn't track any incoming call.
Is there any one, had some experience with pick a call for DataModem?
Best regards,
A. Riazi
Click to expand...
Click to collapse
In your ModemWatch application make sure you are calling lineOpen with dwPrivileges (the 7th parameter, 1 based) equal to LINECALLPRIVILEGE_OWNER and dwMediaModes (the 8th parameter) equal to LINEMEDIAMODE_DATAMODEM.
If you're able to answer a voice call successfully, making these changes to the ModemWatch application should allow you to answer a data call.

XDA2:Is there some software handler possible on GSM voice?

There's a need in mobile PC/GSM device which allows to put a software filter on voice which is transmitted via GSM network when talking.
Can it be done on XDA2 and if not which models will you suggest?
The filtering needs to be done on digital signal not packed to GSM packets, in both directions, during the talk - in realtime.
Thanks in advance.
Re: XDA2:Is there some software handler possible on GSM voic
This is impossible on XDA1,2,3 and Anextek SP230. Probably this is a limitation of PocketPC 2003 (even SE) OS. Wait for a device with a PPC 2005, maybe it would support this.
sure
it IS possible.
but you must delete default Phone application and services. and then you can run your own implementation of phone features with filter or anything other inside the voice channels.
please note: default Phone is invoked by several services, you have to lock all these ways.

PC<->PPC application comms concurrently with GPRS conn

Hi,
I am trying to develop an application with both PC and Pocket PC components.
The PC and PPC need to exchange data whilst the PPC (eg XDA) has an active GPRS connection.
I first tried using evc and RAPI to allow the PC and PPC components to talk to each other. However RAPI relies on ActiveSync and it seems you cant have an ActiveSync connection to the PC (eg over USB) at the same time as a GPRS connection.
So
1)Am I right that ActiveSync at same time as GPRS is impossible? (And hence RAPI...)
2)What is the easiest way to do PC<->PPC comms without ActiveSync, on the widest variety of PPC devices?
3)Is there a way to do this without writing PC and PPC sides for all of
i) Bluetooth
ii) USB
iii) Serial
It seems like a lot of hardwork to reimplement all these, but some models have BT, some only USB etc etc
Any help appreciated...
Regards,
Giles.
hey,
im also trying to write some client -> server software for my mda/pc. Ive managed to narrow it down to two technologies (excluding activesync cos it needs to be portable)
- Web Services
- Client Server Model (tcpclient and tcplistener)
webservices are good as they will run on any net connection with port80 open, pretty fast and versetile but have some bad flaws. u need some back end data store (like a mysql database) as data is not persistant on then... also u cannot "push" from the server to the device (this may or may not be an issue)
the tcpclient model is starting to appeal to me in a number of ways. u can define your own light-weight protol (SOAP has a nasty habbit of bulking the objects out and GPRS costs!)... i started to write some little test apps and so far its looking good. Ive wrote a very tiny server that runs on windows and has a thin client running a threaded tcplistener and a mysql backend datastore. The test mobie simply constructs a tcpclient object and writes a string "hello world" to the port, which the server picks up and displays in a messagebox... so far this concept is working really well, and i have more control over the serialisation and communication of the objects and types.
i hope ive helped u in some way hehe
Will

Advice on the choice of querying a remote DB

Hello everyone,
I come to you for some advice about an application I'm developing for Android 1.6 and higher.
Specifically, this application must be able to query a remote MySQL database and display the retrieved data. It need also be able to UPDATE data on this databse and that is where things get complicated ...
For selection queries, I wrote a small PHP script on the remote server that retrieves the desired data in the database and encodes them in JSON. From my Android application, I have no problem to retrieve, process and display them.
Now I wonder about the solution (if there is one ...) to run UPDATE from my application on the remote database. For now, I see only two solutions:
- Develop a webService on the server with an update method. Several problems with that: it seems webServices on Android are not easy (not native, have to go through external libs). Moreover, as it's UPDATE query, I want to make sure nobody else can use this webService.
- Alternatively, write a PHP script that makes the UPDATE and call it via HTTP. Same problem as webService: I want to secure this call to be sure that only I can use this script. These scripts can be integrated into an application already present on my server and which is secured by login / password. So, if it is possible to manage PHP sessions from Android, it's won! but Ican't find anything about it ...
What do you think? Ideas?
Thx!

Simple multiplayer games

Hi,
I am trying to develop a simple Android game (like tic tac toe or some other simple board games) which allows people to play over the internet.
I'm initially trying this without having a server (i.e. client-to-client) and created a simple ServerSocket app that listens for a connection on a pre-defined port, to which I am able to connect to from my local pc (with redir on the emulator).
However on a actual device connected to a carrier network this does not seem to work (I believe they carriers is blocking incoming connections).
So does anyone know how we could achieve something like this on Android? Or what other options I should be looking into for this kind of networking?

Categories

Resources