Reference no: EM1334569
Write a program that translates to and from Morse Code. Use the curl library and a website (e.g. https://morse.socs.uoguelph.ca/cgibin/morse.pl) to do the actual translations. Your program must take the user input, call the remote perl script using curl, process the response and display the appropriate results to the user. You may use any suitable website for translation but you must call the site using curl. There is a curlutility file in the A2 algorithm folder (in the examples repo) that you may use to simplify your use of curl.
Your program should permit the user to enter text to be translated to morse code, or to enter dots and dashes to be translated to text. A dot is represented by the period (.) and a dash is represented by the hyphen (). Separate words by spaces.
Musts: How to get more than ZERO
? Compile, with no errors using ansi Wall pedantic (on the raspberry pi (raspbian))
? Run and take both types of user input without crashing
The Basics: The first 80%
You can get 80% on this assignment by just following the instructions. If you meet each of the expectations listed, you should get most or all of the 80 marks allocated to basic functionality.
Expectations for your Program
? The user can choose to enter text or morse code (up to 200 characters)
? The program loops until the user asks to quit
? Allow the user to see previous results (keep a history)
? When taking morse code input, prevent all input that is not a dot, dash or space
? The user interface is intuitive and pleasant to use (may use ncurses) and does not leave the user with a cluttered, confusing screen.
? The website used may be hardcoded, you do not have to let the user choose the translation service.
? The program gives correct translations.
Expectations for your Code
? Use the curl library (you may use the curl utility that is provided with the assignment algorithm files)
? Separate functions and main into different source files
? Root assignment folder has src/ include/ doc/ and bin/ subdirectories that are used properly. If needed use lib/ and assets/ subdirectories as well.
? make correct use of dynamic memory (including freeing pointers)
? dynamically allocate arrays and strings to be the correct length for the input
?Source code is divided properly into .c and .h files with required headers in .cfile (see the policies document)
? Source code is consistently indented using spaces
? Comments about function parameters and return values purpose are present (ideally in .h files). Comments about algorithm logic are in .c files
? Variable and function names are meaningful and are in camelCase
? Program compiles with a makefile that places the executable in the bin/ folder
Things you will need to know
? The basics of International Morse Code (https://morsecode.scphillips.com/morse2.html)
? The structure of an html document (so you can parse through the returned result)
? Dynamic Arrays
? Array processing and/or string.h library functions
? malloc and free
? How to use git to clone, commit, push
? How to write a simple makefile
? How to place files in folders
Enhancements: How to get the last 20%
The final 20% of the marks for this assignment are earned by showing that you have mastered the programming constructs and that you are an adept problem solver. You do not need to do all of the following to get graded on the last 20% of the assignment, but you do need to demonstrate (verbally when we grade you) that you have a solid understanding of how to approach them all and you need to have done at least one of these enhancements really well, or two of them to a functionalbutnotperfect level. Some of the enhancements are harder than others.
? Morse code is primarily intended to be heard. Add functionality to your program so that when text is translated to morse code, the user can hear the morse code through speakers
? Use an LED/resistor set and the GPIO pins on the pi to visually display themorse code when english is translated to morse code. Judi has some LED/resistor sets you can purchase or you can build your own by following these instructions (https://www.thirdeyevis.com/pi-page-2.php). Our TA (Bill) has a C library you can use to simplify GPIO interaction. Youll need to ask us for it if you want it.
? Use a parsing library to parse the HTML instead of writing your own special purpose parser. Be sure to include the library files in your submission and to write your makefile to look in the lib/ folder for your library
Deliverables: Things you must hand in
1. (via git) The assignment files are in a subdirectory of your coursework repository. The subdirectory must be called A2 (capitalization is important)
2. A plain text file called README is in the root folder of the assignment (A2). It contains information about running and using your program as well as any known limitations of the program.
3. You have a makefile that will compile your code and place the executable in the bin subfolder. The makefile is in the root directory of the assignment. The makefile should not run your program.
4. Information about how you tested your program is in the testing document
5. Your reference list is in the doc subfolder