diff --git a/.github/workflows/build_and_release.yml b/.github/workflows/build_and_release.yml index 811bde39..96619261 100644 --- a/.github/workflows/build_and_release.yml +++ b/.github/workflows/build_and_release.yml @@ -63,7 +63,7 @@ jobs: ios-example: name: iOS example app - runs-on: macos-14 + runs-on: macos-15-arm64 needs: build steps: - name: Checkout diff --git a/example/app.config.ts b/example/app.config.ts index 4661c24d..982dddaf 100644 --- a/example/app.config.ts +++ b/example/app.config.ts @@ -2,36 +2,42 @@ import { ExpoConfig } from '@expo/config-types'; import 'ts-node/register'; const config: ExpoConfig = { - name: "react-native-mcu-manager-example", - slug: "react-native-mcu-manager-example", - assetBundlePatterns: ["**/*"], - orientation: "portrait", - platforms: ["ios", "android"], - scheme: "rnmcumgr", - version: "1.0.0", + name: 'react-native-mcu-manager-example', + slug: 'react-native-mcu-manager-example', + assetBundlePatterns: ['**/*'], + orientation: 'portrait', + platforms: ['ios', 'android'], + scheme: 'rnmcumgr', + version: '1.0.0', splash: { - image: ".assets/images/pd.png", - backgroundColor: "#FFFFFF", + image: '.assets/images/pd.png', + backgroundColor: '#FFFFFF', }, ios: { supportsTablet: true, - bundleIdentifier: "uk.co.playerdata.reactnativemcumanager.example", + bundleIdentifier: 'uk.co.playerdata.reactnativemcumanager.example', infoPlist: { - NSBluetoothAlwaysUsageDescription: "Requires Bluetooth to perform firmware updates.", + NSBluetoothAlwaysUsageDescription: + 'Requires Bluetooth to perform firmware updates.', }, }, android: { - package: "uk.co.playerdata.reactnativemcumanager.example", - permissions: [ - "ACCESS_FINE_LOCATION", - "ACCESS_COARSE_LOCATION", - ], + package: 'uk.co.playerdata.reactnativemcumanager.example', + permissions: ['ACCESS_FINE_LOCATION', 'ACCESS_COARSE_LOCATION'], }, plugins: [ - ["expo-document-picker"], - ["expo-router"], - ["./gradlePlugin.ts"] - ] + ['expo-document-picker'], + ['expo-router'], + ['./gradlePlugin.ts'], + [ + 'expo-build-properties', + { + android: { + minSdkVersion: 26, + }, + }, + ], + ], }; export default config; diff --git a/example/package.json b/example/package.json index a2fc45aa..a7e2affb 100644 --- a/example/package.json +++ b/example/package.json @@ -14,17 +14,18 @@ "dependencies": { "@playerdata/react-native-mcu-manager": "workspace:*", "expo": "52.0.25", - "expo-constants": "~17.0.4", + "expo-build-properties": "0.13.2", + "expo-constants": "17.0.4", "expo-document-picker": "13.0.2", - "expo-linking": "~7.0.4", - "expo-router": "~4.0.16", + "expo-linking": "7.0.4", + "expo-router": "4.0.16", "expo-splash-screen": "0.29.20", "expo-status-bar": "~2.0.1", "lodash": "4.17.21", "react": "18.3.1", - "react-native": "0.76.3", + "react-native": "0.76.6", "react-native-ble-plx": "3.4.0", - "react-native-reanimated": "~3.16.1", + "react-native-reanimated": "3.16.7", "react-native-safe-area-context": "4.14.1", "react-native-screens": "~4.4.0", "react-native-toast-message": "2.2.1" diff --git a/example/src/app/_layout.tsx b/example/src/app/_layout.tsx index 12ad324c..fc1e668b 100644 --- a/example/src/app/_layout.tsx +++ b/example/src/app/_layout.tsx @@ -20,6 +20,7 @@ const RootLayout = () => { options={{ title: 'Home' }} /> + ); diff --git a/example/src/app/settings.tsx b/example/src/app/settings.tsx new file mode 100644 index 00000000..5d0be696 --- /dev/null +++ b/example/src/app/settings.tsx @@ -0,0 +1,142 @@ +import { + readSetting, + writeSetting, +} from '@playerdata/react-native-mcu-manager'; +import { Buffer } from 'buffer'; + +import React, { useState } from 'react'; +import { + Button, + SafeAreaView, + ScrollView, + StyleSheet, + Text, + TextInput, + View, +} from 'react-native'; + +import { useSelectedDevice } from '../context/selectedDevice'; + +const styles = StyleSheet.create({ + root: { + padding: 16, + }, + + block: { + marginBottom: 16, + }, + + list: { + padding: 16, + }, +}); + +export default function settings() { + const { selectedDevice } = useSelectedDevice(); + + const [settingError, setSettingError] = useState(null); + const [settingName, setSettingName] = useState(''); + const [settingValue, setSettingValue] = useState(''); + + return ( + + + Step 1 - Select Device to Update + + + {selectedDevice && ( + <> + Selected: + {selectedDevice.deviceName} + + )} + + + + Step 2 - Read or Write settings to the device + + + + Setting Name + + + + + + Setting Value + + + + + {settingError && ( + + {settingError} + + )} + + +