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

[WIP] Application Launching (SDL 4.0) #45

Closed
wants to merge 32 commits into from

Conversation

joeljfischer
Copy link
Contributor

💥 Not Ready to Merge 💥

Summary

This PR will involve several pieces to allow an iOS application to track available applications on the users phone that can be launched with SmartDeviceLink. This will involve 4 major pieces.

  1. Head Unit tracking of the foregrounded application on a user's phone.
  2. Head Unit requested querying of a server URL to retrieve a list of applications that are SDL compatible.
  3. Parsing the response from the server, and determining which apps installed on the user's phone can be launched, and sending the filtered response to the HU.
  4. Responding to a request from the HU to launch a specific app, and launching it.

In Depth

Tracking Foregrounded Application

The SDL Proxy object, upon opening a connection, will poll the application for its state, and send that across. It will also immediately set up observers on application state changes. Upon firing of those observers, it will recheck the application for its state, and push a new notification to the HU.

This PR also introduces the ability to send notifications from the Mobile API (issue #34). This is required because application state changes are sent via a pre-existing RPC Notification that was previously only sent from the HU, onHMIStatus. FULL is equivalent to foreground, LIMITED is equivalent to background.

Query Apps Server HTTP Request

The HU will request, via a OnSystemRequest, that the mobile device retrieve an application list from the server. The application may (this has not yet been determined) cache the response for a specified period.

Query Apps Filter Installed Applications

The server will respond with a set response, described here which will be parsed by the library. The library will then run a system call to determine which apps are installed on the phone. The library will then filter the list passed by the server so that only installed apps are represented, and forward it on to the HU.

Launch App

The HU will send an OnSystemRequest with a URL field that contains the URL scheme of the app they wish to launch to the foregrounded application. The library running in that application will then attempt to launch the application specified by the url scheme passed in. This will, of course, foreground that application, and background the application making the call.

TODO

General
Tracking Foreground State
  • Track Application State
  • Add the ability to send RPCNotifications (by sending any type of RPCMessage)
  • Send an OnHMIStatus notification to connected HU when application state changes
  • Remove app state observers when session closes
  • Properly log and handle errors
Query Apps Server HTTP Request
  • Create new SystemRequest enum type for Query Apps
  • Capture OnSystemRequests for Query Apps and Launch App commands
  • Make a query apps web call to the server specified in the OnSystemRequest to retrieve a list of URLs
  • Parse the response from the server, determine applications to be checked
  • Properly log and handle errors
  • Determine if NSURLSessionUploadTask should be NSURLSessionDataTask
Query App Filter Installed Applications
  • Test each application to see if it's installed on the phone
  • Filter the response from the server based on which apps are installed on the phone
  • Send the filtered response to the Head Unit
  • Properly log and handle errors
Launch App
  • Create new SystemRequest enum type for Launch App
  • Parse a Launch App OnSystemRequest
  • Open the specified application from a Launch App OnSystemRequest
  • Properly log and handle errors
Other
  • Test changes to query apps did not adversely affect Policy Server requests
  • Refactor into new develop project layout

@joeljfischer
Copy link
Contributor Author

This was originally #33, which was mistakenly merged (and was reverted).

@joeljfischer joeljfischer changed the title Application Launching (SDL 4.0) [WIP] Application Launching (SDL 4.0) Jan 22, 2015
@joeljfischer joeljfischer self-assigned this Jan 22, 2015
@joeljfischer joeljfischer force-pushed the feature/Mobile_HMI_State_Notifications branch from 7f1ebf9 to 0485e1a Compare January 26, 2015 14:49
joeljfischer and others added 3 commits January 26, 2015 16:03
All methods are class, so no stored property is needed
@justinjdickow
Copy link
Contributor

Core is not successfully parsing the onHMIStatus notification because the audioStreamingState and systemContext are not set and they are required parameters.

When I add

    HMIStatusRPC.audioStreamingState = [SDLAudioStreamingState NOT_AUDIBLE];
    HMIStatusRPC.systemContext = [SDLSystemContext MAIN];

to sendMobileHMIState, core successfully parses the notification.

The other issue we've found is that core and iOS both have a checks for protocol v4

if (_version >= 4) {

and

if (ProtocolVersion::kV4 == app->protocol_version()) {

it seems like both are sending v2, so the QUERY_APPS never happens in the current implementation :(

Joel Fischer and others added 4 commits February 10, 2015 14:15
Changed notification observed from will resign active to did enter background.

Fixed an issue with refactoring.

Signed-off-by: Justin Dickow <jjdickow@gmail.com>
Add QUERY_APPS and LAUNCH_APP request types to the values array of SDLRequestType enum

Add an autoreleasepool to the query apps filtering loop

Test the launch app url before blindly attempting to open it
@justinjdickow
Copy link
Contributor

Add

[[NSNotificationCenter defaultCenter] removeObserver:self];

to -SDLProxy:destructObjects

joeljfischer pushed a commit that referenced this pull request Mar 9, 2015
@joeljfischer joeljfischer mentioned this pull request Mar 9, 2015
23 tasks
@joeljfischer
Copy link
Contributor Author

Closed in favor of #99

@joeljfischer joeljfischer deleted the feature/Mobile_HMI_State_Notifications branch March 27, 2015 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants