Merging gnuradio generated python code into the Python web serverCan I send samples from the device made by myself to GNU radio?SDR GnuRadio gr-dsd decode D-STAR voiceChoose the right dongle for NOAA images visualization with GnuRadioI want to know the bandwidth of this signal; problems using “QT GUI Frequency sink” to show itGNU Radio code and data type conversionI want to know how QT GUI Entry is implemented in gnuradio. I am puzzled how the code is like?Using Satnogs' *.ogg files in GnuRadio flowgraphsHow to record fixed number of samples in gnuradioGnuRadio RF transmission, legal and safety issuesSimple Gnuradio TX/RX loopback example/tutorial

Shortest hex dumping program

Integer Lists of Noah

How to drill holes in 3/8" thick steel plates?

Indesign - how to change the style of the page numbers?

What specific instant in time in the MCU has been depicted the most times?

What steps should I take to lawfully visit the United States as a tourist immediately after visiting on a B-1 visa?

How do you move up one folder in Finder?

Astronaut distance from Earth?

Are there any medieval light sources without fire?

Why would non-kinetic weapons be used for orbital bombardment?

Optimization terminology: "Exact" v. "Approximate"

Is there any reason why MCU changed the Snap to Blip

Using `PlotLegends` with a `ColorFunction`

Are there any sports for which the world's best player is female?

Is there any word for "disobedience to God"?

Graduate student with abysmal English writing skills, how to help

What is a "shilicashe?"

How are mathematicians paid to do research?

Why do we need common sense in AI?

Confirming the Identity of a (Friendly) Reviewer After the Reviews

How can I get a player to accept that they should stop trying to pull stunts without thinking them through first?

Great Unsolved Problems in O.R

What to do with a rabbit in a survival situation?

Can you cast a blanket Invisibility and let the targets see each other?



Merging gnuradio generated python code into the Python web server


Can I send samples from the device made by myself to GNU radio?SDR GnuRadio gr-dsd decode D-STAR voiceChoose the right dongle for NOAA images visualization with GnuRadioI want to know the bandwidth of this signal; problems using “QT GUI Frequency sink” to show itGNU Radio code and data type conversionI want to know how QT GUI Entry is implemented in gnuradio. I am puzzled how the code is like?Using Satnogs' *.ogg files in GnuRadio flowgraphsHow to record fixed number of samples in gnuradioGnuRadio RF transmission, legal and safety issuesSimple Gnuradio TX/RX loopback example/tutorial






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2












$begingroup$


I am trying to figure out how I control a Software Defined Radio over a network, and stream the received baseband samples from my remote hardware back to the gnuradio.



What I'm trying to do here is, this Python code should be able to output a user selectable waveform which can be a CW tone, Broadband Noise, or an arbitrary waveform read from a file containing I/Q values.



So I searched on the internet and the closest thing that I found was the BorIP and unfortunately couldn't get it set-up on my machine because the instructions I found were not helpful (at least for a beginner like me).



I created the Python web server using this script (which I found online):



 import http.server
import socketserver

PORT = 8080
Handler = http.server.SimpleHTTPRequestHandler

with socketserver.TCPServer(("", PORT), Handler) as httpd:
print("serving at port", PORT)
httpd.serve_forever()


But didn't know how to merge the generated gnuradio python code into the Python web server.










share|improve this question









New contributor



Hadad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






