Skip to content

Commit

Permalink
TRS: Add initial template for Transparent Reader Support
Browse files Browse the repository at this point in the history
We borrow the same design ideas from osdp_file.[ch] as that came out
pretty neatly without introducing any regressions to existing
functionality. So to enable TRS, do one of:

    cmake -DCONFIG_OSDP_TRS=on
    (or)
    configure.sh --enable-trs

Signed-off-by: Siddharth Chandrasekaran <[email protected]>
  • Loading branch information
sidcha committed Jul 12, 2021
1 parent 10411bb commit e8db7e1
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 0 deletions.
10 changes: 10 additions & 0 deletions configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ usage() {
--static-pd Setup PD single statically
--lib-only Only build the library
--file Compile support for file tx command
--enable-trs Enable support for Transparant Reader Support
--osdpctl Build osdpctl tool
-f, --force Use this flags to override some checks
-h, --help Print this help
Expand All @@ -41,6 +42,7 @@ while [ $# -gt 0 ]; do
--static-pd) STATIC_PD=1;;
--lib-only) LIB_ONLY=1;;
--file) FILE=1;;
--enable-trs) ENABLE_TRS=1;;
--osdpctl) OSDPCTL=1;;
-f|--force) FORCE=1;;
-h|--help) usage; exit 0;;
Expand Down Expand Up @@ -90,6 +92,10 @@ if [[ ! -z "${FILE}" ]]; then
CCFLAGS+=" -DCONFIG_OSDP_FILE"
fi

if [[ ! -z "${ENABLE_TRS}" ]]; then
CCFLAGS+=" -DCONFIG_OSDP_TRS"
fi

## Repo meta data
echo "Extracting source code meta information"
PROJECT_VERSION=$(perl -ne 'print if s/^project\(libosdp VERSION ([0-9.]+)\)$/\1/' CMakeLists.txt)
Expand Down Expand Up @@ -140,6 +146,10 @@ if [[ ! -z "${FILE}" ]]; then
LIBOSDP_SOURCES+=" src/osdp_file.c"
fi

if [[ ! -z "${ENABLE_TRS}" ]]; then
LIBOSDP_SOURCES+=" src/osdp_trs.c"
fi

if [[ ! -z "${OSDPCTL}" ]]; then
TARGETS+=" osdpctl.elf"
fi
Expand Down
11 changes: 11 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ option(CONFIG_OSDP_PACKET_TRACE "Enable raw packet trace for diagnostics" OFF)
option(CONFIG_OSDP_SKIP_MARK_BYTE "Don't send the leading mark byte (0xFF)" OFF)
option(CONFIG_DISABLE_PRETTY_LOGGING "Don't colorize log ouputs" OFF)
option(CONFIG_OSDP_FILE "Enabled support for OSDP File Transfer" OFF)
option(CONFIG_OSDP_TRS "Enabled Transparent Reader Support" OFF)

if (CONFIG_OSDP_PACKET_TRACE)
list(APPEND LIB_OSDP_DEFINITIONS "-DCONFIG_OSDP_PACKET_TRACE")
Expand All @@ -30,6 +31,10 @@ if (CONFIG_OSDP_FILE)
list(APPEND LIB_OSDP_DEFINITIONS "-DCONFIG_OSDP_FILE")
endif()

if (CONFIG_OSDP_TRS)
list(APPEND LIB_OSDP_DEFINITIONS "-DCONFIG_OSDP_TRS")
endif()

# static and shared library names
set(LIB_OSDP_SHARED osdp)
set(LIB_OSDP_STATIC osdpstatic)
Expand Down Expand Up @@ -63,6 +68,12 @@ if (CONFIG_OSDP_FILE)
)
endif()

if (CONFIG_OSDP_TRS)
list(APPEND LIB_OSDP_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/osdp_trs.c
)
endif()

list(APPEND LIB_OSDP_INCLUDE_DIRS
${PROJECT_SOURCE_DIR}/utils/include
${PROJECT_SOURCE_DIR}/include
Expand Down
1 change: 1 addition & 0 deletions src/osdp_cp.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "osdp_common.h"
#include "osdp_file.h"
#include "osdp_trs.h"

#define LOG_TAG "CP : "

Expand Down
1 change: 1 addition & 0 deletions src/osdp_pd.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "osdp_common.h"
#include "osdp_file.h"
#include "osdp_trs.h"

#ifndef CONFIG_OSDP_STATIC_PD
#include <stdlib.h>
Expand Down
18 changes: 18 additions & 0 deletions src/osdp_trs.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright (c) 2021 Siddharth Chandrasekaran <[email protected]>
*
* SPDX-License-Identifier: Apache-2.0
*/

#ifndef _OSDP_TRS_H_
#define _OSDP_TRS_H_

#include "osdp_common.h"

#ifdef CONFIG_OSDP_TRS

#else /* CONFIG_OSDP_TRS */

#endif /* CONFIG_OSDP_TRS */

#endif /* _OSDP_TRS_H_ */
5 changes: 5 additions & 0 deletions src/osdp_trs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/*
* Copyright (c) 2021 Siddharth Chandrasekaran <[email protected]>
*
* SPDX-License-Identifier: Apache-2.0
*/

0 comments on commit e8db7e1

Please sign in to comment.