Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added app/assets/images/pocket_device.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions app/lib/backend/schema/bt_device/bt_device.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import 'package:omi/services/devices/models.dart';
import 'package:omi/services/devices/omi_connection.dart';
import 'package:omi/services/devices/omiglass_connection.dart';
import 'package:omi/services/devices/plaud_connection.dart';
import 'package:omi/services/devices/pocket_connection.dart';
import 'package:omi/utils/logger.dart';

enum ImageOrientation {
Expand Down Expand Up @@ -206,6 +207,8 @@ Future<DeviceType?> getTypeOfBluetoothDevice(BluetoothDevice device) async {
deviceType = DeviceType.friendPendant;
} else if (BtDevice.isLimitlessDeviceFromDevice(device)) {
deviceType = DeviceType.limitless;
} else if (BtDevice.isPocketDeviceFromDevice(device)) {
deviceType = DeviceType.pocket;
} else if (BtDevice.isOmiDeviceFromDevice(device)) {
// Check if the device has the image data stream characteristic
final hasImageStream = device.servicesList
Expand Down Expand Up @@ -235,6 +238,7 @@ enum DeviceType {
fieldy,
friendPendant,
limitless,
pocket,
}

Map<String, DeviceType> cachedDevicesMap = {};
Expand Down Expand Up @@ -379,6 +383,8 @@ class BtDevice {
return await _getDeviceInfoFromFrame(conn as FrameDeviceConnection);
} else if (type == DeviceType.appleWatch) {
return await _getDeviceInfoFromAppleWatch(conn as AppleWatchDeviceConnection);
} else if (type == DeviceType.pocket) {
return await _getDeviceInfoFromPocket(conn as PocketDeviceConnection);
} else {
return await _getDeviceInfoFromOmi(conn);
}
Expand Down Expand Up @@ -610,6 +616,31 @@ class BtDevice {
);
}

Future _getDeviceInfoFromPocket(PocketDeviceConnection conn) async {
var modelNumber = 'Pocket';
var firmwareRevision = '1.0.0';
var hardwareRevision = 'HeyPocket Hardware';
var manufacturerName = 'HeyPocket';

try {
final deviceInfo = await conn.getDeviceInfo();
modelNumber = deviceInfo['modelNumber'] ?? modelNumber;
firmwareRevision = deviceInfo['firmwareRevision'] ?? firmwareRevision;
hardwareRevision = deviceInfo['hardwareRevision'] ?? hardwareRevision;
manufacturerName = deviceInfo['manufacturerName'] ?? manufacturerName;
} catch (e) {
Logger.error('Error getting Pocket device info: $e');
}

return copyWith(
modelNumber: modelNumber,
firmwareRevision: firmwareRevision,
hardwareRevision: hardwareRevision,
manufacturerName: manufacturerName,
type: DeviceType.pocket,
);
}

/// Returns firmware warning title for this device type
/// Empty string means no warning needed
String getFirmwareWarningTitle() {
Expand All @@ -619,6 +650,8 @@ class BtDevice {
case DeviceType.fieldy:
case DeviceType.friendPendant:
case DeviceType.limitless:
case DeviceType.pocket:
// TODO: Extract all firmware warning strings to l10n .arb files
return 'Compatibility Note';
case DeviceType.omi:
case DeviceType.openglass:
Expand Down Expand Up @@ -653,6 +686,10 @@ class BtDevice {
return 'Your $name\'s current firmware works great with Omi.\n\n'
'We recommend keeping your current firmware and not updating through the Limitless app, as newer versions may affect compatibility.';

case DeviceType.pocket:
return 'Your $name\'s current firmware works great with Omi.\n\n'
'We recommend keeping your current firmware and not updating through the HeyPocket app, as newer versions may affect compatibility.';

case DeviceType.omi:
case DeviceType.openglass:
case DeviceType.frame:
Expand All @@ -679,6 +716,7 @@ class BtDevice {
isFieldyDevice(result) ||
isFriendPendantDevice(result) ||
isLimitlessDevice(result) ||
isPocketDevice(result) ||
isOmiDevice(result) ||
isFrameDevice(result);
}
Expand Down Expand Up @@ -769,6 +807,17 @@ class BtDevice {
device.servicesList.any((s) => s.uuid.toString().toLowerCase() == limitlessServiceUuid.toLowerCase());
}

static bool isPocketDevice(ScanResult result) {
return result.device.platformName.toUpperCase().startsWith('PKT') ||
result.advertisementData.serviceUuids
.any((uuid) => uuid.toString().toLowerCase() == pocketServiceUuid.toLowerCase());
}

static bool isPocketDeviceFromDevice(BluetoothDevice device) {
return device.platformName.toUpperCase().startsWith('PKT') ||
device.servicesList.any((s) => s.uuid.toString().toLowerCase() == pocketServiceUuid.toLowerCase());
}

static bool isOmiDevice(ScanResult result) {
return result.advertisementData.serviceUuids.contains(Guid(omiServiceUuid));
}
Expand Down Expand Up @@ -799,6 +848,8 @@ class BtDevice {
deviceType = DeviceType.friendPendant;
} else if (isLimitlessDevice(result)) {
deviceType = DeviceType.limitless;
} else if (isPocketDevice(result)) {
deviceType = DeviceType.pocket;
} else if (isOmiDevice(result)) {
deviceType = DeviceType.omi;
} else if (isFrameDevice(result)) {
Expand Down
5 changes: 5 additions & 0 deletions app/lib/gen/assets.gen.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions app/lib/providers/capture_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ class CaptureProvider extends ChangeNotifier
return 'apple_watch';
case DeviceType.limitless:
return 'limitless';
case DeviceType.pocket:
return 'pocket';
}
}

Expand Down
3 changes: 3 additions & 0 deletions app/lib/services/devices/device_connection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import 'package:omi/services/devices/models.dart';
import 'package:omi/services/devices/omi_connection.dart';
import 'package:omi/services/devices/omiglass_connection.dart';
import 'package:omi/services/devices/plaud_connection.dart';
import 'package:omi/services/devices/pocket_connection.dart';
import 'package:omi/services/devices/wifi_sync_error.dart';
import 'package:omi/main.dart';
import 'package:omi/services/notifications.dart';
Expand Down Expand Up @@ -88,6 +89,8 @@ class DeviceConnectionFactory {
return FriendPendantDeviceConnection(device, transport);
case DeviceType.limitless:
return LimitlessDeviceConnection(device, transport);
case DeviceType.pocket:
return PocketDeviceConnection(device, transport);
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions app/lib/services/devices/models.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ const String limitlessServiceUuid = "632de001-604c-446b-a80f-7963e950f3fb";
const String limitlessTxCharUuid = "632de002-604c-446b-a80f-7963e950f3fb";
const String limitlessRxCharUuid = "632de003-604c-446b-a80f-7963e950f3fb";

const String pocketServiceUuid = '001120a0-2233-4455-6677-889912345678';

// OmiGlass OTA Service UUIDs
const String omiGlassOtaServiceUuid = "19b10010-e8f2-537e-4f6c-d104768a1214";
const String omiGlassOtaControlCharacteristicUuid = "19b10011-e8f2-537e-4f6c-d104768a1214";
Expand Down
Loading