$endgroup$


















    2












    $begingroup$


    I am trying to figure out how I control a Software Defined Radio over a network, and stream the received baseband samples from my remote hardware back to the gnuradio.



    What I'm trying to do here is, this Python code should be able to output a user selectable waveform which can be a CW tone, Broadband Noise, or an arbitrary waveform read from a file containing I/Q values.



    So I searched on the internet and the closest thing that I found was the BorIP and unfortunately couldn't get it set-up on my machine because the instructions I found were not helpful (at least for a beginner like me).



    I created the Python web server using this script (which I found online):



     import http.server
    import socketserver

    PORT = 8080
    Handler = http.server.SimpleHTTPRequestHandler

    with socketserver.TCPServer(("", PORT), Handler) as httpd:
    print("serving at port", PORT)
    httpd.serve_forever()


    But didn't know how to merge the generated gnuradio python code into the Python web server.










    share|improve this question









    New contributor



    Hadad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






    $endgroup$














      2












      2








      2





      $begingroup$


      I am trying to figure out how I control a Software Defined Radio over a network, and stream the received baseband samples from my remote hardware back to the gnuradio.



      What I'm trying to do here is, this Python code should be able to output a user selectable waveform which can be a CW tone, Broadband Noise, or an arbitrary waveform read from a file containing I/Q values.



      So I searched on the internet and the closest thing that I found was the BorIP and unfortunately couldn't get it set-up on my machine because the instructions I found were not helpful (at least for a beginner like me).



      I created the Python web server using this script (which I found online):



       import http.server
      import socketserver

      PORT = 8080
      Handler = http.server.SimpleHTTPRequestHandler

      with socketserver.TCPServer(("", PORT), Handler) as httpd:
      print("serving at port", PORT)
      httpd.serve_forever()


      But didn't know how to merge the generated gnuradio python code into the Python web server.










      share|improve this question









      New contributor



      Hadad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      $endgroup$




      I am trying to figure out how I control a Software Defined Radio over a network, and stream the received baseband samples from my remote hardware back to the gnuradio.



      What I'm trying to do here is, this Python code should be able to output a user selectable waveform which can be a CW tone, Broadband Noise, or an arbitrary waveform read from a file containing I/Q values.



      So I searched on the internet and the closest thing that I found was the BorIP and unfortunately couldn't get it set-up on my machine because the instructions I found were not helpful (at least for a beginner like me).



      I created the Python web server using this script (which I found online):



       import http.server
      import socketserver

      PORT = 8080
      Handler = http.server.SimpleHTTPRequestHandler

      with socketserver.TCPServer(("", PORT), Handler) as httpd:
      print("serving at port", PORT)
      httpd.serve_forever()


      But didn't know how to merge the generated gnuradio python code into the Python web server.







      software-defined-radio gnuradio






      share|improve this question









      New contributor



      Hadad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share|improve this question









      New contributor



      Hadad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share|improve this question




      share|improve this question








      edited 8 hours ago









      Kevin Reid AG6YO

      17.4k4 gold badges35 silver badges76 bronze badges




      17.4k4 gold badges35 silver badges76 bronze badges






      New contributor



      Hadad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      asked 9 hours ago









      HadadHadad

      334 bronze badges




      334 bronze badges




      New contributor



      Hadad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




      New contributor




      Hadad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          1 Answer
          1






          active

          oldest

          votes


















          3












          $begingroup$

          GNU Radio Companion (GRC) generates Python code that is something like this (not exact text). (Make sure you chose the "No GUI" option in GRC.)



          class my_block(gr.top_block):
          # ...

          def main():
          tb = my_block()
          tb.run()

          if __name__ == '__main__':
          main()


          You can just import this as a module in your Python program (the if __name__ check will skip running the code that wouldn't be appropriate). Once you've done that, the way you use it is to just create the top block and call tb.start(). This will start the flow graph without also waiting for it to finish, which is exactly what you want when you have a separate main loop like a web server.



          import my_block

          tb = my_block.my_block()
          tb.start()


          When you're shutting down, do this to stop the GNU Radio threads:



          tb.stop()
          tb.wait()


          Then you can also use the generated methods (a getter and setter per GRC "variable") to change parameters while the flow graph is running.



          There's a lot more that can be said about how to go beyond what GRC generates for you (which would best be asked as separate questions), but this is how you get started with integrating a GNU Radio flow graph into a larger program.



          I would recommend expecting to eventually stop using GRC's code generation and write your own Python code. This is because GRC has quite a few limitations in what you can do with it — for example, if you want to decide at runtime which type of signal source block to create, you can't do that in GRC but it's easy when you write your own Python. You can always use GRC to generate examples to copy from, when you're unsure how to configure a block.






          share|improve this answer









          $endgroup$












          • $begingroup$
            Thank you so much Kevin for taking time and answering my question. Again, I am a real begginer when it comes to python or programming, but definitely I will do my best to figure this out and what I can do.
            $endgroup$
            – Hadad
            7 hours ago














          Your Answer






          StackExchange.ifUsing("editor", function ()
          return StackExchange.using("schematics", function ()
          StackExchange.schematics.init();
          );
          , "cicuitlab");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "520"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          noCode: true, onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );






          Hadad is a new contributor. Be nice, and check out our Code of Conduct.









          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fham.stackexchange.com%2fquestions%2f14883%2fmerging-gnuradio-generated-python-code-into-the-python-web-server%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3












          $begingroup$

          GNU Radio Companion (GRC) generates Python code that is something like this (not exact text). (Make sure you chose the "No GUI" option in GRC.)



          class my_block(gr.top_block):
          # ...

          def main():
          tb = my_block()
          tb.run()

          if __name__ == '__main__':
          main()


          You can just import this as a module in your Python program (the if __name__ check will skip running the code that wouldn't be appropriate). Once you've done that, the way you use it is to just create the top block and call tb.start(). This will start the flow graph without also waiting for it to finish, which is exactly what you want when you have a separate main loop like a web server.



          import my_block

          tb = my_block.my_block()
          tb.start()


          When you're shutting down, do this to stop the GNU Radio threads:



          tb.stop()
          tb.wait()


          Then you can also use the generated methods (a getter and setter per GRC "variable") to change parameters while the flow graph is running.



          There's a lot more that can be said about how to go beyond what GRC generates for you (which would best be asked as separate questions), but this is how you get started with integrating a GNU Radio flow graph into a larger program.



          I would recommend expecting to eventually stop using GRC's code generation and write your own Python code. This is because GRC has quite a few limitations in what you can do with it — for example, if you want to decide at runtime which type of signal source block to create, you can't do that in GRC but it's easy when you write your own Python. You can always use GRC to generate examples to copy from, when you're unsure how to configure a block.






          share|improve this answer









          $endgroup$












          • $begingroup$
            Thank you so much Kevin for taking time and answering my question. Again, I am a real begginer when it comes to python or programming, but definitely I will do my best to figure this out and what I can do.
            $endgroup$
            – Hadad
            7 hours ago
















          3












          $begingroup$

          GNU Radio Companion (GRC) generates Python code that is something like this (not exact text). (Make sure you chose the "No GUI" option in GRC.)



          class my_block(gr.top_block):
          # ...

          def main():
          tb = my_block()
          tb.run()

          if __name__ == '__main__':
          main()


          You can just import this as a module in your Python program (the if __name__ check will skip running the code that wouldn't be appropriate). Once you've done that, the way you use it is to just create the top block and call tb.start(). This will start the flow graph without also waiting for it to finish, which is exactly what you want when you have a separate main loop like a web server.



          import my_block

          tb = my_block.my_block()
          tb.start()


          When you're shutting down, do this to stop the GNU Radio threads:



          tb.stop()
          tb.wait()


          Then you can also use the generated methods (a getter and setter per GRC "variable") to change parameters while the flow graph is running.



          There's a lot more that can be said about how to go beyond what GRC generates for you (which would best be asked as separate questions), but this is how you get started with integrating a GNU Radio flow graph into a larger program.



          I would recommend expecting to eventually stop using GRC's code generation and write your own Python code. This is because GRC has quite a few limitations in what you can do with it — for example, if you want to decide at runtime which type of signal source block to create, you can't do that in GRC but it's easy when you write your own Python. You can always use GRC to generate examples to copy from, when you're unsure how to configure a block.






          share|improve this answer









          $endgroup$












          • $begingroup$
            Thank you so much Kevin for taking time and answering my question. Again, I am a real begginer when it comes to python or programming, but definitely I will do my best to figure this out and what I can do.
            $endgroup$
            – Hadad
            7 hours ago














          3












          3








          3





          $begingroup$

          GNU Radio Companion (GRC) generates Python code that is something like this (not exact text). (Make sure you chose the "No GUI" option in GRC.)



          class my_block(gr.top_block):
          # ...

          def main():
          tb = my_block()
          tb.run()

          if __name__ == '__main__':
          main()


          You can just import this as a module in your Python program (the if __name__ check will skip running the code that wouldn't be appropriate). Once you've done that, the way you use it is to just create the top block and call tb.start(). This will start the flow graph without also waiting for it to finish, which is exactly what you want when you have a separate main loop like a web server.



          import my_block

          tb = my_block.my_block()
          tb.start()


          When you're shutting down, do this to stop the GNU Radio threads:



          tb.stop()
          tb.wait()


          Then you can also use the generated methods (a getter and setter per GRC "variable") to change parameters while the flow graph is running.



          There's a lot more that can be said about how to go beyond what GRC generates for you (which would best be asked as separate questions), but this is how you get started with integrating a GNU Radio flow graph into a larger program.



          I would recommend expecting to eventually stop using GRC's code generation and write your own Python code. This is because GRC has quite a few limitations in what you can do with it — for example, if you want to decide at runtime which type of signal source block to create, you can't do that in GRC but it's easy when you write your own Python. You can always use GRC to generate examples to copy from, when you're unsure how to configure a block.






          share|improve this answer









          $endgroup$



          GNU Radio Companion (GRC) generates Python code that is something like this (not exact text). (Make sure you chose the "No GUI" option in GRC.)



          class my_block(gr.top_block):
          # ...

          def main():
          tb = my_block()
          tb.run()

          if __name__ == '__main__':
          main()


          You can just import this as a module in your Python program (the if __name__ check will skip running the code that wouldn't be appropriate). Once you've done that, the way you use it is to just create the top block and call tb.start(). This will start the flow graph without also waiting for it to finish, which is exactly what you want when you have a separate main loop like a web server.



          import my_block

          tb = my_block.my_block()
          tb.start()


          When you're shutting down, do this to stop the GNU Radio threads:



          tb.stop()
          tb.wait()


          Then you can also use the generated methods (a getter and setter per GRC "variable") to change parameters while the flow graph is running.



          There's a lot more that can be said about how to go beyond what GRC generates for you (which would best be asked as separate questions), but this is how you get started with integrating a GNU Radio flow graph into a larger program.



          I would recommend expecting to eventually stop using GRC's code generation and write your own Python code. This is because GRC has quite a few limitations in what you can do with it — for example, if you want to decide at runtime which type of signal source block to create, you can't do that in GRC but it's easy when you write your own Python. You can always use GRC to generate examples to copy from, when you're unsure how to configure a block.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 8 hours ago









          Kevin Reid AG6YOKevin Reid AG6YO

          17.4k4 gold badges35 silver badges76 bronze badges




          17.4k4 gold badges35 silver badges76 bronze badges











          • $begingroup$
            Thank you so much Kevin for taking time and answering my question. Again, I am a real begginer when it comes to python or programming, but definitely I will do my best to figure this out and what I can do.
            $endgroup$
            – Hadad
            7 hours ago

















          • $begingroup$
            Thank you so much Kevin for taking time and answering my question. Again, I am a real begginer when it comes to python or programming, but definitely I will do my best to figure this out and what I can do.
            $endgroup$
            – Hadad
            7 hours ago
















          $begingroup$
          Thank you so much Kevin for taking time and answering my question. Again, I am a real begginer when it comes to python or programming, but definitely I will do my best to figure this out and what I can do.
          $endgroup$
          – Hadad
          7 hours ago





          $begingroup$
          Thank you so much Kevin for taking time and answering my question. Again, I am a real begginer when it comes to python or programming, but definitely I will do my best to figure this out and what I can do.
          $endgroup$
          – Hadad
          7 hours ago











          Hadad is a new contributor. Be nice, and check out our Code of Conduct.









          draft saved

          draft discarded


















          Hadad is a new contributor. Be nice, and check out our Code of Conduct.












          Hadad is a new contributor. Be nice, and check out our Code of Conduct.











          Hadad is a new contributor. Be nice, and check out our Code of Conduct.














          Thanks for contributing an answer to Amateur Radio Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fham.stackexchange.com%2fquestions%2f14883%2fmerging-gnuradio-generated-python-code-into-the-python-web-server%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          ParseJSON using SSJSUsing AMPscript with SSJS ActivitiesHow to resubscribe a user in Marketing cloud using SSJS?Pulling Subscriber Status from Lists using SSJSRetrieving Emails using SSJSProblem in updating DE using SSJSUsing SSJS to send single email in Marketing CloudError adding EmailSendDefinition using SSJS

          Кампала Садржај Географија Географија Историја Становништво Привреда Партнерски градови Референце Спољашње везе Мени за навигацију0°11′ СГШ; 32°20′ ИГД / 0.18° СГШ; 32.34° ИГД / 0.18; 32.340°11′ СГШ; 32°20′ ИГД / 0.18° СГШ; 32.34° ИГД / 0.18; 32.34МедијиПодациЗванични веб-сајту

          19. јануар Садржај Догађаји Рођења Смрти Празници и дани сећања Види још Референце Мени за навигацијуу