Skip to content

Commit

Permalink
Fixes nasa#2256. Renames LinuxTime into PosixTime implementing new Ti…
Browse files Browse the repository at this point in the history
…me interface
  • Loading branch information
LeStarch committed Oct 13, 2023
1 parent d53627c commit 1c41418
Show file tree
Hide file tree
Showing 20 changed files with 66 additions and 100 deletions.
4 changes: 2 additions & 2 deletions RPI/Top/Components.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <Svc/CmdSequencer/CmdSequencerImpl.hpp>
#include <Svc/PassiveConsoleTextLogger/ConsoleTextLoggerImpl.hpp>
#include <Svc/ActiveLogger/ActiveLoggerImpl.hpp>
#include <Svc/LinuxTime/LinuxTimeImpl.hpp>
#include <Svc/PosixTime/PosixTime.hpp>
#include <Svc/LinuxTimer/LinuxTimerComponentImpl.hpp>
#include <Svc/TlmChan/TlmChanImpl.hpp>
#include <Svc/PrmDb/PrmDbImpl.hpp>
Expand Down Expand Up @@ -45,7 +45,7 @@ extern Svc::ActiveRateGroupImpl rateGroup1HzComp;
extern Svc::CmdSequencerComponentImpl cmdSeq;
extern Svc::ConsoleTextLoggerImpl textLogger;
extern Svc::ActiveLoggerImpl eventLogger;
extern Svc::LinuxTimeImpl linuxTime;
extern Svc::PosixTime posixTime;
extern Svc::LinuxTimerComponentImpl linuxTimer;
extern Svc::TlmChanImpl chanTlm;
extern Svc::CommandDispatcherImpl cmdDisp;
Expand Down
4 changes: 2 additions & 2 deletions RPI/Top/Topology.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Svc::ConsoleTextLoggerImpl textLogger("TLOG");

Svc::ActiveLoggerImpl eventLogger("ELOG");

Svc::LinuxTimeImpl linuxTime("LTIME");
Svc::PosixTime posixTime("LTIME");

Svc::LinuxTimerComponentImpl linuxTimer("LTIMER");

