Fix bug with the frame sink blocks
* Change clear text format to binary * Add binary and hex annotated
This commit is contained in:
parent
c19524aa6b
commit
909ae9da78
|
@ -21,15 +21,15 @@
|
||||||
<key>output_type</key>
|
<key>output_type</key>
|
||||||
<type>enum</type>
|
<type>enum</type>
|
||||||
<option>
|
<option>
|
||||||
<name>Clear Text</name>
|
<name>Binary</name>
|
||||||
<key>0</key>
|
<key>0</key>
|
||||||
</option>
|
</option>
|
||||||
<option>
|
<option>
|
||||||
<name>Hex</name>
|
<name>Hex annotated</name>
|
||||||
<key>1</key>
|
<key>1</key>
|
||||||
</option>
|
</option>
|
||||||
<option>
|
<option>
|
||||||
<name>Binary</name>
|
<name>Binary annotated</name>
|
||||||
<key>2</key>
|
<key>2</key>
|
||||||
</option>
|
</option>
|
||||||
</param>
|
</param>
|
||||||
|
|
|
@ -10,15 +10,15 @@
|
||||||
<key>format</key>
|
<key>format</key>
|
||||||
<type>enum</type>
|
<type>enum</type>
|
||||||
<option>
|
<option>
|
||||||
<name>Clear Text</name>
|
<name>Binary</name>
|
||||||
<key>0</key>
|
<key>0</key>
|
||||||
</option>
|
</option>
|
||||||
<option>
|
<option>
|
||||||
<name>Hex</name>
|
<name>Hex annotated</name>
|
||||||
<key>1</key>
|
<key>1</key>
|
||||||
</option>
|
</option>
|
||||||
<option>
|
<option>
|
||||||
<name>Binary</name>
|
<name>Binary annotated</name>
|
||||||
<key>2</key>
|
<key>2</key>
|
||||||
</option>
|
</option>
|
||||||
|
|
||||||
|
|
|
@ -105,8 +105,7 @@ namespace gr
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
/* add .txt to filename */
|
/* Binary form */
|
||||||
filename.append (".txt");
|
|
||||||
std::ofstream fd (filename.c_str ());
|
std::ofstream fd (filename.c_str ());
|
||||||
fd.write ((const char *) pmt::blob_data (msg),
|
fd.write ((const char *) pmt::blob_data (msg),
|
||||||
pmt::blob_length (msg));
|
pmt::blob_length (msg));
|
||||||
|
@ -115,8 +114,8 @@ namespace gr
|
||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
/* add .hex to filename */
|
/* aHex annotated, dd .txt to filename */
|
||||||
filename.append (".hex");
|
filename.append (".txt");
|
||||||
std::ofstream fd (filename.c_str ());
|
std::ofstream fd (filename.c_str ());
|
||||||
su = (uint8_t *) pmt::blob_data (msg);
|
su = (uint8_t *) pmt::blob_data (msg);
|
||||||
for (size_t i = 0; i < pmt::blob_length (msg); i++) {
|
for (size_t i = 0; i < pmt::blob_length (msg); i++) {
|
||||||
|
@ -128,8 +127,8 @@ namespace gr
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
/* add .bin to filename */
|
/* Binary annotated, add .txt to filename */
|
||||||
filename.append (".bin");
|
filename.append (".txt");
|
||||||
std::ofstream fd (filename.c_str ());
|
std::ofstream fd (filename.c_str ());
|
||||||
su = (uint8_t *) pmt::blob_data (msg);
|
su = (uint8_t *) pmt::blob_data (msg);
|
||||||
for (size_t i = 0; i < pmt::blob_length (msg); i++) {
|
for (size_t i = 0; i < pmt::blob_length (msg); i++) {
|
||||||
|
|
|
@ -99,13 +99,13 @@ namespace gr
|
||||||
|
|
||||||
switch (d_format)
|
switch (d_format)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0: // binary
|
||||||
for (size_t i = 0; i < pmt::blob_length (msg); i++) {
|
for (size_t i = 0; i < pmt::blob_length (msg); i++) {
|
||||||
std::cout << s[i];
|
std::cout << s[i];
|
||||||
}
|
}
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1: // hex annotated
|
||||||
su = (uint8_t *) pmt::blob_data (msg);
|
su = (uint8_t *) pmt::blob_data (msg);
|
||||||
for (size_t i = 0; i < pmt::blob_length (msg); i++) {
|
for (size_t i = 0; i < pmt::blob_length (msg); i++) {
|
||||||
std::cout << std::hex << std::showbase << std::setw (4)
|
std::cout << std::hex << std::showbase << std::setw (4)
|
||||||
|
@ -113,7 +113,7 @@ namespace gr
|
||||||
}
|
}
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2: // binary annotated
|
||||||
su = (uint8_t *) pmt::blob_data (msg);
|
su = (uint8_t *) pmt::blob_data (msg);
|
||||||
for (size_t i = 0; i < pmt::blob_length (msg); i++) {
|
for (size_t i = 0; i < pmt::blob_length (msg); i++) {
|
||||||
std::cout << "0b" << std::bitset<8> (su[i]) << " ";
|
std::cout << "0b" << std::bitset<8> (su[i]) << " ";
|
||||||
|
|
Loading…
Reference in New Issue