<commit_before>QuietModemKit
==============

This is the iOS framework for https://github.com/quiet/quiet

With this library, you can send data through sound.

Other platforms:
* Javascript: https://github.com/quiet/quiet-js
* Android: https://github.com/quiet/org.quietmodem.Quiet

Building
--------------
It is recommended that you use Carthage to build QuietModemKit. Simply add `github "Quiet/QuietModemKit"` to your Cartfile and run `carthage update`.

Example
--------------
Transmitter:
```objc
#import <QuietModemKit/QuietModemKit.h>

int main(int argc, char * argv[]) {
    QMTransmitterConfig *txConf = [[QMTransmitterConfig alloc] initWithKey:@"ultrasonic-experimental"];

    QMFrameTransmitter *tx = [[QMFrameTransmitter alloc] initWithConfig:txConf];

    NSString *frame_str = @"asdfsd";
    NSData *frame = [frame_str dataUsingEncoding:NSUTF8StringEncoding];
    [tx send:frame];

    CFRunLoopRun();
    return 0;
}

```

Receiver:
```objc
#import <QuietModemKit/QuietModemKit.h>

void (^request_callback)(BOOL) = ^(BOOL granted){
    QMReceiverConfig *rxConf = [[QMReceiverConfig alloc] initWithKey:@"ultrasonic-experimental"];

    QMFrameReceiver *rx = [[QMFrameReceiver alloc] initWithConfig:rxConf];

    sleep(8);
    NSData *rcv = [rx receive];
    printf("%s\n", [rcv bytes]);
};

int main(int argc, char * argv[]) {
    [[AVAudioSession sharedInstance] requestRecordPermission:request_callback];

    CFRunLoopRun();
    return 0;
}
```

Note that we ask for the Record permission. This is required to use the receiver.

License
--------------
3-Claused BSD, plus third-party licenses (mix of MIT and BSD, see licenses/)<commit_msg>update examples to use receive callback<commit_after>QuietModemKit
==============

This is the iOS framework for https://github.com/quiet/quiet

With this library, you can send data through sound.

Other platforms:
* Javascript: https://github.com/quiet/quiet-js
* Android: https://github.com/quiet/org.quietmodem.Quiet

Building
--------------
It is recommended that you use Carthage to build QuietModemKit. Simply add `github "Quiet/QuietModemKit"` to your Cartfile and run `carthage update`.

Example
--------------
Transmitter:
```objc
#import <QuietModemKit/QuietModemKit.h>

int main(int argc, char * argv[]) {
    QMTransmitterConfig *txConf = [[QMTransmitterConfig alloc] initWithKey:@"ultrasonic-experimental"];

    QMFrameTransmitter *tx = [[QMFrameTransmitter alloc] initWithConfig:txConf];

    NSString *frame_str = @"asdfsd";
    NSData *frame = [frame_str dataUsingEncoding:NSUTF8StringEncoding];
    [tx send:frame];

    CFRunLoopRun();

    [tx close];

    return 0;
}

```

Receiver:
```objc
#import <QuietModemKit/QuietModemKit.h>

static QMFrameReceiver *rx;

void (^recv_callback)(NSData*) = ^(NSData *frame){
    printf("%s\n", [frame bytes]);
};

void (^request_callback)(BOOL) = ^(BOOL granted){
    QMReceiverConfig *rxConf = [[QMReceiverConfig alloc] initWithKey:@"ultrasonic-experimental"];
    rx = [[QMFrameReceiver alloc] initWithConfig:rxConf];
    [rx setReceiveCallback:recv_callback];
};

int main(int argc, char * argv[]) {
    [[AVAudioSession sharedInstance] requestRecordPermission:request_callback];

    CFRunLoopRun();

    if (rx != nil) {
        [rx close];
    }

    return 0;
}
```

Note that we ask for the Record permission. This is required to use the receiver.

License
--------------
3-Claused BSD, plus third-party licenses (mix of MIT and BSD, see licenses/)
{'fraction_non_alphanumeric': 0.14771091275554277, 'fraction_numerical': 0.002591419522027066, 'mean_word_length': 4.1390532544378695, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3534047', 'n_tokens_mistral': 1149, 'n_tokens_neox': 1069, 'n_words': 298}