185. Printerlib

Some utility functions for printer conf. tools.

185.1. Summary of Module Globals

List of Global Functions

  • DisplayUnavailableAIPopup - Inform user that function isn't available during preparatino of AI via a popup

  • GetBluetoothDevices - Function to detect bluetooth devices

  • GetCupsUsbDeviceInfo - Get info about device connected to USB port from CUPS backed

  • GetCupsUsbDevicesInfo - Return the currently stored CUPS USB devices info

  • GetHPAllInOneModels - Get the list of all HP all-in-one models

  • ListBluetoothDevices - Function to return map of bluetooth devices

  • SetCupsUsbDevicesInfo - Set the USB devices info got through the CUPS backend

  • getDefaultPaperSize - get paper size from system and returns `a4 for a4 or `letter for letter

  • getDeviceNiceName - Get nice name of some device.

  • getEpsonUsbModel - Calls escputil to find out exact model of Epson stylus printer.

  • getHplipDevices - Get list of all HPLIP devices

  • getHplipUri - Get URI of HPLIP device

  • getPtalDevices - Get list of all PTAL devices

  • getPtalUri - Get URI of ptal device

  • getReplacedString - replace string "%20" to " "

  • getUriBaudrate - Get printer baud rate from uri. Applies to serial printers only. Does not check if passed uri belongs to serial printer.

  • getUriDevice - Get printer device from its uri.

  • getUriHost - Get host name from uri. Applies to lpd, novell, samba, ipp/http, socket

  • getUriNiceName - Get nice name for printer uri

  • getUriPort - Get port number from URI.

  • getUriRemoteQueue - Get printer remote queue. Input to this function must be valid because it just takes the part of uri after the last slash. Should be used for: lpd, novell, samba, http/ipp.

  • getUriType - Printer uri = type://device where type is one of parallel, serial, usb, file, lpd, novell, samba, ipp, socket, http and device is depending on the type. For parallel, serial, usb, file it is file name. For lpd it is server/queue. For socket it is server, for ipp, http it is server/path_to_queue, for samba, novell it is "user:pass@server/queuename" (user, pass is optional).

  • getUriUsernamePassWorkgroup - Get uri user name and password. Applies to samba, novell.

  • getUriValue - Get any parameter from uri. Suppose uri has form: method://user:pass@address/path?key=value+key=value+key=value

  • testDevice - Test device by sending hello world to it. See test_device for details.

  • testRemote - Test of the connection. See test_remote_lpd for details.

  • testRemoteUP - Test remote queue accessibility if username and password needed

List of Global Variables

185.2. Global Functions

185.2.1. DisplayUnavailableAIPopup

Inform user that function isn't available during preparatino of AI via a popup

Return value

  • void

185.2.2. GetBluetoothDevices

Function to detect bluetooth devices

Return value

  • map<string,string> - bluetooth devices

185.2.3. GetCupsUsbDeviceInfo

Get info about device connected to USB port from CUPS backed

Function parameters

  • string device

Return value

  • list<string> - a list containing CUPS device name, Printer model and UNIX-like device

185.2.4. GetCupsUsbDevicesInfo

Return the currently stored CUPS USB devices info

Return value

  • list<list<string> >

185.2.5. GetHPAllInOneModels

Get the list of all HP all-in-one models

Return value

  • list<string> - all-in-one models

185.2.6. ListBluetoothDevices

Function to return map of bluetooth devices

Return value

  • map<string,string> - bluetooth devices

185.2.7. SetCupsUsbDevicesInfo

Set the USB devices info got through the CUPS backend

Function parameters

  • list<list<string> > di

Return value

  • void

185.2.8. getDefaultPaperSize

get paper size from system and returns `a4 for a4 or `letter for letter

Return value

  • symbol - `a4 for a4, `letter for letter

185.2.9. getDeviceNiceName

Get nice name of some device.

Function parameters

  • string dev

  • boolean detected

Return value

  • string - device nice name

185.2.10. getEpsonUsbModel

Calls escputil to find out exact model of Epson stylus printer.

Function parameters

  • string device

Return value

  • string - Printer model. If unsuccessful, returns "Stylus".

185.2.11. getHplipDevices

Get list of all HPLIP devices

Return value

  • list<list<string> > - a list of HPLIP devices

185.2.12. getHplipUri

Get URI of HPLIP device

Function parameters

  • string model

Return value

  • string - ptal uri or nil if no ptal device found

185.2.13. getPtalDevices

Get list of all PTAL devices

Return value

  • list<list<string> > - a list of PTAL devices

185.2.14. getPtalUri

Get URI of ptal device

Function parameters

  • string model

Return value

  • string - ptal uri or nil if no ptal device found

185.2.15. getReplacedString

replace string "%20" to " "

Function parameters

  • string device

  • boolean show_pass

Return value

  • string - visible_string

185.2.16. getUriBaudrate

Get printer baud rate from uri. Applies to serial printers only. Does not check if passed uri belongs to serial printer.

Function parameters

  • string uri

Return value

  • integer - baud rate

185.2.17. getUriDevice

Get printer device from its uri.

Function parameters

  • string uri

Return value

  • string - device

185.2.18. getUriHost

Get host name from uri. Applies to lpd, novell, samba, ipp/http, socket

Function parameters

  • string uri

Return value

  • string - hostname

185.2.19. getUriNiceName

Get nice name for printer uri

Function parameters

  • string uri

Return value

  • string - nice name of printer uri (device, network printer...)

185.2.20. getUriPort

Get port number from URI.

Function parameters

  • string uri

Return value

  • integer - port

185.2.21. getUriRemoteQueue

Get printer remote queue. Input to this function must be valid because it just takes the part of uri after the last slash. Should be used for: lpd, novell, samba, http/ipp.

Function parameters

  • string uri

Return value

  • string - remote queue

185.2.22. getUriType

Printer uri = type://device where type is one of parallel, serial, usb, file, lpd, novell, samba, ipp, socket, http and device is depending on the type. For parallel, serial, usb, file it is file name. For lpd it is server/queue. For socket it is server, for ipp, http it is server/path_to_queue, for samba, novell it is "user:pass@server/queuename" (user, pass is optional).

Function parameters

  • string uri

Return value

  • string - type of printer or ""

185.2.23. getUriUsernamePassWorkgroup

Get uri user name and password. Applies to samba, novell.

Function parameters

  • string uri

Return value

  • list - [ username, password, workgroup ]

185.2.24. getUriValue

Get any parameter from uri. Suppose uri has form: method://user:pass@address/path?key=value+key=value+key=value

Function parameters

  • string uri

  • string key

Return value

  • string - value

185.2.25. testDevice

Test device by sending hello world to it. See test_device for details.

Function parameters

  • string dev

Return value

  • void

185.2.26. testRemote

Test of the connection. See test_remote_lpd for details.

Function parameters

  • string hname

  • string rname

  • string type

  • integer port

Return value

  • void

185.2.27. testRemoteUP

Test remote queue accessibility if username and password needed

Function parameters

  • string wg

  • string hname

  • string rname

  • string user

  • string pass

  • string type

Return value

  • void

185.3. Global Variables

185.3.1. baseDataDir

Base directory of printconf's data files

185.3.2. proposal_valid

set to true after function Read had been called.

185.4. Module Requirements

185.4.1. Module Imports

  • Arch
  • Directory
  • FileUtils
  • Mode
  • Popup
  • Report
  • Service
  • String

185.4.2. Module Includes

  • printer/texts.ycp