Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor IAP Transport / Fix EASessions left open #1910

Conversation

kmicha19-ford
Copy link

Fixes #1799 (when used in conjunction with kmicha19-ford#2)
Fixes #1809
Fixes #1892
Fixes #1893

This PR is ready for review.

Risk

This PR makes no API changes.

Testing Plan

  • I have verified that I have not introduced new warnings in this PR (or explain why below)
  • I have tested this PR against Core and verified behavior.

Unit Tests

Unit tests were updated for the refactored classes.

Core Tests

  • Built the Obj-C example app and verified that all interactions work
    • iAP disconnect / reconnect
    • LockScreen on/off rapidly
  • Built the Swift example app and verified that all interactions work
    • iAP disconnect / reconnect
    • LockScreen on/off rapidly

Summary

  • Refactors iAPSession code that uses the Apple External Accessory Frameworks to create, open, use, and close EASessions.

Changelog

Breaking Changes
  • None
Enhancements
  • Moves all managment of EASession creation, open, and closing into a single class, SDLIAPSession
  • Eliminates the use of NSThread from SDLIAPDataSession
  • SDLIAPSession now uses a DispatchQueue to provide the required thread for EASession
  • Uses composition instead of inheritance, SDLIAPControlSession and SDLIAPDataSession now use SDLIAPSession instead of being subclasses of it
  • Provides a short simple code path for closing EASessions
  • Eliminates over two hundred lines of code

Tasks Remaining:

  • More unit tests

CLA

@joeljfischer joeljfischer changed the title Issue 799 easessions left open Refactor IAP Transport / Fix EASessions left open Feb 8, 2021
@joeljfischer joeljfischer added bug A defect in the library transport-iap Relating to the primary IAP transport labels Feb 8, 2021
@joeljfischer joeljfischer added this to In progress in v7.1.0 via automation Feb 8, 2021
Copy link
Contributor

@NicoleYarroch NicoleYarroch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mostly made some style formatting suggestions. Namely, private methods in the implementation files are prefixed by "sdl_". I tried to find most of them but I may have missed a few.

I did experience a crash on disconnect that should be a pretty easy fix.

I haven't had the chance yet to thoroughly test secondary transports and switching between BT and USB transports but testing the multisession and control protocols worked well.

SmartDeviceLink/private/SDLIAPControlSession.h Outdated Show resolved Hide resolved
SmartDeviceLink/private/SDLIAPControlSession.h Outdated Show resolved Hide resolved
SmartDeviceLink/private/SDLIAPSession.m Outdated Show resolved Hide resolved
SmartDeviceLink/private/SDLIAPSession.m Outdated Show resolved Hide resolved
SmartDeviceLink/private/SDLIAPSession.m Outdated Show resolved Hide resolved
SmartDeviceLink/private/SDLIAPDataSession.m Outdated Show resolved Hide resolved
SmartDeviceLink/private/SDLIAPSession.m Outdated Show resolved Hide resolved
SmartDeviceLink/private/SDLIAPSession.m Outdated Show resolved Hide resolved
SmartDeviceLink/private/SDLIAPSession.m Outdated Show resolved Hide resolved
SmartDeviceLink/private/SDLIAPSession.m Outdated Show resolved Hide resolved
v7.1.0 automation moved this from In progress to Review in progress Feb 17, 2021
@kmicha19-ford
Copy link
Author

kmicha19-ford commented Feb 19, 2021 via email

@kmicha19-ford
Copy link
Author

Just commited changes based on PR comments. These include the following.
prefixing all private methods with 'sdl_'
removed blank space from beginning of method names
removed extraneous semicolons
moved one public method up that was in the marked as private section
Note, not sure about when to you want to use SDLLogD, SDLLogV or even SDLLogE

Copy link
Contributor

@NicoleYarroch NicoleYarroch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a few things were missed from my last review. Can you tag me when you have a fix for the crash I noted in the last review? Thanks!

@codecov
Copy link

codecov bot commented Feb 22, 2021

Codecov Report

Merging #1910 (2f8d655) into develop (67ca794) will increase coverage by 0.54%.
The diff coverage is 74.45%.

@@             Coverage Diff             @@
##           develop    #1910      +/-   ##
===========================================
+ Coverage    84.66%   85.20%   +0.54%     
===========================================
  Files          418      426       +8     
  Lines        20939    21376     +437     
===========================================
+ Hits         17728    18214     +486     
+ Misses        3211     3162      -49     

@kmicha19-ford
Copy link
Author

I reviewed comments and made multiple updates for style requirements and also removed an used function. Hopefully I have everything this time.

Copy link
Contributor

@NicoleYarroch NicoleYarroch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found a few minor things to fix. A couple of comments from my previous reveiw were missed on the SDLIAPDataSession.m file.

SmartDeviceLink/private/SDLIAPDataSession.m Outdated Show resolved Hide resolved
SmartDeviceLink/private/SDLIAPTransport.m Outdated Show resolved Hide resolved
SmartDeviceLink/private/SDLIAPControlSession.m Outdated Show resolved Hide resolved
Copy link
Contributor

@NicoleYarroch NicoleYarroch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found a few minor spacing issues - otherwise testing went well

SmartDeviceLink/private/SDLIAPDataSession.h Outdated Show resolved Hide resolved
SmartDeviceLink/private/SDLIAPSession.h Outdated Show resolved Hide resolved
v7.1.0 automation moved this from Review in progress to Reviewer approved Feb 24, 2021
@joeljfischer joeljfischer merged commit cf1f568 into smartdevicelink:develop Mar 15, 2021
v7.1.0 automation moved this from Reviewer approved to Done Mar 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A defect in the library transport-iap Relating to the primary IAP transport
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants