I had developed ios for write/read the data from LE device . Now I need to build a android app for write and get the data from same le device.
I already connected the Le device,but is will show status code is 6 or 129 when I write the data to remote device. and it never invoke Onchar...Change() callback.
So , Could you advise how I can get the data from LE device.
PS: I using S4 ,Android4.2.2, samsung BLE 2.0 SDK.
Related
I've been trying to register a device instance on Google Assistant SDK on my Raspberry Pi 3.
Here is my input code
googlesamples-assistant-devicetool --project-id RASPI-ED53D register --model RASPI-ED53D-LIGHT-7NBZNA --type OUTLET --manufacturer SUPERCONN --product-name LIGHT --device 0001 --client-type LIBRARY
Output/Error
Creating new device model
Error: Failed to register model: 400
Could not create the device model. Check that the request contains the required field project_id with a valid format in the request payload. See https://developers.google.com/assistant/sdk/reference/device-registration/model-and-instance-schemas for more information.
The syntax is correct according to the google resources.
Any ideas?
The schema lists action.devices.types.OUTLET, not OUTLET.
When I list my devices, they have similar types specified, e.g.:
Device Type: action.devices.types.SPEAKER
I'm starting to migrate my GoogleCast integration from v2 to v3.5 on iOS when I run your code lab sample I always receive the current errors:
CastVideos-ios[436:35929] -[GCKDeviceAuthChannel didReceiveBinaryMessage:] Device is revoked by CRL.
CastVideos-ios[436:35929] -[GCKCastDeviceConnector deviceAuthChannel:didFailToAuthenticateWithError:] Not an authentic device, disconnecting.
Obviously the videos are not casting to my Chromecast 2.
I'm using the kGCKMediaDefaultReceiverApplicationID to initialize the GCKCastContext
We recommend that you take a look at the sample app on how to correctly integrate the Cast SDK with your app: https://github.com/googlecast/CastVideos-ios
It is very important that you support the Cast lifecycle correctly.
I have previously paired with a Bluetooth device that supports RFCOMM.
When my app is opened I continuously try to connect to the device by opening the RFCOMM. This way my app automatically connects when the device comes in range.
deviceInfoCollection = await DeviceInformation.FindAllAsync(RfcommDeviceService.GetDeviceSelector(RfcommServiceId.SerialPort));
LogData(String.Format("Number of mldp devices is {0}", deviceInfoCollection.Count));
foreach (DeviceInformation deviceInfo in deviceInfoCollection)
{
LogData(String.Format("ID:{0}, NAME:{1}", deviceInfo.Id, deviceInfo.Name));
}
Then run this on a timer:
try
{
// The first time this method is invoked by a store app, it should be called
// from a UI thread in order to display the consent prompt
// https://msdn.microsoft.com/en-us/windows.devices.bluetooth.rfcomm.rfcommdeviceservice.fromidasync
RfcommDeviceService rfcommService = await RfcommDeviceService.FromIdAsync(deviceInfo.Id);
LogData(String.Format("ID:{0}, NAME:{1}", deviceInfo.Id, deviceInfo.Name));
}
catch (Exception)
{
LogData(String.Format("Can not request rfcomm service from device ID:{0}, NAME:{1}", deviceInfo.Id, deviceInfo.Name));
}
Is there any way to query when the device is in range , rather than trying to connect? I would prefer to only attempt connection when the device is in range.
For RFCOMM (BT2.0, BT2.1) you can run a device enumeration periodically, see also Get bluetooth devices in range
However your actual implementation with a connection attempt may work a little better.
For Bluetooth 4.0, you can listen to the advertisements of the BT module, see also https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/BluetoothAdvertisement
If you're talking to an embedded device (e.g. some robot, or homebrew appliances using RFCOMM) I am afraid there is no better solution than what you're doing.
If you're taking to a phone (which supports both BT4.0 and BT2.1) you can use the BT4 advertisements to signal the proximity of the device, then connect via RFCOMM.
I am trying to stream Audio to a bluetooth device in-code in C#. I've picked up the 32feet.net library to help with this. I am able to get a bluetooth speaker paired just fine, and then I use the code below to connect to the device.
globalClient.BeginConnect(device.DeviceAddress, BluetoothService.SerialPort, new AsyncCallback(BluetoothConnectedAsyncHandler), device);
Async Callback method:
private void BluetoothConnectedAsyncHandler(IAsyncResult result)
{
BluetoothDeviceInfo connectedDevice = (BluetoothDeviceInfo)result.AsyncState;
globalClient.EndConnect(result);
if (result.IsCompleted)
{
NetworkStream btStream = globalClient.GetStream();
}
}
This all works well, but when I try to set the service from BluetoothService.SerialPort to BluetoothService.AudioSource, then I receive a SocketException on the "globalClient.EndConnect(result);" line saying "A socket operation failed because the destination host was down". See screenshot:
I've also tried to throw data at the speaker through the NetworkStream when it is setup with BluetoothService.SerialPort, but it doesn't play anything - no noise or static.
My running hypothesis is that this can't be done easily with 32feet.net, and I would have to code up the a2dp spec in code. I think the 32feet.net library is used so that I can tell the Operating System to use the speaker as an output device, rather than control audio output in-code as a supported feature.
Please help! Has anyone done this?
Would it even work if I sent an a2dp compliant stream to the device over the BluetoothService.SerialPort connection?
A2DP spec: https://www.bluetooth.org/docman/handlers/DownloadDoc.ashx?doc_id=8236
Thanks for any help!
Update:
This isn't possible within the 32feet.net library, you can only set the device up to talk the the Microsoft audio service using the setService method call in 32feet.net
www.nudoq.org/#!/Packages/32feet.NET/InTheHand.Net.Personal/MicrosoftSdpService/M/SetService
This MS service manages the A2DP output to the device. There is no way to directly output audio from code into the Bluetooth Device using this library in C#.
i have changed the registry settings as per the msdn
but when i connect to pc then it shows usb not recongnized/
settings i used is given below
;================================================================================= [HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers\CompositeFN]
"Attributes"=multi_sz:"0x80"
"bcdDevice" =dword:0
"DefaultPrefix"="CompositeFn_"
"ManufacturerString"="Composite USB"
"MaxPacketSize"=dword:40
"PowerConsumption"=multi_sz:"0x00"
"ProductString"="CompositDriver"
"SerialString"="0x22"
"ProductID"=dword:233a
"VendorID"=dword:0001
"DefaultString"="e-con Composite
Driver"
[HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers\Serial_Class]
"CompositeFn_DefaultString"="
ActiveSync"
"CompositeFn_FunctionClass"=dword:0a
"CompositeFn_FunctionDescription"="USB
ActiveSync"
"CompositeFn_FunctionProtocol"=dword:ff
"CompositeFn_FunctionSubclass"=dword:00
;"CompositeFN_DisableIAD"=dword:1
[HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers\Mass_Storage_Class]
"CompositeFn_DefaultString"="ASI
DataMyte Mass Storage"
"CompositeFn_FunctionClass"=dword:08
"CompositeFn_FunctionDescription"="USB
MassStorage"
"CompositeFn_FunctionProtocol"=dword:ff
"CompositeFn_FunctionSubclass"=dword:00
[HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers\CompositeFN]
"ClientDriverList"=multi_sz:"Mass_Storage_Class","Serial_Class"
[HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers]
"DefaultClientDriver"="CompositeFN"
Is the actual driver in the OS image? What comes out the debug port when you plug in the device? Connecting with Platform Builder via KITL would be a good next step as you could step through the entire driver initialization code path.