forked from Samsung/TizenRT
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src/lw_aifw: Add missing AIFW source files
framework/src/lw_aifw: Add files missed in previous commit: c340cfe
- Loading branch information
1 parent
c340cfe
commit 534abcd
Showing
8 changed files
with
155 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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,45 @@ | ||
/**************************************************************************** | ||
* | ||
* Copyright 2023 Samsung Electronics All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
* either express or implied. See the License for the specific | ||
* language governing permissions and limitations under the License. | ||
* | ||
****************************************************************************/ | ||
|
||
#pragma once | ||
#include <stdint.h> | ||
#include <stdio.h> | ||
#include "lw_aifw/lw_aifw_result.h" | ||
#include "AICSVReader.h" | ||
|
||
namespace lw_aifw { | ||
|
||
class AICSVArrayReader : public AICSVReader { | ||
private: | ||
char *m_Header; | ||
uint16_t m_SensorLength; | ||
float *m_DataValues; | ||
int m_SensorCount; | ||
uint16_t m_RowCount; | ||
uint16_t m_RowOffset; | ||
LW_AIFW_RESULT read(float *&values, uint16_t &numberofValues); | ||
public: | ||
AICSVArrayReader(float *datavalues, uint16_t sensorCount, uint16_t rowCount); | ||
~AICSVArrayReader(); | ||
LW_AIFW_RESULT init(void); | ||
LW_AIFW_RESULT getSourceData(void); | ||
uint16_t getSensorCount(void) const; | ||
}; | ||
|
||
} /* lw_aifw */ | ||
|
This file contains 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,62 @@ | ||
/**************************************************************************** | ||
* | ||
* Copyright 2023 Samsung Electronics All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
* either express or implied. See the License for the specific | ||
* language governing permissions and limitations under the License. | ||
* | ||
****************************************************************************/ | ||
|
||
#ifdef CONFIG_LW_AIFW_READ_FROM_FS | ||
|
||
#pragma once | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <ctype.h> | ||
#include <errno.h> | ||
#include "lw_aifw/lw_aifw_result.h" | ||
#include "AICSVReader.h" | ||
|
||
#define LINESIZE 256 | ||
#define MAX_FIELDS 30 | ||
#define MAX_PARAMSIZE 32 | ||
|
||
namespace lw_aifw { | ||
|
||
class AICSVFileReader: public AICSVReader { | ||
private: | ||
const char *mFileName; | ||
char mLine[LINESIZE + 1]; | ||
char mParams[MAX_FIELDS + 1][MAX_PARAMSIZE + 1]; | ||
int mLineNumber; | ||
int mTotalColumns; | ||
FILE *mFile; | ||
fpos_t mPosition; | ||
char *skipSpace(char *ptr); | ||
char *copyParam(char *src, char *dest); | ||
char *findParam(char *ptr); | ||
char *getParam(unsigned int field); | ||
int getCurrentLineNo(void); | ||
char *getLine(void); | ||
LW_AIFW_RESULT readLine(void); | ||
int parseCSVLine(char *ptr); | ||
public: | ||
AICSVFileReader(const char *filename); | ||
~AICSVFileReader(); | ||
LW_AIFW_RESULT init(void); | ||
int getTotalColumns(void); | ||
LW_AIFW_RESULT getSourceData(void); | ||
}; | ||
|
||
} /* lw_aifw */ | ||
|
||
#endif /* CONFIG_LW_AIFW_READ_FROM_FS */ |
This file contains 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,40 @@ | ||
/**************************************************************************** | ||
* | ||
* Copyright 2023 Samsung Electronics All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
* either express or implied. See the License for the specific | ||
* language governing permissions and limitations under the License. | ||
* | ||
****************************************************************************/ | ||
|
||
#pragma once | ||
|
||
#include <stdint.h> | ||
#include "lw_aifw/lw_aifw_result.h" | ||
|
||
namespace lw_aifw { | ||
typedef void (*rawDataCollectedListener)(LW_AIFW_RESULT result, float *data, uint16_t dataCount, void *args); | ||
|
||
class AICSVReader { | ||
protected: | ||
rawDataCollectedListener mRawDataCollectedListener; | ||
/* ToDo: plan to use std::function & remove mRawDataCollectedCBArgs */ | ||
void *mRawDataCollectedCBArgs; | ||
public: | ||
AICSVReader(); | ||
virtual ~AICSVReader(); | ||
virtual void setRawDataCollectedListener(rawDataCollectedListener listener, void *calbackFuncArgs); | ||
virtual LW_AIFW_RESULT init(void) = 0; | ||
virtual LW_AIFW_RESULT getSourceData(void) = 0; | ||
}; | ||
|
||
} /* lw_aifw */ |