Skip to content

Commit

Permalink
Added amd64 deb package
Browse files Browse the repository at this point in the history
  • Loading branch information
C-Begley committed Apr 12, 2021
1 parent 09499b3 commit 5f17cc2
Show file tree
Hide file tree
Showing 7 changed files with 136 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Examples/PosturePerfection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ cmake_minimum_required(VERSION 3.10)
project(Posture{erfectionNotification)

# add the executable
add_executable(PosturePerfectionReceiver PosturePerfection_receiver.cpp)
add_executable(PosturePerfectionLocalReceiver PosturePerfection_receiver.cpp)
add_executable(PosturePerfectionTestBroadcast PosturePerfection_test_broadcast.cpp)
add_executable(PosturePerfectionReceiver PosturePerfection_receiver_deb_version.cpp)

target_link_libraries(PosturePerfectionReceiver RemoteNotifyReceive)
target_link_libraries(PosturePerfectionLocalReceiver RemoteNotifyReceive)
target_link_libraries(PosturePerfectionTestBroadcast RemoteNotifyBroadcast)
target_link_libraries(PosturePerfectionReceiver RemoteNotifyReceive)

set(CMAKE_CXX_STANDARD 11)
install(TARGETS PosturePerfectionReceiver
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* @file PosturePerfection_receiver.cpp
* @brief Program for running a notification receiver
*
* @copyright Copyright (C) 2021 Conor Begley
*
* This program 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.
*
* This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include <RemoteNotifyReceive.h>
int main(int argc, char *argv[]) {
char current_d[1024];
getcwd(current_d, sizeof(current_d));
std::string image = "/usr/local/share/PosturePerfection/posture-logo-no-text.png" ;
RemoteNotify::Receive receiver(121121, true, "Posture Perfection", image);
while (1) {
receiver.run();
}
return 1;
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Package: PosturePerfectionReceiver
Version: 1.0
Architecture: amd64
Maintainer: ESE-Peasy
Description: A UDP receiver from messages generated by the main PosturePerfection program
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/**
* @file RemoteNotifyReceive.h
* @brief For listening and receiving notifications from
* `RemoteNotify::Broadcast`
*
* @copyright Copyright (C) 2021 Conor Begley
*
* This program 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.
*
* This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
*
*/

#ifndef REMOTENOTIFYRECEIVE_H_
#define REMOTENOTIFYRECEIVE_H_

#include <arpa/inet.h>
#include <errno.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <unistd.h>

#include <cstring>
#include <iostream>
#include <string>

namespace RemoteNotify {
/**
* @brief Error handler for socket connections
*
* @param num The result of socket function
* @param msg Message to be printed also default error message
*/
int err_msg(int num, std::string msg);

/**
* @brief Return result from system command as a string
* @param cmd The system command
*/
std::string GetStringFromCommand(std::string cmd);

/**
* @brief A `RemoteNotify::Receive` for listening and receiving notifications
* from `RemoteNotify::Broadcast`
*
*/
class Receive {
private:
int receive_fd; ///< Receive socket file descriptor
struct sockaddr_in address, ///< Receive address
Broadcast_address; ///< Specific address details for received messages
int addr_len = sizeof(address); ///< Length of address structure
int Broadcast_len =
sizeof(Broadcast_address); ///< Length of Broadcast address structure
std::string command = "notify-send -t 0"; ///< Notify-send command
///< and flags
std::string title; ///< Title of Notify Send message
std::string image; ///< Absolute path of image
std::string middle = "--icon";
char quote = '"';
char space = ' ';

public:
char buffer[1024]; ///< Returned result from broadcasted message
/**
* @brief Constructor for `RemoteNotify::Receive`
*
* @param port Port number to listen on (default is 121121)
* @param ignore Boolean to ignore location where Notify::NotifyReceive is
* running
* @param check_env If `true` will check current desktop environment and
* change notify-send command if needed
*/
Receive(int port = 121121, bool check_env = true,
std::string title = "Remote Notify Send Receive",
std::string image = "");
~Receive();

/**
* @brief Sets the `Notify::NotifyReceive` to start listening
*/
void run();
};
} // namespace RemoteNotify
#endif // SRC_NOTIFICATIONS_Receive_H_
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5f17cc2

Please sign in to comment.