smartdevicelink / sdl_ios

Get your app connected to the 🚙, make your users feel like a 🌟
www.smartdevicelink.com
BSD 3-Clause "New" or "Revised" License
169 stars 105 forks source link

Refactor EASession Control Logic #1888

Closed makinney closed 3 years ago

makinney commented 3 years ago

This is a refactor of SDLIAPSession, SDLIAPControlSession and SDLIAPDataSession. This addresses a problem where last fall some FordPass customers began experiencing significant battery drain after disconnecting  from Sync 3 or Sync 4 - USB and Bluetooth. ACVL implemented this refactor in its custom SDL library that was released in FordPass version 3.14. This issue is for implementing the refactor on the public SDL repository as it should benefit all SDLC members.

This refactor includes:

A change to software architecture where SDLIAPControlSession and SDLIAPDataSession no longer use the inheritance design pattern to subclass SDLIAPSession and now use a composition design pattern where instead they use SDLIAPSession

Encapsulates managing of EASession creating, opening, closing, streaming, and error handling into SDLIAPSession

Uses a DispatchQueue to eliminate the use of NSThread in SDLIAPDataSession. This eliminates the need to create, configure, and manage the NSThread resulting in a significant reduction in complexity.

These logic changes result in the elimination of over 200 lines of code.

Note this refactor was sparked by the Apple response to a technical support ticket and is based on a sample project supplied by Apple.

joeljfischer commented 3 years ago

Hi @makinney, this does not seem to follow the issue template, and is not an actual issue, but instead describes a PR. Is that intentional? If so, please rephrase this to describe an actual issue that a PR would fix. Is this related to #1799?

makinney commented 3 years ago

Thanks for the feedback Joel. I am closing this issue. Will create a new issue with new name in the following the SDL Issue Template format.