Infrared + mobile phone programming

xiaoxiao2021-03-05  21

Infrared mobile phone programming

Write a small program with infrared and mobile phone docking

1: Irsocket mode.

The VC6 has no comes with an AF_IRDA.H file, and it will go to (http://www.cswl.com/whitepppr/white/rhead.html).

Programming is very simple, with the general Socket not much difference, the address structure uses sockaddr_irda, create Socket with socket (Af_IRDA, SOCK_STREAM, 0);

There is also a Client and Server terminal. You can discover the nearby infrared equipment in the Client side.

DeviceList Devlist;

GetSockopt (SOCK, SOL_IRLMP, IRLMP_ENUMDEVICES, (CHAR *) & devList, & l)

Successfully discovered my phone. But could not connect, the phone itself may not support the Irsock mode.

This approach may compare the case where the infrared parties support Irsock can establish communication of the C / S structure.

Nice Irsock Programming Articles (English): Programming with Infrared Sockets - WhitePaper

2: IRCOMM

To http://www.ircomm2k.de/ Download the infrared port to simulate the driver and installation of the serial port. There are more serial ports to the system. This allows you to connect the infrared device with a standard serial program ..

Through the IRCOMM method, use the previously written mobile phone control code, send the AT command to query mobile information, send / receive SMS, query address book, dial, and no problem.

转载请注明原文地址:https://www.9cbs.com/read-36796.html

New Post(0)