merged from master

This commit is contained in:
Gerolf Ziegenhain 2015-01-04 14:43:06 +01:00
commit 9599bae5a8
5 changed files with 135 additions and 55 deletions

8
AUTHORS Normal file
View File

@ -0,0 +1,8 @@
Fernan Bolando (VE4FEB)
Gerolf Ziegenhain (DG6FL)
MorseKOB:
Lex Kerr
CWCom Protocol:
John Samien (VK1EME)

123
README.md
View File

@ -1,3 +1,4 @@
<<<<<<< HEAD
How to build on Debian
apt-get install -y alsa-oss oss-compat build-essential autoconf libao-dev libtool
wget https://github.com/8cH9azbsFifZ/morse/archive/v0.1.tar.gz
@ -18,37 +19,113 @@ https://github.com/8cH9azbsFifZ/morse/archive/v0.1.tar.gz
How to use:
=======
irmc - Internet Relay Morse Code
================================
>>>>>>> master
1 usage: irmc [hostname] [port] [channel] [id] [serialport]
./irmc mtc-kob.dyndns.org 7890 103 123 /dev/tty.usbserial
faeroes.sdf.org.7890
# What is IRMC?
IRMC stands for Internet Relay Morse Code. It implements the [CWCom protocol](http://kob.sdf.org/morsekob/docs/cwcom.pdf) as adopted by [MorseKOB](http://kob.sdf.org/morsekob/docs/history.pdf). You can try out the software in a [browser](http://kob.sdf.org/morsekob/morsekob30/index.htm) using Java.
## Why morse code over IP?
Why not? A number of different approaches for CW over IP exist. An early implementation has been the CWCom protocol,
which has been the basis for Morse KOB, a ready-to-use software. Both chat programs have been written for CW exclusively and are compatible. An alternative implementation in C exists as well as a port to the ATMEL AVR Microcontroller.
<<<<<<< HEAD
=== Original post ===
I have been using cwcom to practice sending morsecode, unfortunately my main computer at home is running openbsd and it has gotten harder to gain access to a reliable MS Windows machine. So I wrote my own client that works on openbsd.
This is written in C and although not tested it should compile under other OS. If any one wants to try it and send me feedback. you can download version 0.01 here http://fernan.bitbucket.org/irmc.tgz
Les Kerr of https://home.comcast.net/~morsekob/ has been very patient in answering my questions regarding the cwcom protocol and setting up a test server during debugging.
There are few difference between this and the official cwcom client
1. It is a command line tool
2. It does not send the characters of the message to the receivers screen.
3. It does not translate CW for you. You can try fldigi if you just want see the transmission.
4. Tone pitch is currently hard coded to 650Hz
5. It does not have a way to show you who is listening.
Bugs
There are a few that I am working on right now, but feel free to send me feedback if you get a chance to try it out.
File(s)
http://fernan.bitbucket.org/irmc.tgz
=======
Besides a variety of other approaches exist, for example an IRC plugin ([CWirc](http://myspace.voo.be/pcoupard/cwirc/)), a [JavaScript implementation](http://morsecode.me), a [bandwidth-eating UDP implementation](http://hans.liss.pp.se/node/343), a [chat for iOS](http://pignology.net/cwwithme.html) or a modulated CW over IP using Mumble ([iCW](https://sites.google.com/site/icwoip/)).
Resources
The following people have helped me a lot to learn the protocols and setting up test servers.
Les Kerr - https://home.comcast.net/~morsekob/
Bob Denny - http://morse-rss-news.sourceforge.net/
John Samin - http://www.mrx.com.au/
# How to build?
## Install dependency: morse keyer library
```
wget https://github.com/8cH9azbsFifZ/morse/archive/v0.1.tar.gz
tar xzf v0.1.tar.gz
cd morse-0.1
libtoolize
./autogen.sh
./configure --with-portaudio
make
sudo make install
```
>>>>>>> master
=== Source: http://fernski.blogspot.de/2013/03/internet-relay-morsecode.html ===
=== End Original Post ===
## Debian (Wheezy)
Some dependencies have to be installed:
```
apt-get install -y alsa-oss oss-compat build-essential autoconf libao-dev libtool
```
Afterwards compilation with `make` should work. If something went wrong, you may have
to adjust your `LD_LIBRARY_PATH`. Alternatively try:
```
LD_LIBRARY_PATH=/usr/local/lib ./irmc mtc-kob.dyndns.org 7890 33 123
```
## OSX (Yosemite)
Compilation with make :)
For the USB serial devices you need a PL2303 driver (i.e. [PL2303_Serial-USB_on_OSX_Lion.pkg](http://changux.co/osx-installer-to-pl2303-serial-usb-on-osx-lio/)).
## Testing with MorseKOB 3.0 (Java)
This [software](http://kob.sdf.org/morsekob/morsekob30/MorseKOB.jar) will run on
Linux, Windows and OSX. With the [RXTX software](http://morsekob.org/morsekob30/help.htm)
for Java (i.e. [librxtxSerial.jnilib](http://blog.brianhemeryck.me/installing-rxtx-on-mac-os-mountain-lion/) on OSX) it is even possible to connect to external hardware.
NB: before you transmit make sure you uncheck the "circuit closer".
# How to use:
The usage is: `irmc [hostname] [port] [channel] [id] [serialport`
For example:
`./irmc mtc-kob.dyndns.org 7890 103 MyID /dev/tty.usbserial´
## Morse KOB Servers
* faeroes.sdf.org 7890
* mtc-kob.dyndns.org 7890
A current list of servers if provided on the [MorseKOB Website](http://mtc-kob.dyndns.org).
## Hardware interface options
A good description on how to build differnt interfaces (telegraph key, sounder or both) is given on the [MorseKOB Website](http://kob.sdf.org/morsekob/interface.htm). Landline telegraphs use "closed circuits" for communications; if you have built one at home, you may also use the [loop interface](http://kob.sdf.org/morsekob/docs/loopinterface.pdf).
# Changelog
* v0.2 [zip](https://github.com/8cH9azbsFifZ/irmc/archive/v0.2.zip) - ported to debian wheezy and osx yosemite, DG6FL
* v0.1 [zip](https://github.com/8cH9azbsFifZ/irmc/archive/v0.1.zip) - original version, VE7FEB
# References
## Original post by Fernan Bolando (VE4FEB)
Copied on 20150103 from http://fernski.blogspot.de/2013/03/internet-relay-morsecode.html
> I have been using cwcom to practice sending morsecode, unfortunately my main computer at home is running openbsd and it has gotten harder to gain access to a reliable MS Windows machine. So I wrote my own client that works on openbsd.
> This is written in C and although not tested it should compile under other OS. If any one wants to try it and send me feedback. you can download version 0.01 here http://fernan.bitbucket.org/irmc.tgz
> Les Kerr of https://home.comcast.net/~morsekob/ has been very patient in answering my questions regarding the cwcom protocol and setting up a test server during debugging.
>
> There are few difference between this and the official cwcom client
> 1. It is a command line tool
> 2. It does not send the characters of the message to the receivers screen.
> 3. It does not translate CW for you. You can try fldigi if you just want see the transmission.
> 4. Tone pitch is currently hard coded to 650Hz
> 5. It does not have a way to show you who is listening.
>
> Bugs:
> There are a few that I am working on right now, but feel free to send me feedback if you get a chance to try it out.
>
> File(s)
> http://fernan.bitbucket.org/irmc.tgz
> The following people have helped me a lot to learn the protocols and setting up test servers.
> Les Kerr - https://home.comcast.net/~morsekob/
> Bob Denny - http://morse-rss-news.sourceforge.net/
> John Samin - http://www.mrx.com.au/
## Resources
* CWCom, John Samin (VK1EME): http://www.mrx.com.au/d_cwcom.htm
* Morse KOB, Les Kerr: https://sites.google.com/site/morsekob/ and http://kob.sdf.org/morsekob/
* Relay server for CW communicator and morse KOB: http://morsecode.dc3.com:7890
* Sources for the Relay Server: http://sourceforge.net/projects/morse-rss-news/
* MorseKOB for AT Mega, Fernan Bolando (VE4FEB): http://fernski.blogspot.de/2013/05/sending-morsecode-via-atmega.html

BIN
doc/cwcom.pdf Normal file

Binary file not shown.

View File

@ -31,20 +31,26 @@
#include <mach/mach.h>
#endif
<<<<<<< HEAD:irmc.c
=======
#define DEBUG 0
>>>>>>> master:src/irmc.c
#define MAXDATASIZE 1024 // max number of bytes we can get at once
#define DIS 0x0002
// Structures for the packets: unsigned short command
#define DIS 0x0002 // disconnect
#define DAT 0x0003
#define CON 0x0004
#define CON 0x0004 // connect
#define ACK 0x0005
#define DEBUG 0
// This structure will be used to (dis-)connect to KOB servers
struct command_packet_format{
unsigned short command;
unsigned short channel;
unsigned short command; // CON / DIS
unsigned short channel; // Channel number
};
#define SIZE_COMMAND_PACKET 4
// This structure will be used for id, rx and tx packets
struct data_packet_format{
unsigned short command;
unsigned short length;
@ -60,27 +66,15 @@ struct data_packet_format{
char a4[8];
};
struct code_packet_format{
unsigned short command;
unsigned short length;
char id[128];
char a1[4];
unsigned int sequence;
unsigned int a21;
unsigned int a22;
unsigned int a23;
signed int code[51];
unsigned int n;
char a3[128];
char a4[8];
};
#define SIZE_DATA_PACKET 496
struct command_packet_format connect_packet;
struct command_packet_format disconnect_packet = {DIS, 0};
struct data_packet_format id_packet;
struct data_packet_format rx_data_packet;
struct data_packet_format tx_data_packet;
int serial_status = 0, fd_speaker, fd_serial, fd_socket, numbytes;
int serial_status = 0, fd_serial, fd_socket, numbytes;
int tx_sequence = 0, rx_sequence;
double tx_timeout = 0;
@ -154,22 +148,23 @@ void *get_in_addr(struct sockaddr *sa)
return &(((struct sockaddr_in6*)sa)->sin6_addr);
}
// connect to server and send my id.
void
identifyclient(void)
{
tx_sequence++;
id_packet.sequence = tx_sequence;
send(fd_socket, &connect_packet, sizeof(connect_packet), 0);
send(fd_socket, &id_packet, 496, 0);
send(fd_socket, &connect_packet, SIZE_COMMAND_PACKET, 0);
send(fd_socket, &id_packet, SIZE_DATA_PACKET, 0);
}
// disconnect from the server
void
inthandler(int sig)
{
signal(sig, SIG_IGN);
send(fd_socket, &disconnect_packet, sizeof(disconnect_packet), 0);
send(fd_socket, &disconnect_packet, SIZE_COMMAND_PACKET, 0);
close(fd_socket);
close(fd_speaker);
close(fd_serial);
exit(1);
}
@ -226,7 +221,7 @@ commandmode(void)
tx_data_packet.code[0] = -1;
tx_data_packet.code[1] = 1;
tx_data_packet.n = 2;
for(i = 0; i < 5; i++) send(fd_socket, &tx_data_packet, 496, 0);
for(i = 0; i < 5; i++) send(fd_socket, &tx_data_packet, SIZE_DATA_PACKET, 0);
tx_data_packet.n = 0;
return 0;
}
@ -237,7 +232,7 @@ commandmode(void)
tx_data_packet.code[0] = -1;
tx_data_packet.code[1] = 2;
tx_data_packet.n = 2;
for(i = 0; i < 5; i++) send(fd_socket, &tx_data_packet, 496, 0);
for(i = 0; i < 5; i++) send(fd_socket, &tx_data_packet, SIZE_DATA_PACKET, 0);
tx_data_packet.n = 0;
return 0;
}
@ -397,8 +392,8 @@ int main(int argc, char *argv[])
if(tx_timer == 0)
if((numbytes = recv(fd_socket, buf, MAXDATASIZE-1, 0)) == -1)
usleep(250);
if(numbytes == 496 && tx_timer == 0){
memcpy(&rx_data_packet, buf, 496);
if(numbytes == SIZE_DATA_PACKET && tx_timer == 0){
memcpy(&rx_data_packet, buf, SIZE_DATA_PACKET);
#if DEBUG
printf("length: %i\n", rx_data_packet.length);
printf("id: %s\n", rx_data_packet.id);
@ -451,7 +446,7 @@ beep(1000.0, length/1000.);
if(tx_data_packet.n > 1 ){
tx_sequence++;
tx_data_packet.sequence = tx_sequence;
for(i = 0; i < 5; i++) send(fd_socket, &tx_data_packet, 496, 0);
for(i = 0; i < 5; i++) send(fd_socket, &tx_data_packet, SIZE_DATA_PACKET, 0);
#if DEBUG
printf("irmc: sent data packet.\n");
#endif
@ -482,7 +477,7 @@ beep(1000.0, length/1000.);
}
} /* End of mainloop */
send(fd_socket, &disconnect_packet, sizeof(disconnect_packet), 0);
send(fd_socket, &disconnect_packet, SIZE_COMMAND_PACKET, 0);
close(fd_socket);
close(fd_serial);