Connection WIFI module to ANDROID

0

In my company they are thinking of working through Android applications with different devices through WIFI. In my case, my job would be to take care of the Android part, the programming of the devices will correspond to someone else.

To do the tests, the WIFI module selected is the one on this board:

ATSAMW25-XPRO

Until now I had not worked with external devices, the idea that I had in mind would be to connect the board by serial port to my PC and from the mobile send a chain "hello world" that would receive by the PC. (Basically that's my job, send strings and have the module pass them to a micro).

Any suggestions on where to start? Any sample code to connect to the Device?

Greetings and thanks in advance.

    
asked by Sergio Cv 19.04.2016 в 10:19
source

1 answer

1

Check the site development guide link , I do not know if you expected to program in Java, but you have to do it in C.

In the guide comes an example to interact with Android through the SAMW25 board:

1) Initialize the socket module and create a TCP server socket.

addr.sin_family = AF_INET;
addr.sin_port = _htons((MAIN_WIFI_M2M_SERVER_PORT));
addr.sin_addr.s_addr = 0;
socketInit();
registerSocketCallback(socket_cb, NULL);
...
while (1) {
m2m_wifi_handle_events(NULL);
if (tcp_server_socket < 0) {
/* Open TCP server socket */
if ((tcp_server_socket = socket(AF_INET, SOCK_STREAM, 0))

Activates the AP mode before the main loop. (See the section "How to Run AP Mode" example):

ret = m2m_wifi_enable_ap(&strM2MAPConfig);

After connecting your device to the SAM W25 sends AP configuration, disables the AP mode connects the AP with the given information.

static void socket_cb(SOCKET sock, uint8_t u8Msg, void *pvMsg)
{
case SOCKET_MSG_RECV:
m2m_wifi_disable_ap();
nm_bsp_sleep(500);
m2m_wifi_connect((char *)str_ssid, …

2) Build the program and download it on the board.

3) Start the application.

If you want to use notifications you have to get the API key from link

Programming Guide for SAMW25

    
answered by 19.04.2016 в 19:25