I'm writing a Google Glass Development book for Apress and just finished the chapter Network and Bluetooth, with some working samples to let Glass communicate with iPhone for data transfer. You're right that Glass as of now (API level 15) doesn't support Bluetooth Low Energy (BLE). I have implemented three ways to make the data transfer between Glass and iOS happen:
Let Glass talk to an Android device, such as Nexus 7 with Android 4.3 or above with BLE support, via Classic Bluetooth or socket, and Nexus 7 acts as a BLE central to talk to iOS as a BLE peripheral. Notice you shouldn't use BLE to send large data such as photo.
Let Glass talk to iOS directly via socket - you can use C socket code running as a server and Glass Java socket client, or vice versa. This would require your Glass and iOS device on the same Wifi, but can transfer large data.
Use a server-based solution - upload data from Glass to a server and let iOS get it via Apple Push Notification. I used this method to share photos on Glass with friends on WhatsApp and WeChat, both apps run on iOS.
Sample iOS code acting as socket server:
- (void) runSocketServer {
int listenfd = 0;
__block int connfd = 0;
struct sockaddr_in serv_addr;
__block char sendBuff[1025];
listenfd = socket(AF_INET, SOCK_STREAM, 0);
memset(&serv_addr, '0', sizeof(serv_addr));
memset(sendBuff, '0', sizeof(sendBuff));
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
serv_addr.sin_port = htons(6682);
bind(listenfd, (struct sockaddr*)&serv_addr, sizeof(serv_addr));
listen(listenfd, 10);
dispatch_async(dispatch_get_global_queue(0, 0), ^{
connfd = accept(listenfd, (struct sockaddr*)NULL, NULL);
int count = 1;
while (count++ < 120) {
char rate[100];
sprintf(rate, "%i\n", bpm);
write(connfd, rate, strlen(rate));
sleep(1);
}
close(connfd);
});
}
Sample Glass code acting as a socket client:
public void run()
{
String serverName = "192.168.1.11";
int port = 6682;
try
{
socket = new Socket(serverName, port);
BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream()));
do {
result = input.readLine();
runOnUiThread(new Runnable() {
public void run() {
mTvInfo.setText(result);
}
});
} while (result != null);
});
}
catch(Exception e) {
try { socket.close(); }
catch (Exception e2) {};
e.printStackTrace();
}
}