23
cfsprinter Documentation Release 0.1 Michael Farrell Nov 01, 2018

Release 0.1 Michael Farrell

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Release 0.1 Michael Farrell

cfsprinter DocumentationRelease 0.1

Michael Farrell

Nov 01, 2018

Page 2: Release 0.1 Michael Farrell
Page 3: Release 0.1 Michael Farrell

Contents

1 Using with a web-based paging feed 31.1 Configuring pagerprinter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2 Using with PDW 52.1 Configuring pagerprinter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.2 Configuring the radio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.3 Configuring PDW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.4 Adding more pager group addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

3 Browser Support 93.1 Mozilla Firefox + cmdlnprint (firefox) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.2 Disabling printing maps (test) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

4 Mapping Support 114.1 Google Printer-friendly (google) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114.2 Google Screen (googlescreen) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114.3 Other mapping options under investigation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114.4 Mapping sites that will never work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

5 Plugins 135.1 Huawei SMS Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135.2 Log file plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145.3 CUPS/LPD printing plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145.4 Windows printing plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

6 Thanks <3 17

7 Indices and tables 19

i

Page 4: Release 0.1 Michael Farrell

ii

Page 5: Release 0.1 Michael Farrell

cfsprinter Documentation, Release 0.1

pagerprinter is a program to perform actions based on paged messages generated by the South Australian CountryFire Service.

This application is not supported, endorsed, or created by any Fire Service. While care has been taken while writ-ing this application, it is created for informational purposes only and should not be relied upon in the event of anemergency.

This documentation is under construction.

Contents:

Contents 1

Page 6: Release 0.1 Michael Farrell

cfsprinter Documentation, Release 0.1

2 Contents

Page 7: Release 0.1 Michael Farrell

CHAPTER 1

Using with a web-based paging feed

The regular mode of operation of pagerprinter is to use a web-based paging feed. This scrapes from the AJAX updatefunctionality of urgmsg.net and sacfs.org’s pager feeds.

This requires an internet connection, and polls the servers by default every 30 seconds. This is in many cases slowerthan their own JavaScript updates their paging feed, so causes less load than leaving the web page open.

If you can, use this software with a local scanner and PDW, as it causes no load on these servers and updates quicker.You can read more about this option in Using with PDW.

1.1 Configuring pagerprinter

In order to use PDW, the [pagerprinter] backend setting must be set:

[pagerprinter]; To use paging1.sacfs.org (primary server)backend = sacfs

; To use paging2.sacfs.orgbackend = sacfs2

; To use paging3.sacfs.orgbackend = sacfs3

; To use urgmsg.netbackend = sacfs-urgmsg

; Set the update frequency to every 30 seconds. If you don't need it,; you should increase this duration so it updates less frequently.update-frequency = 30

3

Page 8: Release 0.1 Michael Farrell

cfsprinter Documentation, Release 0.1

4 Chapter 1. Using with a web-based paging feed

Page 9: Release 0.1 Michael Farrell

CHAPTER 2

Using with PDW

PDW is a pager decoder software. It can be used in conjunction with pagerprinter to recieve pages “over the air”(ie: without an internet connection) from the SAGRN service.

It will require connecting an appropriate radio’s discriminator output, tuned to 148.8125 MHz, to the input of asound card attached to your computer.

The module makes no allowances for errors in the pages received, so you will need to ensure that you have a goodsignal. Corrupted pages will not be parsed correctly.

Note: This module is currently under development and does not yet recognise all pager group addresses (flex codes /cap codes). This is required in order to be able to know which station a page is for.

2.1 Configuring pagerprinter

In order to use PDW, the [pagerprinter] backend setting must be set to sacfs-pdw:

[pagerprinter]backend = sacfs-pdw

There are no other configuration options currently available for this scraper.

The update-frequency setting has no effect – all pages will be passed asynchronously as soon as they are re-ceived.

2.2 Configuring the radio

The radio will need to be tuned to the SAGRN pager frequency, 148.8125 MHz FM.

5

Page 10: Release 0.1 Michael Farrell

cfsprinter Documentation, Release 0.1

The discriminator output of the radio will need to be attached to your computer’s line-in jack. Most radios do notprovide a direct discriminator output, and will require some soldering and circuitry in order to access it. This isoutside of the scope of this document.

Once this is complete, you should be able to hear through the line-in jack, pager data at least once every minute, andstatic between pages (when there is no carrier).

The audio must through the left audio channel, as this is the channel used by PDW. It does not matter if it also comesthrough the right audio channel, as long as it is also coming through the left.

2.3 Configuring PDW

In PDW, it will need to be configured to decode FLEX 1600 pages. You will also need to configure PDW to receivepages from a sound card (it defaults to a serial device).

You should be able to see the pages as they come in on the main screen of PDW, with minimal data errors (theseare shown in light red – correct data is shown in cyan). If you don’t, there may be issues with your audio levels orinsufficient signal strength in your location.

About once every minute there should be a page on your screen for FLEX address 1900253, which are test pages.They should give you an easy way to test various settings and antenna configurations.

Once the configuration is verified as working, you can then setup the link between pagerprinter and PDW.

When using the sacfs-pdw scraper in pagerprinter, it will run an SMTP server bound to localhost:8825.PDW can then send emails to this server and this will generate events inside of pagerprinter.

It does not require an email account to use or an active internet connection. The messages will be entirely confined toyour own computer – SMTP is merely used as a way to pass messages around.

In order to configure PDW to propegate pages to pagerprinter:

1. Options → SMTP/Email. . .

2. Tick Enable Email Notification.

3. Set Setting to All messages.

4. Set Port to 8825.

5. Set SMTP Host to localhost.

6. Make sure Enable Authentication is not ticked.

7. In Mail options, tick only Address, Time, Date and Message.

8. Set Notification to Message.

9. Set the To and From email addresses to a valid email address. It won’t be used for sending mail.

2.4 Adding more pager group addresses

Pager group addresses (flex codes / cap codes) are stored in src/pagerprinter/scrapers/sacfs_flexcode.py, in the pagerprinter.scrapers.sacfs_flexcode.CODES dict.

In order to start working on managing the codes, you will need to dump the existing codes to a sqlite database:

$ python -m pagerprinter.misc.urgmsg_mkdb -d codes.db3

6 Chapter 2. Using with PDW

Page 11: Release 0.1 Michael Farrell

cfsprinter Documentation, Release 0.1

This will create a file called codes.db3 in the current directory with the existing codes that are insacfs_flexcode.py. Any conflicting codes will be overwritten.

You can then scrape the urgmsg.net site for new codes with:

$ python -m pagerprinter.misc.urgmsg_get_codes -d codes.db3

Once you have new codes, you can then output that back to sacfs_flexcode.py with:

$ python -m pagerprinter.misc.urgmsg_export_codes -d codes.db3 -o src/pagerprinter/→˓scrapers/sacfs_flexcode.py

2.4. Adding more pager group addresses 7

Page 12: Release 0.1 Michael Farrell

cfsprinter Documentation, Release 0.1

8 Chapter 2. Using with PDW

Page 13: Release 0.1 Michael Farrell

CHAPTER 3

Browser Support

In order to print out a map to the location where the pager message references, you require a web browser that canprint out on the commandline.

Only Mozilla Firefox is supported at this time.

3.1 Mozilla Firefox + cmdlnprint (firefox)

In order to use the Firefox plugin, you need to set [pagerprinter].‘‘browser‘‘ to firefox, and[pagerprinter].‘‘browser-exec‘‘ to the full path of Mozilla Firefox binary (or just firefox if it is in yourPATH:

[pagerprinter]browser = firefox

; On Linux, do this:browser-exec = firefox

; On Mac OS X, you'll want something like this:browser-exec = /Applications/Firefox.app/Contents/MacOS/firefox-bin

; On Windows, you'll want something like this:browser-exec = C:\Program Files\Mozilla Firefox\Firefox.exe

; You may optionally specify a printer name. If it is not specified, it; will use the system default printer. On CUPS-based printing systems,; this is the printer's short name. On Windows this is the full printer; name.printer = Father DeskLaser 934TXS

; You can also print multiple copies. By default only 1 is printed.print-copies = 1

9

Page 14: Release 0.1 Michael Farrell

cfsprinter Documentation, Release 0.1

You’ll then need to install the cmdlnprint extension in Firefox. This only works on upto Firefox v3.6, so you may wantto download the old version of Firefox from PortableApps and configure pagerprinter to use this, which should work.You shouldn’t use the old version of Firefox for anything else due to security issues.

There one tweakable option, the browser-wait setting. This controls how many seconds to wait for the map toload before printing it out.

3.2 Disabling printing maps (test)

You can disable printing maps by setting browser to test:

[pagerprinter]browser = test

Instead of printing the maps, it will send the URI for the map to stdout.

10 Chapter 3. Browser Support

Page 15: Release 0.1 Michael Farrell

CHAPTER 4

Mapping Support

When printing maps, you can use a couple of different providers. This is configurable with the[pagerprinter]].‘‘mapper‘‘ option in pagerprinter.ini.

You will need to also set your “home address” for the routing to work.

[pagerprinter]home = 175 Waymouth Street, Adelaide, South Australiamapper = google

4.1 Google Printer-friendly (google)

This handler uses the printer-friendly maps on the Google Maps website to make a list of directions. It only has texton it.

4.2 Google Screen (googlescreen)

This handler uses the screen / display version of the Google Maps website, to show the route with images and text.

It doesn’t fit as well onto a page, but shows a bigger map.

4.3 Other mapping options under investigation

4.3.1 Bing Maps

Supplies API and website. It doesn’t generate nice printer-friendly URIs like Google Maps. API requires registrationand access keys.

Australian mapping source for Bing isn’t very good, and has many errors (such as listing certain PoIs by a name thathasn’t been used in over 40 years, missing roads, and listing private roads as thoroughfares).

11

Page 16: Release 0.1 Michael Farrell

cfsprinter Documentation, Release 0.1

4.3.2 OpenStreetMaps

Doesn’t provide a router (for directions), so will require running your own route server.

Coverage varies greatly. Most roads are in the map but are often not labelled by name.

4.4 Mapping sites that will never work

4.4.1 Whereis

Provides no public (free) API. Searches are saved in a database by ID, then this is recalled with some funky JavaScriptand referrer tricks in order to generate printer-friendly views.

Sensis/Whereis data has been incorporated into Google Maps in many parts (which is much more accessible), so isn’ta great loss.

4.4.2 Yahoo

Does not provide navigation.

12 Chapter 4. Mapping Support

Page 17: Release 0.1 Michael Farrell

CHAPTER 5

Plugins

pagerprinter can do other actions than printing when it receives a page. These are configured as plugins.

5.1 Huawei SMS Plugin

Code author: Shane Rees

This plugin sends pages recieved as a text message via a Huawei USB 3G modem.

This module will only work on Linux, and requires that the dongle be in “serial” mode. This may require that you useusbmodeswitch to adjust the device. Most Linux distributions do this automatically through udev.

This module requires that you have installed pyserial.

This plugin has some limitations:

• It will not create “concatenated” SMS for long messages – instead it will send as many messages as needed todisplay the entire message.

• It will not work with dongles that have their SIM card protected with a PIN without it being unlocked first (byanother program).

5.1.1 Configuring the plugin

Configuration for the plugin is done through the pagerprinter.ini configuration file.

In order to activate the plugin, it must appear in the list of plugins.

[pagerprinter]; Other plugins may be used as well, list them seperated by commas.plugins = huaweisms

