Skip to content

Commit

Permalink
feat: add file header with license copyright
Browse files Browse the repository at this point in the history
  • Loading branch information
tishion committed Jun 13, 2024
1 parent 0da6958 commit 4b974ff
Show file tree
Hide file tree
Showing 104 changed files with 2,327 additions and 532 deletions.
23 changes: 22 additions & 1 deletion include/ap_config.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
#ifndef AP_CONFIG_H
/*
* File: ap_config.h
* Project: apsdk
* Created: Oct 25, 2018
* Author: Sheen Tian
*
* This file is part of apsdk (https://github.com/air-display/apsdk-public)
* Copyright (C) 2018-2024 Sheen Tian
*
* apsdk is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
*
* apsdk is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Foobar.
* If not, see <https://www.gnu.org/licenses/>.
*/

#ifndef AP_CONFIG_H
#define AP_CONFIG_H
#pragma once

Expand Down
22 changes: 21 additions & 1 deletion include/ap_export.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@

/*
* File: ap_export.h
* Project: apsdk
* Created: Oct 25, 2018
* Author: Sheen Tian
*
* This file is part of apsdk (https://github.com/air-display/apsdk-public)
* Copyright (C) 2018-2024 Sheen Tian
*
* apsdk is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
*
* apsdk is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Foobar.
* If not, see <https://www.gnu.org/licenses/>.
*/

#ifndef AP_EXPORT_H
#define AP_EXPORT_H

Expand Down
23 changes: 22 additions & 1 deletion include/ap_handler.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
#ifndef AP_HANDLER_H
/*
* File: ap_handler.h
* Project: apsdk
* Created: Oct 25, 2018
* Author: Sheen Tian
*
* This file is part of apsdk (https://github.com/air-display/apsdk-public)
* Copyright (C) 2018-2024 Sheen Tian
*
* apsdk is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
*
* apsdk is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Foobar.
* If not, see <https://www.gnu.org/licenses/>.
*/

#ifndef AP_HANDLER_H
#define AP_HANDLER_H
#pragma once

Expand Down
23 changes: 22 additions & 1 deletion include/ap_server.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
#ifndef AP_SERVER_H
/*
* File: ap_server.h
* Project: apsdk
* Created: Oct 25, 2018
* Author: Sheen Tian
*
* This file is part of apsdk (https://github.com/air-display/apsdk-public)
* Copyright (C) 2018-2024 Sheen Tian
*
* apsdk is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
*
* apsdk is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Foobar.
* If not, see <https://www.gnu.org/licenses/>.
*/

#ifndef AP_SERVER_H
#define AP_SERVER_H
#pragma once

Expand Down
23 changes: 22 additions & 1 deletion include/ap_session.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
#ifndef AP_SESSION_H
/*
* File: ap_session.h
* Project: apsdk
* Created: Oct 25, 2018
* Author: Sheen Tian
*
* This file is part of apsdk (https://github.com/air-display/apsdk-public)
* Copyright (C) 2018-2024 Sheen Tian
*
* apsdk is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
*
* apsdk is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Foobar.
* If not, see <https://www.gnu.org/licenses/>.
*/

#ifndef AP_SESSION_H
#define AP_SESSION_H
#pragma once

Expand Down
23 changes: 22 additions & 1 deletion include/ap_types.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
#ifndef AP_TYPES_H
/*
* File: ap_types.h
* Project: apsdk
* Created: Oct 25, 2018
* Author: Sheen Tian
*
* This file is part of apsdk (https://github.com/air-display/apsdk-public)
* Copyright (C) 2018-2024 Sheen Tian
*
* apsdk is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
*
* apsdk is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Foobar.
* If not, see <https://www.gnu.org/licenses/>.
*/

#ifndef AP_TYPES_H
#define AP_TYPES_H
#pragma once
#pragma once
Expand Down
23 changes: 22 additions & 1 deletion include/aps.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
#ifndef APS_H
/*
* File: aps.h
* Project: apsdk
* Created: Oct 25, 2018
* Author: Sheen Tian
*
* This file is part of apsdk (https://github.com/air-display/apsdk-public)
* Copyright (C) 2018-2024 Sheen Tian
*
* apsdk is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
*
* apsdk is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Foobar.
* If not, see <https://www.gnu.org/licenses/>.
*/

#ifndef APS_H
#define APS_H

#include <ap_config.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
/*
* File: ExampleInstrumentedTest.java
* Project: apsdk
* Created: Oct 25, 2018
* Author: Sheen Tian
*
* This file is part of apsdk (https://github.com/air-display/apsdk-public)
* Copyright (C) 2018-2024 Sheen Tian
*
* apsdk is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
*
* apsdk is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Foobar.
* If not, see <https://www.gnu.org/licenses/>.
*/

package com.sheentech.apsdk;

import android.content.Context;
Expand Down
55 changes: 33 additions & 22 deletions platforms/android/apsdk/apsdk/src/main/cpp/AirPlayServer.cpp
Original file line number Diff line number Diff line change
@@ -1,33 +1,47 @@
//
// Created by shiontian on 11/11/2018.
//
/*
* File: AirPlayServer.cpp
* Project: apsdk
* Created: Oct 25, 2018
* Author: Sheen Tian
*
* This file is part of apsdk (https://github.com/air-display/apsdk-public)
* Copyright (C) 2018-2024 Sheen Tian
*
* apsdk is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
*
* apsdk is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Foobar.
* If not, see <https://www.gnu.org/licenses/>.
*/

// clang-format off
#include "AirPlayServer.h"
// clang-format on

DEFINE_NCI_METHODS(AirPlayServer);

extern "C" JNIEXPORT jboolean JNICALL
Java_com_sheentech_apsdk_AirPlayServer_nciStart(JNIEnv *env, jobject thiz) {
extern "C" JNIEXPORT jboolean JNICALL Java_com_sheentech_apsdk_AirPlayServer_nciStart(JNIEnv *env, jobject thiz) {
return static_cast<jboolean>(AirPlayServer::get(env, thiz)->start());
}

extern "C" JNIEXPORT void JNICALL
Java_com_sheentech_apsdk_AirPlayServer_nciStop(JNIEnv *env, jobject thiz) {
extern "C" JNIEXPORT void JNICALL Java_com_sheentech_apsdk_AirPlayServer_nciStop(JNIEnv *env, jobject thiz) {
AirPlayServer::get(env, thiz)->stop();
}

extern "C" JNIEXPORT void JNICALL
Java_com_sheentech_apsdk_AirPlayServer_nciSetConfig(JNIEnv *env, jobject thiz,
jobject config) {
extern "C" JNIEXPORT void JNICALL Java_com_sheentech_apsdk_AirPlayServer_nciSetConfig(JNIEnv *env, jobject thiz,
jobject config) {
env->DeleteLocalRef(config);
AirPlayConfig airPlayConfig = AirPlayConfig::attach(env, config);
AirPlayServer::get(env, thiz)->setConfig(airPlayConfig);
}

extern "C" JNIEXPORT void JNICALL
Java_com_sheentech_apsdk_AirPlayServer_nciSetHandler(JNIEnv *env, jobject thiz,
jobject handler) {
extern "C" JNIEXPORT void JNICALL Java_com_sheentech_apsdk_AirPlayServer_nciSetHandler(JNIEnv *env, jobject thiz,
jobject handler) {
if (handler) {
auto airplayHandler = IAirPlayHandler::attach(env, handler);
if (airplayHandler) {
Expand All @@ -38,14 +52,11 @@ Java_com_sheentech_apsdk_AirPlayServer_nciSetHandler(JNIEnv *env, jobject thiz,
}
}

extern "C" JNIEXPORT jint JNICALL
Java_com_sheentech_apsdk_AirPlayServer_nciGetServicePort(JNIEnv *env,
jobject thiz) {
extern "C" JNIEXPORT jint JNICALL Java_com_sheentech_apsdk_AirPlayServer_nciGetServicePort(JNIEnv *env, jobject thiz) {
return AirPlayServer::get(env, thiz)->getServicePort();
}

AirPlayServer::AirPlayServer(JNIEnv *env)
: nci_object<AirPlayServer, AirPlayServer_cls>() {
AirPlayServer::AirPlayServer(JNIEnv *env) : nci_object<AirPlayServer, AirPlayServer_cls>() {
(void)env;
aps::ap_server::setJavaVM(getJavaVM());
server_ = std::make_shared<ap_server>();
Expand All @@ -70,17 +81,17 @@ void AirPlayServer::setConfig(const AirPlayConfig &config) {
const char *s = 0;

// Get the server name
jstring name = (jstring) config.name();
jstring name = (jstring)config.name();
s = env->GetStringUTFChars(name, 0);
cfg->name(s);
env->ReleaseStringUTFChars(name, s);

// Get publish service flag
jboolean publishService = (jboolean) config.publishService();
jboolean publishService = (jboolean)config.publishService();
cfg->publishService(publishService);

// Get the mac address
jstring macAddress = (jstring) config.macAddress();
jstring macAddress = (jstring)config.macAddress();
s = env->GetStringUTFChars(macAddress, 0);
cfg->macAddress(s);
env->ReleaseStringUTFChars(macAddress, s);
Expand All @@ -105,5 +116,5 @@ uint16_t AirPlayServer::getServicePort() {
if (server_) {
return server_->get_service_port();
}
return static_cast<uint16_t >(-1);
return static_cast<uint16_t>(-1);
}
23 changes: 20 additions & 3 deletions platforms/android/apsdk/apsdk/src/main/cpp/AirPlayServer.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
//
// Created by shiontian on 11/11/2018.
//
/*
* File: AirPlayServer.h
* Project: apsdk
* Created: Oct 25, 2018
* Author: Sheen Tian
*
* This file is part of apsdk (https://github.com/air-display/apsdk-public)
* Copyright (C) 2018-2024 Sheen Tian
*
* apsdk is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
*
* apsdk is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Foobar.
* If not, see <https://www.gnu.org/licenses/>.
*/

#ifndef APS_SDK_AIRPLAY_SERVER_H
#define APS_SDK_AIRPLAY_SERVER_H
Expand Down
Loading

0 comments on commit 4b974ff

Please sign in to comment.