Perdix / Perdix AI info from Shearwater

Dirk Hohndel dirk at hohndel.org
Mon Apr 10 09:23:42 PDT 2017


After a couple of hiccups (my main contact at Shearwater had left them, but now is back) I was able to connect with Shearwater regarding BTLE support.
It seems that the newer Perdix are all BTLE only (not just the AI). So this is becoming more pressing...

(interesting to see that they, too, have released mobile apps for iOS and Android...)

/D


> To answer your earlier questions about the Perdix AI, here's the scoop:
>  
> 1) The original Perdix has both Bluetooth classic and Bluetooth LE
> 2) The Perdix AI is LE only
> 3) We have recently reworked the electronics on the original Perdix such that it is also now LE only.
>  
> As far as LE communications go, you are correct that we are using GATT.
>  
> I have recently returned to Shearwater from other work, so I myself am just getting up to speed with Bluetooth LE.
>  
>  
> In terms of how to connect to the Perdix, there seems to be two separate ways we do it, depending on the OS.
>  
> The first way is to listen for advertisements, then pull the name and Bluetooth address out of that advertisement and connect directly:
>  
>   private async void OnAdvertisementReceived(BluetoothLEAdvertisementWatcher watcher, BluetoothLEAdvertisementReceivedEventArgs eventArgs)
>         {
> string localName = eventArgs.Advertisement.LocalName;
>             if (found_sri_computer == false)
>             {
>                 if (localName.Equals(PETREL_NAME) || localName.Equals(PERDIX_NAME))
>                 {
>                     found_sri_computer = true;
>                     var mac_address = eventArgs.BluetoothAddress;
>                     mac_address_hex_s = mac_address.ToString("x");
>  
>                     BluetoothLEDevice found_device = await BluetoothLEDevice.FromBluetoothAddressAsync(mac_address);
>                     DeviceInformation found_device_info = found_device.DeviceInformation;
>                     ad_watcher.Stop();
>                     PairDevice(found_device_info);
>                 }
>             }
> }
>  
> The second way appears to be that we search for devices that have already been paired that have a certain GATT service:
>  
> var devices = await DeviceInformation.FindAllAsync(GattDeviceService.GetDeviceSelectorFromUuid(new Guid("FE25C237-0ECE-443C-B0AA-E02033E7029D")));
>  
> Then it appears we subscribe like this:
> accConfig = accService.GetCharacteristics(new Guid("27B7570B-359E-45A3-91BB-CF7E70049BD2"))[0];
>  
>                 await accConfig.WriteClientCharacteristicConfigurationDescriptorAsync(GattClientCharacteristicConfigurationDescriptorValue.Notify);
>  
> When it comes time to write, this is how it looks:
>  
> public async Task<GattCommunicationStatus> Write(byte[] data)
>         {
>             return await accConfig.WriteValueAsync(data.AsBuffer(), GattWriteOption.WriteWithoutResponse);
>  
>         }   
> When writing those bytes, we use the same protocol as earlier.
>  
> By the way, there is some additional information available to Perdix AI in the log (quoting from our docs):
>  
> To address what is new about the Perdix AI. The Perdix AI only uses Bluetooth Low Energy (LE). Unlike the old Perdix and Petrel 2 which use both LE and Classic protocols. 
> There has also been a change regarding our new log format. The Dive Log Header and Footer remains the same format however have incremented to log version 7. We have changed the Dive Log records. Reference this table for supporting the new Log V7 format in our Dive Computers.
> Contents
> Block Offset
>  
> LOG_RECORD_TYPE_DIVE_SAMPLE (0x01)
> 0-1
> Depth, in current units
> 2-3
> Next Stop Depth, in current units
> 4-5
> Time-To-Surface (TTS), minutes
> 6 
> Average PPO2 in ata (x100, e.g.  123=1.23)
> 7
> Current gas percent O2
> 8
> Current gas percent He
> 9
> Next stop time, minutes (If Next Stop Depth is Zero, then this is the NDL time in minutes. Note that NDL was offset 10 in the old Predator log versions).
> 10
> Battery voltage Note: Legacy use only. More precise value available at offset  16
> 11
> Misc. Statuses:
> Bit 0: 1=gas switch needed, 0=not needed
> Bit 1: 1=external PPO2, 0=internal PPO2
> Bit 2: 1=high setpoint, 0=low setpoint
> Bit 3: 1=SC mode, 0=CC mode
> Bit 4: 0 = Closed Circuit, 1= Open Circuit
> 12
> O2 Sensor 1 millivolts (only valid when external PPO2 monitoring enabled)
> 13
> Water temperature (Celsius when metric, Fahrenheit when imperial)
> 14
> O2 Sensor 2 millivolts (only valid when external PPO2 monitoring enabled)
> 15
> O2 Sensor 3 millivolts(only valid when external PPO2 monitoring enabled)
> 16-17
> Battery voltage * 100
> 18
> Current ppo2 set point (only valid for CC mode)
> 19 - 20
> For Log Version 7 and greater (below this field is unused):
> Wireless AI sensor 1 (T2), most 4 bits are battery level . 0= battery normal, 1= critical low, 2 = warning low
> Rest 12 bits are sensor1 pressure/2 in psi
> ·         0xFFFF: not paired / no communication for 90 seconds
> ·         0xFFFE: no communication for 30 seconds
>  
> 21
> For Log Version 7 and greater (below this field is unused):
> Gas time remain minutes of Wireless AI
> ·         0xFF not paired, 
> ·         0xFE no communication, 
> ·         0xFD not available in current mode, 
> ·         0xFC not available because of DECO,
> ·         0xFB Tank size or max pressure haven’t been set up,
> ·         0-0xFA valid range
>  
> 22
> CNS percentage                  
> 23
> Decompression Ceiling Depth (current units)
> 24
> Gf99 (current Buhlmann percent Gradient)
> 25-26
> @+5 (in minutes)
> 27 - 28
> For Log Version 7 and greater (below this field is unused):
> Wireless AI sensor 0 (T1), most 4 bits are battery level . 0= battery normal, 1= critical low, 2 = warning low
> Rest 12 bits are sensor0 pressure/2 in psi
> ·         0xFFFF: not paired / no communication for 90 seconds
> ·         0xFFFE: no communication for 30 seconds
>  
> 29-30
> For Log Version 7 and greater (below this field is unused):
> Surface Air Consumption (SAC) in PSI/min.
> Value is x100. E.g. 3245 = 32.45 PSI/min
> 31
> Reserved for future use
> Besides the Bluetooth protocol changing to only support LE, and the new AI features in the Dive Log Offsets. The rest remains the same.
>  
> One more thing: we’ve recently released a mobile app for Android and iPhone. It’s called Shearwater Cloud.  You might want to check it out, as it could give you a smoke test for the Perdix AI.
>  
> As I said above, I’m just getting back up to speed, so if the above info doesn’t help, or if you have more questions, please let me know and I’ll do my best to help.
>  

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20170410/99c0bf3b/attachment-0001.html>


More information about the subsurface mailing list