Expand Down Expand Up @@ -102,7 +102,7 @@ void constructApp(U32 port_number, char* hostname) {

eventLogger.init(10,0);

linuxTime.init(0);
posixTime.init(0);

linuxTimer.init(0);

Expand Down
4 changes: 1 addition & 3 deletions RPI/Top/instances.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,7 @@ module RPI {

}

instance linuxTime: Svc.Time base id 1500 \
type "Svc::LinuxTime" \
at "../../Svc/LinuxTime/LinuxTime.hpp"
instance posixTime: Svc.PosixTime base id 1500

instance linuxTimer: Svc.LinuxTimer base id 1600 \
{
Expand Down
4 changes: 2 additions & 2 deletions RPI/Top/topology.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module RPI {
instance gpio24Drv
instance gpio25Drv
instance ledDrv
instance linuxTime
instance posixTime
instance linuxTimer
instance prmDb
instance rateGroup10HzComp
Expand Down Expand Up @@ -53,7 +53,7 @@ module RPI {

text event connections instance textLogger

time connections instance linuxTime
time connections instance posixTime

# ----------------------------------------------------------------------
# Direct graph specifiers
Expand Down
4 changes: 1 addition & 3 deletions Ref/Top/instances.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,7 @@ module Ref {

instance fileUplinkBufferManager: Svc.BufferManager base id 0x4400

instance linuxTime: Svc.Time base id 0x4500 \
type "Svc::LinuxTime" \
at "../../Svc/LinuxTime/LinuxTime.hpp"
instance posixTime: Svc.PosixTime base id 0x4500

instance rateGroupDriverComp: Svc.RateGroupDriver base id 0x4600

Expand Down
4 changes: 2 additions & 2 deletions Ref/Top/topology.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module Ref {
instance fileManager
instance fileUplink
instance fileUplinkBufferManager
instance linuxTime
instance posixTime
instance pingRcvr
instance prmDb
instance rateGroup1Comp
Expand Down Expand Up @@ -69,7 +69,7 @@ module Ref {

text event connections instance textLogger

time connections instance linuxTime
time connections instance posixTime

health connections instance $health

Expand Down
3 changes: 1 addition & 2 deletions Svc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/PolyDb/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/PrmDb/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/RateGroupDriver/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/StaticMemory/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Time/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/TlmChan/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/TlmPacketizer/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/SystemResources/")
Expand All @@ -53,6 +52,6 @@ if (FPRIME_ENABLE_TEXT_LOGGERS)
endif()

if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LinuxTime/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/PosixTime/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LinuxTimer/")
endif()
5 changes: 0 additions & 5 deletions Svc/LinuxTime/README

This file was deleted.

35 changes: 0 additions & 35 deletions Svc/LinuxTime/docs/sdd.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
####
set(SOURCE_FILES
"${CMAKE_CURRENT_LIST_DIR}/PosixTime.fpp"
"${CMAKE_CURRENT_LIST_DIR}/PosixTimecpp"
"${CMAKE_CURRENT_LIST_DIR}/PosixTime.cpp"
)

register_fprime_module()
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Svc {
@ A component for getting time
passive component LinuxTime {
passive component PosixTime {
include "../Interfaces/Time.fppi"
}
}
File renamed without changes.
30 changes: 30 additions & 0 deletions Svc/PosixTime/docs/sdd.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
\page SvcPosixTime Svc::PosixTime Component
# Svc::PosixTime Component

## 1. Introduction

The `Svc::PosixTime` is a component that provides system time on Posix systems. It implements the Time interface.

## 2. Requirements

| Requirement | Description | Verification |
|--------------------|-----------------------------------------------------------------------------------------------------------------------|--------------|
| SVC-POSIX-TIME-001 | `Svc::PosixTime` shall return current system time as an `Fw::Time` objects in response to the `timeGetPort` port call | Unit Test |

## 3. Design

`Svc::PosixTime` has a single port. It has no data types, commands, events, telemetry channels, nor substantial algorithms.

### 3.1 Ports

| Port | Kind | Data Type | Description |
|---------------|------------|-----------|--------------------------------------|
| `timeGetPort` | sync input | `Fw.Time` | Port returning current system design |

## 7. Change Log

Date | Description
---- | -----------
4/20/2017 | Initial Version
10/12/2023 | Reworked into `Svc::PosixTime`

Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// Main.cpp
// ----------------------------------------------------------------------

#include "LinuxTimeTester.hpp"
#include "PosixTimeTester.hpp"

TEST(Test, GetTime) {
Svc::LinuxTimeTester tester("Tester");
Svc::PosixTimeTester tester("Tester");
tester.getTime();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// ----------------------------------------------------------------------
// LinuxTime/test/ut/Tester.cpp
// PosixTime/test/ut/Tester.cpp
// ----------------------------------------------------------------------

#include <cstdio>
#include <strings.h>

#include "LinuxTimeTester.hpp"
#include "PosixTimeTester.hpp"

#define INSTANCE 0

Expand All @@ -15,21 +15,21 @@ namespace Svc {
// Construction and destruction
// ----------------------------------------------------------------------

LinuxTimeTester ::
LinuxTimeTester(const char *const compName) :
TimeGTestBase(compName, 0),
linuxTime("LinuxTime")
PosixTimeTester ::
PosixTimeTester(const char *const compName) :
PosixTimeGTestBase(compName, 0),
component("PosixTime")
{
this->init();
this->linuxTime.init(INSTANCE);
this->component.init(INSTANCE);
this->connect_to_timeGetPort(
0,
this->linuxTime.get_timeGetPort_InputPort(0)
this->component.get_timeGetPort_InputPort(0)
);
}

LinuxTimeTester ::
~LinuxTimeTester()
PosixTimeTester ::
~PosixTimeTester()
{

}
Expand All @@ -38,13 +38,11 @@ namespace Svc {
// Tests
// ----------------------------------------------------------------------

void LinuxTimeTester ::
void PosixTimeTester ::
getTime()
{
Fw::Time time;
this->invoke_to_timeGetPort(0,time);
//printf("seconds: %d\n", time.getSeconds());
//printf("useconds: %d\n", time.getUSeconds());
ASSERT_GT(time.getSeconds(), 0U);
ASSERT_GE(time.getUSeconds(), 0U);
ASSERT_LE(time.getUSeconds(), 999999U);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// ----------------------------------------------------------------------
// LinuxTimeTester.hpp
// PosixTimeTester.hpp
// ----------------------------------------------------------------------

#ifndef TESTER_HPP
#define TESTER_HPP
#ifndef POSIXTIME_TESTER_HPP
#define POSIXTIME_TESTER_HPP

#include "../../LinuxTimeImpl.hpp"
#include "TimeGTestBase.hpp"
#include "Svc/PosixTime/PosixTime.hpp"
#include "PosixTimeGTestBase.hpp"

namespace Svc {

class LinuxTimeTester :
public TimeGTestBase
class PosixTimeTester :
public PosixTimeGTestBase
{

// ----------------------------------------------------------------------
Expand All @@ -20,9 +20,9 @@ namespace Svc {

public:

LinuxTimeTester(const char *const compName);
PosixTimeTester(const char *const compName);

~LinuxTimeTester();
~PosixTimeTester();

// ----------------------------------------------------------------------
// Tests
Expand All @@ -38,7 +38,7 @@ namespace Svc {

private:

LinuxTimeImpl linuxTime;
PosixTime component;

};

Expand Down
13 changes: 0 additions & 13 deletions Svc/Time/CMakeLists.txt

This file was deleted.

3 changes: 0 additions & 3 deletions Svc/Time/README

This file was deleted.

1 change: 0 additions & 1 deletion Svc/Time/docs/.gitignore

This file was deleted.

0 comments on commit 1c41418

Please sign in to comment.