Skip to content

Commit

Permalink
Fixed formatting and updated functions for latest commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Ge0rges authored Jun 8, 2017
1 parent 94d6bf5 commit b01adf8
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,22 @@ Add the library and header file into your project, they can be found in the `Syn

## Network Setup
Bundled with Synaction is ConnectivityManager, a MultipeerConnectivity wrapper. Synaction uses it to send data between devices.
1.To set it up, first call `+sharedManagerWithDisplayName:`.
2.On the host device call `-setupBrowser` and on the peers call `-advertiseSelfInSessions:YES`.
3.To present the connection interface, on the view controller present the `browser` (property of the Connectivity Manager).

1. Call `+sharedInstance` on Synaction to initialize it and the connectiivty manager.
2. On the host device call `-setupBrowser` and on the peers call `-advertiseSelfInSessions:YES`.
3. To present the connection interface, on the view controller present the `browser` (property of the Connectivity Manager).

## Synaction Setup
1. First get an instance of Synaction by calling `+sharedInstance`.
2. To execute code at the same time, first calculate the offset with the host, by calling `- calculateTimeOffsetWithHostFromStart:YES` on the peer device(s).
1. First get an instance of Synaction by calling `+sharedManager`.
2. To execute code at the same time, first calculate the offset with the host, by calling `- calculateTimeOffsetWithHost` on the peer device(s) or `- askPeersToCalculateOffset:` on the host.
3. Then use `- atExactTime:(uint64_t)val runBlock:(dispatch_block_t _Nonnull)block` to perform `block` at `val` nano time. `val` should be a value in nanoseconds.
4. To accurately calculate this value you can get the current mach time in nano seconds with `- currentNetworkTime`.
4. To accurately calculate this value you can get the current mach time in nano seconds with `- currentNetworkTime` for network adjusted time (synced) and `- currentTime` for local device time.

##Documentation
Documentation for the various functions will (hopefully) eventually be written. Meanwhile, the function names are pretty self explanatory, otherwise post an issue. If you'd like to contribute to the docs just submit a pull request.

# Credits
Both the connectivity manager, and the core components of the mach time calculations were found online.
Both the connectivity manager, and the core components of the mach time calculations were found online and modified.
[Connectvity Manager](http://stackoverflow.com/a/20907425/2210825 "Stackoverflow Answer")
Mach Time Article: I'm currently not able to find the article from where I pulled this. If you're the author, or have doubts of where it comes from please open an issue!

Expand Down

0 comments on commit b01adf8

Please sign in to comment.