Skip to content
This repository was archived by the owner on Oct 5, 2020. It is now read-only.

Commit 08b416f

Browse files
committed
Update README
1 parent 53b5d75 commit 08b416f

File tree

7 files changed

+48
-21
lines changed

7 files changed

+48
-21
lines changed

chirpsdk/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Chirp License.
22

3-
This software is copyright © 2011-2018, Asio Ltd. All rights reserved.
3+
This software is copyright © 2011-2019, Asio Ltd. All rights reserved.
44

55
This software is provided under license from Asio Ltd. It is to be used only in accordance with our Fair Use Policy, available at
66

chirpsdk/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,41 @@ Sign up at the Chirp [Developer Hub](https://developers.chirp.io/sign-up)
99
Copy and paste your Chirp app key, secret and chosen configuration into the
1010
[example application](https://github.com/chirp/chirp-connect-flutter/tree/master/chirpsdk/example)
1111

12+
## Configuration
13+
14+
It is recommended to use the example code as a template, but in short, configuring the
15+
SDK is as simple as initialising with your credentials and chosen configuration, and starting
16+
the audio processing.
17+
18+
await ChirpSDK.init(_appKey, _appSecret);
19+
await ChirpSDK.setConfig(_appConfig);
20+
await ChirpSDK.start();
21+
22+
## Sending
23+
24+
Chirp SDKs accept data as an array of bytes, creating a versatile interface for all kinds of data.
25+
However in most cases, Chirp is used to send a short identifier. Here is an example of how to send
26+
a short string with the Chirp SDK.
27+
28+
String identifier = "hello";
29+
var payload = new Uint8List.fromList(identifier.codeUnits);
30+
await ChirpSDK.send(payload);
31+
32+
It is worth noting here that the send method will not block until the entire payload has been sent,
33+
but just as long as it takes to pass the message to the SDK. Please use the onSent callback for this
34+
purpose.
35+
36+
## Receiving
37+
38+
To receive data you can listen for received events like so
39+
40+
ChirpSDK.onReceived.listen((e) {
41+
String identifier = new String.fromCharCodes(e.payload);
42+
});
43+
44+
A received event includes the `payload` and the `channel` for multichannel configurations.
45+
There are several other callbacks available which are illustrated in the example.
46+
1247
## Contributions
1348

1449
This project aims to be a community driven project and is open to contributions.

chirpsdk/android/src/main/kotlin/io/chirp/chirpsdk/ChirpsdkPlugin.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class ChirpsdkPlugin(val activity: Activity) : MethodCallHandler {
5151

5252
override fun onMethodCall(call: MethodCall, result: Result) {
5353

54-
if (call.method == "initialise") {
54+
if (call.method == "init") {
5555
val arguments = call.arguments as java.util.HashMap<String, String>
5656
val appKey = arguments["key"] as String
5757
val appSecret = arguments["secret"] as String

chirpsdk/example/README.md

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
1-
# chirpsdk_example
1+
# ChirpSDK Example
22

3-
Demonstrates how to use the chirpsdk plugin.
3+
Demonstrates how to use the ChirpSDK plugin.
44

55
## Getting Started
66

7-
This project is a starting point for a Flutter application.
7+
This project is a starting point for a Flutter application using Chirp.
88

9-
A few resources to get you started if this is your first Flutter project:
10-
11-
- [Lab: Write your first Flutter app](https://flutter.io/docs/get-started/codelab)
12-
- [Cookbook: Useful Flutter samples](https://flutter.io/docs/cookbook)
13-
14-
For help getting started with Flutter, view our
15-
[online documentation](https://flutter.io/docs), which offers tutorials,
16-
samples, guidance on mobile development, and a full API reference.
9+
- [Example Code](https://github.com/chirp/chirp-connect-flutter/tree/master/chirpsdk/example)

chirpsdk/example/lib/main.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ class _ChirpAppState extends State<ChirpApp> with WidgetsBindingObserver {
2626
String _chirpVersion = 'Unknown';
2727
Uint8List _chirpData = Uint8List(0);
2828

29-
Future<void> _initialiseChirp() async {
30-
await ChirpSDK.initialise(_appKey, _appSecret);
29+
Future<void> _initChirp() async {
30+
await ChirpSDK.init(_appKey, _appSecret);
3131
}
3232

3333
Future<void> _configureChirp() async {
@@ -92,7 +92,7 @@ class _ChirpAppState extends State<ChirpApp> with WidgetsBindingObserver {
9292
void initState() {
9393
super.initState();
9494
_requestPermissions();
95-
_initialiseChirp();
95+
_initChirp();
9696
_configureChirp();
9797
_getChirpVersion();
9898
_setChirpCallbacks();

chirpsdk/ios/Classes/ChirpsdkPlugin.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
4949
}
5050

5151
- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
52-
if ([@"initialise" isEqualToString:call.method]) {
52+
if ([@"init" isEqualToString:call.method]) {
5353
NSString *key = call.arguments[@"key"];
5454
NSString *secret = call.arguments[@"secret"];
5555
self.connect = [[ChirpConnect alloc] initWithAppKey:key

chirpsdk/lib/chirpsdk.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ class ChirpSDK {
1919
static const EventChannel _sentEvents = const EventChannel('chirp.io/events/sent');
2020
static const EventChannel _receivingEvents = const EventChannel('chirp.io/events/receiving');
2121
static const EventChannel _receivedEvents = const EventChannel('chirp.io/events/received');
22-
static const EventChannel _volumeEvents = const EventChannel('chirp.io/events/volume');
2322
static const EventChannel _errorEvents = const EventChannel('chirp.io/events/errors');
2423

2524
/// Initialise the ChirpSDK
@@ -28,9 +27,9 @@ class ChirpSDK {
2827
/// up for Chirp at the Developer Hub[1].
2928
///
3029
/// [1]: https://developers.chirp.io
31-
static Future<void> initialise(String key, String secret) async {
30+
static Future<void> init(String key, String secret) async {
3231
var parameters = { 'key': key, 'secret': secret };
33-
await _methods.invokeMethod('initialise', new Map.from(parameters));
32+
await _methods.invokeMethod('init', new Map.from(parameters));
3433
}
3534

3635
/// Get the Chirp SDK version info as a string
@@ -84,7 +83,7 @@ class ChirpSDK {
8483
await _methods.invokeMethod('sendRandom');
8584
}
8685

87-
/// Check if payload is valid for the current configuration
86+
// Check if payload is valid for the current configuration
8887
// static Future<bool> isValidPayload(Uint8List payload) async {
8988
// final bool valid = await _methods.invokeMethod('isValidPayload', payload);
9089
// return valid;

0 commit comments

Comments
 (0)