Feature: Mobile App Integration
Complexity: π΄ High Hardware Required: π§ Minor (Bluetooth LE module) User Value: ββ Nice-to-have
Overview
Integrate smartphone connectivity to use mobile devices as virtual RFID cards, enable remote management, and provide enhanced user experience through a dedicated mobile app.
Benefits
- Phone as a virtual keycard
- Remote access management
- Real-time notifications
- Access history on phone
- Guest access sharing
- No physical card needed
Integration Methods
- Bluetooth LE - Direct phone-to-device
- WiFi - Network-based control
- NFC - Phoneβs NFC as RFID
- QR Code - Temporary access codes
- Cloud Bridge - Internet-based control
Implementation Checklist
Phase 1: Bluetooth LE Setup
- Hardware integration:
class BLEController { private: BLEServer* server; BLECharacteristic* authChar; BLECharacteristic* statusChar; BLECharacteristic* commandChar; std::string devicePin; public: void begin(const char* deviceName); bool authenticateDevice(std::string token); void broadcastStatus(uint8_t status); std::string waitForCommand(); };
- HM-10 or ESP32 BLE module
- Secure pairing protocol
- Range optimization (10-30m)
Phase 2: Mobile Authentication
- Virtual Card System:
struct VirtualCard { uint8_t phoneId[16]; // Unique phone identifier uint8_t accessLevel; uint32_t validFrom; uint32_t validUntil; bool requiresNetwork; uint8_t encryptionKey[32]; };
- Phone-based credentials:
- Device UUID
- Secure token exchange
- Time-based codes
- Biometric confirmation
Phase 3: App Communication Protocol
- BLE Services:
// Service UUIDs #define SERVICE_UUID "12345678-1234-5678-1234-56789abcdef0" #define AUTH_CHAR_UUID "12345678-1234-5678-1234-56789abcdef1" #define STATUS_CHAR_UUID "12345678-1234-5678-1234-56789abcdef2" #define COMMAND_CHAR_UUID "12345678-1234-5678-1234-56789abcdef3"
- Message format:
- JSON for commands
- Binary for efficiency
- Encryption layer
- Message authentication
Phase 4: Mobile App Features
- Core Functionality:
- Auto-connect when in range
- Background operation
- Unlock button
- Access history
- Settings management
- Advanced Features:
- Geofencing auto-unlock
- Share temporary access
- Push notifications
- Multiple door support
- Offline mode
Phase 5: Security Implementation
- Authentication Flow:
bool authenticateMobile(BLEClient* client) { // 1. Exchange public keys // 2. Client sends signed challenge // 3. Verify signature // 4. Create session key // 5. All further comm encrypted return verifySignature(challenge, signature, publicKey); }
- Rolling codes
- Certificate pinning
- Man-in-the-middle protection
- Replay attack prevention
Phase 6: Guest Access
- Temporary Access Sharing:
struct GuestAccess { std::string guestPhone; uint32_t startTime; uint32_t endTime; uint8_t maxUses; uint8_t usedCount; bool requiresApproval; std::string sharedBy; };
- QR code generation
- Time-limited links
- One-time passwords
- Access approval workflow
Phase 7: App User Interface
- Main Screen:
βββββββββββββββββββββββ β ACCESS CONTROL β βββββββββββββββββββββββ€ β β β [UNLOCK DOOR] β β β β Status: Locked π β β Last: 2:30 PM β β β βββββββββββββββββββββββ€ β History β Share β β β βββββββββββββββββββββββ
- Access history view
- Settings management
- Multi-door support
- Dark mode
Mobile Platform Support
iOS Requirements
- BLE Core Bluetooth framework
- Background modes enabled
- Push notification setup
- Keychain for secure storage
Android Requirements
- Bluetooth LE permissions
- Location permission (for BLE)
- Foreground service for background
- Encrypted SharedPreferences
Example App Flows
Auto-Unlock Flow
- Phone enters geofence
- App wakes and connects via BLE
- Mutual authentication
- Phone sends unlock command
- Door unlocks automatically
- User receives confirmation
Guest Access Flow
- User selects βShare Accessβ
- Sets time window and restrictions
- App generates secure link/QR
- Guest receives and opens link
- Guest app connects when in range
- Access logged to original user
Testing Checklist
- BLE connection reliability
- Range testing (indoor/outdoor)
- Battery impact on phone
- Security penetration testing
- Multiple phone handling
- iOS/Android compatibility
- Background operation
- Network failure handling
Privacy Considerations
- Location data handling
- User consent for tracking
- Data encryption at rest
- GDPR compliance
- Anonymous usage option
- Data deletion rights
Performance Optimization
- BLE connection caching
- Efficient scanning intervals
- Battery usage optimization
- Quick connect protocols
- Offline capability
- Sync when connected
Future Enhancements
Advanced Features
- Apple Wallet / Google Pay integration
- Voice assistant commands
- Wearable device support (Apple Watch, etc.)
- Facial recognition at door
- AR door finding
- Integration with smart home systems
Enterprise Features
- Active Directory integration
- Multi-site management
- Compliance reporting
- Advanced analytics
- Role-based administration
- API for third-party apps
Development Resources
- Flutter/React Native for cross-platform
- Native iOS (Swift) / Android (Kotlin)
- BLE libraries and examples
- Security best practices
- UI/UX design patterns
- Beta testing platforms