starting integration into workflow

This commit is contained in:
Mario Fink 2019-04-29 18:01:34 +02:00
parent 789e6913b0
commit a4a8aa91c2
3 changed files with 45 additions and 0 deletions

View File

@ -267,6 +267,23 @@ int tdm_ripper::convert_int(std::vector<unsigned char> bych)
return df;
}
// disassemble single integer into array of chars
std::vector<unsigned char> tdm_ripper::convert_int(int df)
{
assert( endianness_ );
std::vector<unsigned char> bych((int)sizeof(int));
uint8_t *dfcast = reinterpret_cast<uint8_t*>(&df);
for ( int i = 0; i < (int)sizeof(int); i++ )
{
bych[i] = (int)dfcast[i];
}
return bych;
}
// convert array of chars to floating point double
double tdm_ripper::convert_double(std::vector<unsigned char> bych)
{

View File

@ -77,12 +77,30 @@ public:
return num_groups_;
}
const std::string& channel_name(int channelid)
{
assert( channelid > 0 && channelid <= num_channels_ );
return channel_name_[channelid-1];
}
const std::string& group_name(int groupid)
{
assert( groupid > 0 && groupid <= num_channels_ );
return group_name_[groupid-1];
}
void list_datatypes();
// convert array of chars to single integer or floating point double
int convert_int(std::vector<unsigned char> bych);
double convert_double(std::vector<unsigned char> bych);
// disassemble single integer or double into array of chars
std::vector<unsigned char> convert_int(int number);
std::vector<unsigned char> convert_double(double number);
// convert entire channel, i.e. expert of .tdx binary file
// std::vector<double> convert_channel(int byteoffset, int length, int typesize);
std::vector<double> convert_channel(int byteoffset, int length, std::string type);

View File

@ -27,3 +27,13 @@ cdef class pytdmripper:
def print_channel(self, int channelid, const char* filename):
self.cripp.print_channel(channelid,filename)
# integrate into CONTI_HBS workflow by adding methods: (29.04.2019)
# tdm_loader.OpenFile(tmp_path + name_prefix + '/Messung.tdm', encoding='utf-8')
# .no_channel_groups()
# .no_channels(i)
# .channel_name(i, j)
# .channel(i, j)
# .close()
#
# evtl. get time_stamp of .tdm file in the unix format, i.e. #seconds since 01.01.0000 with average year having 365+97/400 = 365.2425 days