-
Notifications
You must be signed in to change notification settings - Fork 6
Preparation for library based QR-Code generation - setup identifier #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cduvenhorst
wants to merge
3
commits into
mongoose-os-libs:master
Choose a base branch
from
cduvenhorst:setupPayload
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+458
−110
Open
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// Copyright (c) 2015-2019 The HomeKit ADK Contributors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the “License”); | ||
// you may not use this file except in compliance with the License. | ||
// See [CONTRIBUTORS.md] for the list of HomeKit ADK project authors. | ||
|
||
#ifndef HAP_PLATFORM_ACCESSORY_SETUP_DISPLAY_INIT_H | ||
#define HAP_PLATFORM_ACCESSORY_SETUP_DISPLAY_INIT_H | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#include "HAPPlatform.h" | ||
|
||
#if __has_feature(nullability) | ||
#pragma clang assume_nonnull begin | ||
#endif | ||
|
||
#ifndef HAVE_DISPLAY | ||
#define HAVE_DISPLAY 0 | ||
#endif | ||
|
||
/**@file | ||
* Accessory setup display. | ||
* | ||
* - The HAPLog APIs are used to display the setup payload and setup code. | ||
* For a real display the implementation needs to be adjusted. | ||
* | ||
* **Example** | ||
|
||
@code{.c} | ||
|
||
// Allocate Accessory setup display. | ||
static HAPPlatformAccessorySetupDisplay setupDisplay; | ||
|
||
// Initialize Accessory setup display. | ||
HAPPlatformAccessorySetupDisplayCreate(&setupDisplay); | ||
|
||
@endcode | ||
*/ | ||
|
||
/** | ||
* Accessory setup display. | ||
*/ | ||
struct HAPPlatformAccessorySetupDisplay { | ||
// Opaque type. Do not access the instance fields directly. | ||
/**@cond */ | ||
HAPSetupPayload setupPayload; | ||
HAPSetupCode setupCode; | ||
bool setupPayloadIsSet : 1; | ||
bool setupCodeIsSet : 1; | ||
/**@endcond */ | ||
}; | ||
|
||
/** | ||
* Initializes Accessory setup display. | ||
* | ||
* @param[out] setupDisplay Accessory setup display. | ||
*/ | ||
void HAPPlatformAccessorySetupDisplayCreate(HAPPlatformAccessorySetupDisplayRef setupDisplay); | ||
|
||
#if __has_feature(nullability) | ||
#pragma clang assume_nonnull end | ||
#endif | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright (c) 2015-2019 The HomeKit ADK Contributors | ||
// Copyright (c) 2019 Deomid "rojer" Ryabkov | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the “License”); | ||
// you may not use this file except in compliance with the License. | ||
// See [CONTRIBUTORS.md] for the list of HomeKit ADK project authors. | ||
|
||
#include <errno.h> | ||
#include <stdlib.h> | ||
#include <unistd.h> | ||
#include <sys/types.h> | ||
#include <sys/wait.h> | ||
#include <stdio.h> | ||
|
||
#include "mgos.h" | ||
#include "mgos_hap.h" | ||
|
||
#include "HAPPlatform.h" | ||
#include "HAPPlatformAccessorySetupDisplay+Init.h" | ||
|
||
void HAPPlatformAccessorySetupDisplayCreate(HAPPlatformAccessorySetupDisplayRef setupDisplay) { | ||
HAPPrecondition(HAVE_DISPLAY); | ||
HAPPrecondition(setupDisplay); | ||
|
||
HAPRawBufferZero(setupDisplay, sizeof *setupDisplay); | ||
} | ||
|
||
void HAPPlatformAccessorySetupDisplayUpdateSetupPayload( | ||
HAPPlatformAccessorySetupDisplayRef setupDisplay, | ||
const HAPSetupPayload* _Nullable setupPayload, | ||
const HAPSetupCode* _Nullable setupCode) { | ||
|
||
struct mgos_hap_display_update_setup_payload_arg arg = { | ||
.setupDisplay = setupDisplay, | ||
.setupPayload = setupPayload, | ||
.setupCode = setupCode, | ||
}; | ||
|
||
mgos_event_trigger(MGOS_HAP_EV_DISPLAY_UPDATE_SETUP_PAYLOAD, &arg); | ||
} | ||
|
||
void HAPPlatformAccessorySetupDisplayHandleStartPairing(HAPPlatformAccessorySetupDisplayRef setupDisplay) { | ||
struct mgos_hap_display_start_pairing_arg arg = { | ||
.setupDisplay = setupDisplay, | ||
}; | ||
mgos_event_trigger(MGOS_HAP_EV_DISPLAY_START_PAIRING, &arg); | ||
} | ||
|
||
void HAPPlatformAccessorySetupDisplayHandleStopPairing(HAPPlatformAccessorySetupDisplayRef setupDisplay) { | ||
struct mgos_hap_display_stop_pairing_arg arg = { | ||
.setupDisplay = setupDisplay, | ||
}; | ||
mgos_event_trigger(MGOS_HAP_EV_DISPLAY_STOP_PAIRING, &arg); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (c) 2015-2019 The HomeKit ADK Contributors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the “License”); | ||
// you may not use this file except in compliance with the License. | ||
// See [CONTRIBUTORS.md] for the list of HomeKit ADK project authors. | ||
|
||
#include "mgos.h" | ||
#include "mgos_hap.h" | ||
|
||
#include "HAPPlatform.h" | ||
|
||
#ifndef HAVE_NFC | ||
#define HAVE_NFC 0 | ||
#endif | ||
|
||
#if HAVE_NFC | ||
#include <errno.h> | ||
#include <unistd.h> | ||
#endif | ||
|
||
void HAPPlatformAccessorySetupNFCUpdateSetupPayload( | ||
HAPPlatformAccessorySetupNFCRef setupNFC, | ||
const HAPSetupPayload* setupPayload, | ||
bool isPairable) { | ||
struct mgos_hap_nfc_update_setup_payload_arg arg = { | ||
.setupNFC = setupNFC, | ||
.setupPayload = setupPayload, | ||
.isPairable = isPairable, | ||
}; | ||
mgos_event_trigger(MGOS_HAP_EV_NFC_UPDATE_SETUP_PAYLOAD, &arg); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooops. Will be corrected ..