Sounds great! I had a little try last night with something that'd grab a URL, pull data out of it and broadcast it. The BLE code you need is:
BluetoothManager mBluetoothManager = (BluetoothManager)mContext.getSystemService(Context.BLUETOOTH_SERVICE); BluetoothAdapter mBluetoothAdapter = mBluetoothManager.getAdapter(); BluetoothLeAdvertiser mBluetoothLeAdvertiser = mBluetoothAdapter.getBluetoothLeAdvertiser(); AdvertiseSettings.Builder settingsBuilder = new AdvertiseSettings.Builder(); settingsBuilder.setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_BALANCED); // was ADVERTISE_MODE_LOW_POWER settingsBuilder.setTimeout(0); // always! //setTxPowerLevel(ADVERTISE_TX_POWER_HIGH.) AdvertiseSettings settings = settingsBuilder.build(); AdvertiseData.Builder dataBuilder = new AdvertiseData.Builder(); dataBuilder.addManufacturerData(0x0590, foundData.getBytes()); //dataBuilder.setIncludeDeviceName(true); AdvertiseData data = dataBuilder.build(); mAdvertiseCallback = new SampleAdvertiseCallback(); mBluetoothLeAdvertiser.stopAdvertising(mAdvertiseCallback); mBluetoothLeAdvertiser.startAdvertising(settings, data, mAdvertiseCallback);
@Gordon started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Sounds great! I had a little try last night with something that'd grab a URL, pull data out of it and broadcast it. The BLE code you need is: