Commit 909ae9da authored by Nikos Karamolegkos's avatar Nikos Karamolegkos

Fix bug with the frame sink blocks

* Change clear text format to binary
* Add binary and hex annotated
parent c19524aa
Pipeline #17013967 passed with stage
in 11 minutes and 40 seconds
......@@ -21,15 +21,15 @@
<key>output_type</key>
<type>enum</type>
<option>
<name>Clear Text</name>
<name>Binary</name>
<key>0</key>
</option>
<option>
<name>Hex</name>
<name>Hex annotated</name>
<key>1</key>
</option>
<option>
<name>Binary</name>
<name>Binary annotated</name>
<key>2</key>
</option>
</param>
......
......@@ -10,15 +10,15 @@
<key>format</key>
<type>enum</type>
<option>
<name>Clear Text</name>
<name>Binary</name>
<key>0</key>
</option>
<option>
<name>Hex</name>
<name>Hex annotated</name>
<key>1</key>
</option>
<option>
<name>Binary</name>
<name>Binary annotated</name>
<key>2</key>
</option>
......
......@@ -105,8 +105,7 @@ namespace gr
{
case 0:
{
/* add .txt to filename */
filename.append (".txt");
/* Binary form */
std::ofstream fd (filename.c_str ());
fd.write ((const char *) pmt::blob_data (msg),
pmt::blob_length (msg));
......@@ -115,8 +114,8 @@ namespace gr
}
case 1:
{
/* add .hex to filename */
filename.append (".hex");
/* aHex annotated, dd .txt to filename */
filename.append (".txt");
std::ofstream fd (filename.c_str ());
su = (uint8_t *) pmt::blob_data (msg);
for (size_t i = 0; i < pmt::blob_length (msg); i++) {
......@@ -128,8 +127,8 @@ namespace gr
}
case 2:
{
/* add .bin to filename */
filename.append (".bin");
/* Binary annotated, add .txt to filename */
filename.append (".txt");
std::ofstream fd (filename.c_str ());
su = (uint8_t *) pmt::blob_data (msg);
for (size_t i = 0; i < pmt::blob_length (msg); i++) {
......
......@@ -99,13 +99,13 @@ namespace gr
switch (d_format)
{
case 0:
case 0: // binary
for (size_t i = 0; i < pmt::blob_length (msg); i++) {
std::cout << s[i];
}
std::cout << std::endl;
break;
case 1:
case 1: // hex annotated
su = (uint8_t *) pmt::blob_data (msg);
for (size_t i = 0; i < pmt::blob_length (msg); i++) {
std::cout << std::hex << std::showbase << std::setw (4)
......@@ -113,7 +113,7 @@ namespace gr
}
std::cout << std::endl;
break;
case 2:
case 2: // binary annotated
su = (uint8_t *) pmt::blob_data (msg);
for (size_t i = 0; i < pmt::blob_length (msg); i++) {
std::cout << "0b" << std::bitset<8> (su[i]) << " ";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment