Skip to content

Commit d6d2d15

Browse files
authored
Update README.md
1 parent ed874ee commit d6d2d15

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,59 @@
11
# sdl_javascript_suite
22
SmartDeviceLink library for applications developed in JavaScript
3+
4+
Background details for creation of repository can be found in the SDL Evolution Proposal [SDL 0235 - SDL JavaScript library](https://github.com/smartdevicelink/sdl_evolution/issues/742). Initial implementation details can be found below.
5+
6+
## Proposed solution
7+
8+
The solution is to create a common JavaScript library that offers a public proxy object to send and receive RPCs. The library also requires implementations of all the other layers required to package and frame the data and send it over a defined transport.
9+
10+
### SDL library layers
11+
12+
Looking into the existing libraries, developed in Java and Objective-C, they contain the following superset of layers:
13+
14+
1. The **High Level Interface** is a work-in-progress developer friendly API with the purpose to provide a programming interface similar to mobile frameworks.
15+
2. The **Manager layer** is the current programming interface that abstracts the heavy load of dealing with application lifecycle, screen, dealing with RPCs and many more.
16+
3. The **Proxy layer** also known as RPC layer, is the lower level interface with the purpose of managing the connection to the remote endpoint and sending and receiving RPCs. The [RPC specification](https://github.com/smartdevicelink/rpc_spec) of the mobile API is implemented in this layer.
17+
4. The **SDL Session layer** is responsible for the lifecycle of service sessions for e.g. RPC/Bulk, video and audio. It packages application data and sends it to the protocol layer.
18+
5. The **SDL protocol layer** is responsible for organizing the sending and receiving of frames as per the [Protocol specification](https://github.com/smartdevicelink/protocol_spec)
19+
6. The **transport layer** is the root level of SmartDeviceLink and therefore the most critical layer as it is responsible for the foundation of data transmission.
20+
21+
It is not realistic to develop a new SDL library that can provide the same set of features as the Android and iOS library all at once. Therefore it is important to focus on a "milestone 1" which includes the following fundamental elements:
22+
23+
#### Included tasks in this proposal
24+
25+
**1. Proxy layer**
26+
27+
Provide a Proxy class and implementations of all RPCs according to the [RPC specification v5.1](https://github.com/smartdevicelink/rpc_spec/tree/5.1.0). As this specification is XML structured it makes sense to develop a code generator to export all the RPCs, structs and enums to usable code.
28+
29+
**2. SDL Session layer and Protocol layer**
30+
31+
In the first milestone the JavaScript library should support the RPC and Bulk service types for communication. Media and projection applications may not be supported in the first release.
32+
33+
An open source BSON libray developed in JavaScript should be used by the SDL JavaScript library. If there is no suitable 3rd party BSON library available, a new BSON library will be created according to the specification of [bsonspec.org](http://bsonspec.org/#/specification).
34+
35+
**3. Transport layer**
36+
37+
The first release should come with a base/abstract definition of the transport layer. Based on this definition a TCP socket client transport and a WebSocket Server transport described in [Cloud App Transport Adapter](https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0158-cloud-app-transport-adapter.md) should be implemented with this proposal.
38+
39+
#### Manager layer
40+
41+
The first managers that should be introduced in future proposals should be a lifecycle manager and the file manager. Other managers (screen manager etc.) should be added in future releases.
42+
43+
This proposal does not include a manager layer. Managers will be introduced via new proposals.
44+
45+
### Development in TypeScript
46+
47+
The development of this library should not be done in pure JavaScript but in TypeScript. The reason is that TypeScript allows use of data types, classes and other useful development features. This will reduce complexity and risk of issues during development. With TypeScript the maintenance of the library will be much easier compared to pure JavaScript.
48+
49+
TypeScript will still allow JavaScript support. Whenever a new release version is planned, the TypeScript code can be transcompiled to JavaScript. This [TypeScript Playground](https://www.typescriptlang.org/play/index.html) from typescriptlang.org shows how easy TypeScript can be transcompiled into JavaScript. The export can also provide a [JavaScript Source Map](https://www.html5rocks.com/en/tutorials/developertools/sourcemaps/) for Lint and auto complete when developing JavaScript applications e.g. in VS code.
50+
51+
### Promise based development
52+
53+
Just as the other existing libraries, the JavaScript library requires possibilities to perform async operations. JavaScript is very well capable of serving this task especially with using the Promise pattern.
54+
55+
There are many sources describing the Promise pattern with JavaScript and how it is used already in the native API and other libraries and frameworks. See [Mozilla: Promise](https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Promise) and [You Don't Know JS - Promises](https://github.com/getify/You-Dont-Know-JS/blob/master/async%20%26%20performance/ch3.md)
56+
57+
### Project management
58+
59+
The JavaScript library will be open source and stored in a new smartdevicelink repository on GitHub called sdl_javascript. The project maintainers will be responsible for maintaining and reviewing the code and the project.

0 commit comments

Comments
 (0)