You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After that execute `npm install` in the directory, where your `package.json` is located. This command will install all your dependencies in `node_modules` directory. Now you are ready to use `ios-device-lib` in your project:
13
+
In your project. Now you are ready to use `ios-device-lib` in your project:
The `ios-device-lib` package can be built on either Windows (requires Visual Studio) or macOS (requires Xcode). In order to build the application one should simply open the `.sln` or `.xcodeproj` file with the respective tool and click build. Whenever building in **release** configuration, the result binary will end up in `bin/<platform-name>/<architecture>`, relative to the root of this repository. For example `bin/win32/x64/` or `bin/darwin/x64/`. The JavaScript counterpart of the C++ code expects the binaries to be present in those exact locations, so one would have to build at least once prior to using the application.
36
+
37
+
Inter-process Communication
38
+
==
39
+
This application consists of two separate layers - one `C++` and one `Node.js`. The `C++` layer implements the application's business logic, whereas the `Node.js` layer exists simply for alleviation. Whenever the `Node.js` part is used, it launches the `C++` binary and initiates communication with it. This communication consists of requests **to the binary** via the `stdin` pipe and responses **from the binary** via the `stdout` pipe. Currently the `stderr` pipe is only used for debugging purposes.
40
+
41
+
The nature of this way of communication imposes some quirks:
42
+
* All request messages are marked with an unique identifier which is also present in the response messages. This way the `Node.js` layer can distinguish between different messages and match a request with it's response counterpart
43
+
* All messages are printed in binary on the `stdout` (and the `stderr`) pipe. Each message is prefixed with a 4 byte header, containing the length of the succeeding message. These 4-byte prefixes appear as peculiar symbols in the console whenever one decides to launch the binary directly. This is necessary as the messages have variable length and in addition it alleviates printing from the `C++` code as the strings we want to print might contain `NULL` characters which would otherwise terminate printing.
44
+
36
45
API Reference
37
46
==
38
-
This section contains information about each public method.
47
+
In order to use the application directly one can either launch the binary, either directly or from within an IDE, or use the JavaScript API. Whenever using this library **make sure that there is at least one actual iOS device attached to the system**. This library has no functionality whatsoever without actual devices.
48
+
49
+
## C++ Binary
50
+
Upon launching the binary it will report all devices currently attached in the following form:
After that the binary is ready to accept requests via its standart input. Currently each passed message **must be on one line**, ending with a new line (Enter key) in order for it to be parsed correctly. Each message contains the **name** of the method, which you'd like to invoke, an **identification string** and the **method's arguments**. Messages are processed asynchronously, hence multiple messages can be passed at once. Example messages for the different opperations can be found below:
A detailed definition of all the methods can be found [here](https://github.com/telerik/ios-device-lib/blob/master/typings/interfaces.d.ts#L127)
301
+
302
+
Additional information
303
+
==
304
+
* Upon launching the `ios-device-lib` binary it will immediately start a detached thread with a run loop so that it can proactively detect attaching and detaching of devices.
305
+
* All requests to the binary are executed in separate threads
306
+
***Error understanding:** Whenever an error is raised, for example:
First off you'd need to convert the code to hex (this can easily be done with a calculator application for example). So `-402653081` becomes `FFFFFFFFE8000067` or `E8000067` if we disregard the sign. Using this hex code you can look the error up in [this](https://github.com/samdmarshall/SDMMobileDevice/blob/master/Framework/include/SDMMobileDevice/SDMMD_Error.h) header file. In this example we can see that this is a `kAMDAPIInternalError`, hence an internal error.
0 commit comments