[huaweisms]; This is a comma seperated list of phone numbers to send the SMS to.

(continues on next page)

13

Page 18: Release 0.1 Michael Farrell

cfsprinter Documentation, Release 0.1

(continued from previous page)

; This can be in local format or international format.to = 0491570110,+61491570156

; This is the serial port that the Huawei dongle uses.; There are often 2 or 3 ports that the dongle assigns -- use the first of; those.port = /dev/ttyUSB0

5.2 Log file plugin

This plugin logs all pages it recieves to a file.

It will append to an existing file in order to log.

5.2.1 Configuring the plugin

Configuration for the plugin is done through the pagerprinter.ini configuration file.

In order to activate the plugin, it must appear in the list of plugins.

[pagerprinter]; Other plugins may be used as well, list them seperated by commas.plugins = logfile

[logfile]; Full path to the file where you wish to log tofilename = c:\pagerprinter\pages.txt

; You must also specify how line feeds should be written in the log file.; If set to 1, this will write DOS-style linefeeds ("\r\n").; If set to 0, this will write UNIX-style linefeeds ("\n").crlf = 0

5.3 CUPS/LPD printing plugin

This plugin prints the content of all pages. This is different to the standard behaviour – this doesn’t print a map, itprints the page text itself.

This calls lpr in order to do the actual printing.

This plugin only works on operating systems with CUPS (so Linux and Mac OS X). Windows systems should use theWindows printing plugin instead.

5.3.1 Configuring the plugin

Configuration for the plugin is done through the pagerprinter.ini configuration file.

In order to activate the plugin, it must appear in the list of plugins.

This uses the same printer configuration as the main mapping part of the application.

14 Chapter 5. Plugins

Page 19: Release 0.1 Michael Farrell

cfsprinter Documentation, Release 0.1

[pagerprinter]; Other plugins may be used as well, list them seperated by commas.plugins = winprint

; This shares the same print setting as the rest of the application.; If not specified, this will use the system default printer.printer = 934TXS

; You can also print multiple copies. By default only 1 is printed.print-copies = 1

; You can control the size of the text with the following:; Number of characters per inch printed (lower numbers == wider text); If not specified, this normally defaults to 10 characters per inch.print-cpi = 10

; Number of lines per inch printed (lower numbers == taller text); If not specified, this normally defaults to 6 lines per inch.print-lpi = 6

5.4 Windows printing plugin

This plugin prints the content of all pages. This is different to the standard behaviour – this doesn’t print a map, itprints the page text itself.

This plugin calls the default text print action in order to print the page (normally this is Notepad). Therefore textformatting is configurable by changing Notepad’s settings.

This plugin only works on Windows. CUPS-based systems should use the CUPS/LPD printing plugin instead.

5.4.1 Configuring the plugin

Configuration for the plugin is done through the pagerprinter.ini configuration file.

In order to activate the plugin, it must appear in the list of plugins.

This uses the same printer configuration as the main mapping part of the application.

[pagerprinter]; Other plugins may be used as well, list them seperated by commas.plugins = winprint

; This shares the same print setting as the rest of the application.; If not specified, this will use the system default printer.printer = Father DeskLaser 934TXS

; You can also print multiple copies. By default only 1 is printed.print-copies = 1

5.4. Windows printing plugin 15

Page 20: Release 0.1 Michael Farrell

cfsprinter Documentation, Release 0.1

16 Chapter 5. Plugins

Page 21: Release 0.1 Michael Farrell

CHAPTER 6

Thanks <3

Shane Rees provided the Huawei SMS Plugin, lots of testing and information about the SAGRN paging network.

urgmsg.net and sacfs.org provide the web based versions of the paging feed that make this application work.

17

Page 22: Release 0.1 Michael Farrell

cfsprinter Documentation, Release 0.1

18 Chapter 6. Thanks <3

Page 23: Release 0.1 Michael Farrell

CHAPTER 7

Indices and tables

• genindex

• modindex

• search

19