mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-27 21:20:41 +02:00
using md5.h
This commit is contained in:
parent
4571b1b91c
commit
2aa16eac44
@ -5,6 +5,7 @@ set(SOURCES
|
||||
src/CmdProxy.cpp
|
||||
src/CmdParser.cpp
|
||||
src/Pattern.cpp
|
||||
../slsSupportLib/opensslMd5/md5.c
|
||||
)
|
||||
|
||||
add_library(slsDetectorObject OBJECT
|
||||
@ -34,6 +35,7 @@ set(PUBLICHEADERS
|
||||
include/sls/Detector.h
|
||||
include/sls/Result.h
|
||||
include/sls/Pattern.h
|
||||
../slsSupportLib/opensslMd5/md5.h
|
||||
)
|
||||
|
||||
#Shared library
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "Module.h"
|
||||
#include "SharedMemory.h"
|
||||
#include "md5.h"
|
||||
#include "sls/ClientSocket.h"
|
||||
#include "sls/ToString.h"
|
||||
#include "sls/bit_utils.h"
|
||||
@ -11,7 +12,6 @@
|
||||
#include "sls/string_utils.h"
|
||||
#include "sls/versionAPI.h"
|
||||
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <bitset>
|
||||
@ -3412,10 +3412,21 @@ sls_detector_module Module::readSettingsFile(const std::string &fname,
|
||||
return myMod;
|
||||
}
|
||||
|
||||
std::string Module::calculateChecksum(char *buffer, ssize_t bytes) {
|
||||
MD5_CTX c;
|
||||
MD5_Init(&c);
|
||||
MD5_Update(&c, bufer, bytes);
|
||||
unsigned char out[MD5_DIGEST_LENGTH];
|
||||
MD5_Final(out, &c);
|
||||
return std::string(out);
|
||||
}
|
||||
|
||||
void Module::programFPGAviaBlackfin(std::vector<char> buffer,
|
||||
const std::string &checksum) {
|
||||
uint64_t filesize = buffer.size();
|
||||
LOG(logDEBUG1) << "checksum:" << checksum;
|
||||
LOG(logINFOBLUE) << "checksum 1:" << checksum;
|
||||
LOG(logINFOBLUE) << "checksum 2:"
|
||||
<< calculateChecksum(buffer.data(), filesize);
|
||||
|
||||
// send program from memory to detector
|
||||
LOG(logINFO) << "Sending programming binary (from pof) to module "
|
||||
|
@ -744,6 +744,7 @@ class Module : public virtual slsDetectorDefs {
|
||||
std::string getTrimbitFilename(detectorSettings settings, int e_eV);
|
||||
sls_detector_module readSettingsFile(const std::string &fname,
|
||||
bool trimbits = true);
|
||||
std::string calculateChecksum(char *buffer, ssize_t bytes);
|
||||
void programFPGAviaBlackfin(std::vector<char> buffer,
|
||||
const std::string &checksum);
|
||||
void programFPGAviaNios(std::vector<char> buffer);
|
||||
|
Loading…
x
Reference in New Issue
Block a user