LED 100W DC Power Supply
things Posted on 01 Jul, 2019 11:00:11- Comments(0) https://www.guivi.one/?p=7
- Share
C# Parser
things Posted on 26 Jun, 2019 08:01:40namespace CSharpParser
{
class Parser
{
private string m_strData;
private int m_nMaxLength;
private List<string> m_lData;
/*! \brief Constructor of the parser class.
*/
public Parser()
{
ClearData();
m_lData = new List<string>();
m_nMaxLength = 256;
}
public void ClearData()
{
m_strData = “”;
}
/*! \brief Add data to the \ref m_strData variable and make sure it is not larger than \ref m_nMaxLength
* \param string to be added to \ref m_strData
*/
public void AddData(string _data)
{
m_strData += _data;
if (m_strData.Length > m_nMaxLength)
{
m_strData = m_strData.Remove(m_strData.Length – m_nMaxLength);
}
}
/*! \brief Sor the data in \ref m_strData by splitting by ‘\r’ characters
*/
public void SortData()
{
string[] _data = m_strData.Split(‘\r’);
foreach (string _str in _data)
m_lData.Add(_str);
}
/*! \brief Returnt the data in the \ref m_lData list for processing by inheritance or parent
* \return List<string> List of possible strings
*/
public List<string> GetData()
{
return m_lData;
}
}
}
- Comments(0) https://www.guivi.one/?p=8
- Share
Interesting Links
things Posted on 30 May, 2019 20:42:42Socket programming for windows and Linux, an on-line in depth book with tutorials:
https://www.winsocketdotnetworkprogramming.com
Lock-in-amplifier
https://www.instructables.com/id/Lock-in-Amplifier/
- Comments(0) https://www.guivi.one/?p=9
- Share
Links to interesting channels in youtube
things Posted on 20 May, 2019 21:00:14Tom Heylen Electronics Blog:
https://www.youtube.com/channel/UC1qUejmJJd32zmir4NIQhcQ
Lewis Loflin Electronics Blog:
https://www.youtube.com/channel/UCGbRYDwzDEsjwUswqGfW4Dw
Arduino Nano Propellant clock:
https://www.youtube.com/watch?v=HYtftl7_pO0
MFC/Cli/C# All Together Videos from ~Jun 2018:
https://www.youtube.com/user/siliners/videos
Constant Current
Physiscs
- Comments(0) https://www.guivi.one/?p=10
- Share
message class
things Posted on 09 Oct, 2018 11:28:37// Structure of the messages to be ket track.
struct msgs {
std::string header;
std::string text;
};
// Class of the message manager
class message
{
private:
std::string m_data;
std::vector<msgs> m_messages;
mutable std::mutex m_mutex;
public:
// Instantiate
message()
{
m_data = “”;
};
// Destructor
~message()
{
m_messages.clear();
};
/** Resolve last message */
void solve_last(std::string l_data)
{
m_data += l_data;
int soh, stx, etx, eot;
soh = m_data.rfind(‘\x01’);
stx = m_data.rfind(‘\x02’);
etx = m_data.rfind(‘\x03’);
eot = m_data.rfind(‘\x04’);
if (soh > -1 && stx > -1 && etx > -1 && eot > -1)
{
if (eot > etx && etx > stx && stx > soh) { // stx = soh + 2 && eot = etx + 1
msgs l_msg;
l_msg.header = m_data.substr(soh + 1, (stx – soh) – 1); // Get Header
l_msg.text = m_data.substr(stx + 1, (etx – stx) – 1); // Get Text
std::lock_guard<std::mutex> l_guard(m_mutex);
m_messages.push_back(l_msg);
}
if (m_data.size() > (size_t)(eot + 1))
m_data = m_data.substr(eot + 1);
else
m_data = “”;
}
}
/** Resolve all messages in the incoming string */
void solve_all(std::string l_data)
{
m_data += l_data;
int soh, stx, etx, eot;
soh = m_data.find(‘\x01’);
stx = m_data.find(‘\x02’);
etx = m_data.find(‘\x03’);
eot = m_data.find(‘\x04’);
while (soh > -1 && stx > -1 && etx > -1 && eot > -1)
{
if (eot > etx && etx > stx && stx > soh) { // stx = soh + 2 && eot = etx + 1
msgs l_msg;
l_msg.header = m_data.substr(soh + 1, (stx – soh) – 1); // Get Header
l_msg.text = m_data.substr(stx + 1, (etx – stx) – 1); // Get Text
std::lock_guard<std::mutex> l_guard(m_mutex);
m_messages.push_back(l_msg);
}
if (m_data.size() > (size_t)(eot + 1))
m_data = m_data.substr(eot + 1);
else
m_data = “”;
soh = m_data.find(‘\x01’);
stx = m_data.find(‘\x02’);
etx = m_data.find(‘\x03’);
eot = m_data.find(‘\x04’);
}
};
// print to consol the values in the m_messages
friend std::ostream& operator<<(std::ostream& os, const message& l_msg)
{
std::lock_guard<std::mutex> l_guard(l_msg.m_mutex);
for (auto x : l_msg.m_messages)
os << x.header << “\t” << x.text << std::endl;
return os;
};
// retuen the list of messages
std::vector<msgs> get_messages(void)
{
std::lock_guard<std::mutex> l_guard(m_mutex);
std::vector<msgs> l_messages = m_messages;
m_messages.clear();
return l_messages;
};
};
- Comments(0) https://www.guivi.one/?p=17
- Share