crystalfontz.dbus.interface
This module contains the core DbusInterface class. This class is used directly to serve the interface, and is subclassed by the DbusClient class in crystalfontz.dbus.client.
You will likely not use this module directly. For information on the client, see crystalfontz.dbus.client. For information on the service, see crystalfontz.dbus.service.
DbusInterface
Bases: DbusInterfaceCommonAsync
A DBus interface for controlling the Crystalfontz device.
Source code in crystalfontz/dbus/interface.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 | |
closed
property
A Future that resolves when the client is closed.
clear_screen(timeout, retry_times)
async
6 (0x06): Clear LCD Screen
Sets the contents of the LCD screen DDRAM to '' = 0x20 = 32 and moves the cursor to the left-most column of the top line.
Source code in crystalfontz/dbus/interface.py
366 367 368 369 370 371 372 373 374 375 376 377 378 379 | |
close()
async
Unsubscribe from events and close the client.
Source code in crystalfontz/dbus/interface.py
136 137 138 139 140 141 142 143 | |
config()
The DBus service's currently loaded configuration.
Source code in crystalfontz/dbus/interface.py
128 129 130 131 132 133 134 | |
configure_key_reporting(when_pressed, when_released, timeout, retry_times)
async
23 (0x17): Configure Key Reporting
By default, the device reports any key event to the host. This command allows the key events to be enabled or disabled on an individual basis.
This is a privileged API, as it impacts the availability of key reports for other users.
Source code in crystalfontz/dbus/interface.py
671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 | |
configure_watchdog(timeout_seconds, timeout, retry_times)
async
29 (0x1D): Enable/Disable and Reset the Watchdog
Some high-availability systems use hardware watchdog timers to ensure that a software or hardware failure does not result in an extended system outage. Once the host system has booted, a system monitor program is started. The system monitor program would enable the watchdog timer on the device. If the system monitor program fails to reset the device's watchdog timer, the device will reset the host system.
The GPIO pins used for ATX control must not be configured as user GPIO. For more details, review your device's datasheet.
This is a privileged API, as configuring the watchdog can impact the availability of the host.
Source code in crystalfontz/dbus/interface.py
742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 | |
detect_baud_rate(timeout, retry_times)
async
Detect the device's configured baud rate by testing the connection at each potential baud setting.
This is a privileged API, as it modifies the baud rate used by the both the client and the device.
Source code in crystalfontz/dbus/interface.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | |
detect_device(timeout, retry_times)
async
Get model, hardware and firmware versions from the device, then configure the client to use that device. This is useful if you don't know a priori what device you're using.
This is a privileged API, as it modifies the device settings for the client.
Source code in crystalfontz/dbus/interface.py
225 226 227 228 229 230 231 232 233 234 235 236 | |
dow_transaction(index, bytes_to_read, data_to_write, timeout, retry_times)
async
20 (0x14): Arbitrary DOW Transaction
The unit can function as an RS-232 to Dallas 1-Wire bridge. The unit can send up to 15 bytes and receive up to 14 bytes. This will be sufficient for many devices, but some devices require larger transactions and cannot by fully used with the unit.
For more information, review your unit's datasheet.
Source code in crystalfontz/dbus/interface.py
595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 | |
key_activity_reports()
Listen for key activity reports.
Source code in crystalfontz/dbus/interface.py
885 886 887 888 889 890 891 | |
ping(payload, timeout, retry_times)
async
0 (0x00): Ping Command
The device will return the Ping Command to the host.
Source code in crystalfontz/dbus/interface.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
poll_keypad(timeout, retry_times)
async
24 (0x18): Read Keypad, Polled Mode
In some situations, it may be convenient for the host to poll the device for key activity. This command allows the host to detect which keys are currently pressed, which keys have been pressed since the last poll, and which keys have been released since the last poll.
Source code in crystalfontz/dbus/interface.py
696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 | |
read_dow_device_information(index, timeout, retry_times)
async
18 (0x12): Read DOW Device Information
When power is applied to the unit, it detects any devices connected to the Dallas Semiconductor One-Wire (DOW) bus and stores the device's information. This command will allow the host to read the device's information.
Note: The GPIO pin used for DOW must not be configured as user GPIO. For more information, review your unit's datasheet.
Source code in crystalfontz/dbus/interface.py
548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 | |
read_gpio(index, timeout, retry_times)
async
35 (0x23): Read GPIO Pin Levels and Configuration State
See method client.set_gpio for details on the GPIO architecture.
This functionality comes with many caveats. Please review the documentation in your device's datasheet.
Source code in crystalfontz/dbus/interface.py
863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 | |
read_lcd_memory(address, timeout, retry_times)
async
10 (0x0A): Read 8 bytes of LCD Memory
This command will return the contents of the LCD's DDRAM or CGRAM. This command is intended for debugging.
Source code in crystalfontz/dbus/interface.py
454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 | |
read_status(timeout, retry_times)
async
30 (0x1E): Read Reporting & Status
This command can be used to verify the current items configured to report to the host, as well as some other miscellaneous status information. Please note that the information returned is not identical between devices, and may in fact vary between firmware versions of the same model. As such, the return value of this function is not type-safe.
Source code in crystalfontz/dbus/interface.py
770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 | |
read_user_flash_area(timeout, retry_times)
async
3 (0x03): Read User Flash Area
This command will read the User Flash Area and return the data to the host.
For more information, review the documentation for
client.write_user_flash_area.
Source code in crystalfontz/dbus/interface.py
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | |
reboot_lcd(timeout, retry_times)
async
Reboot the device, using 5 (0x05): Reboot Device, Reset Host, or Power Off Host.
Rebooting the device may be useful for testing the boot configuration. It may also be useful to re-enumerate the devices on the One-Wire bus.
This is a privileged API, as it impacts the availability of the device.
Source code in crystalfontz/dbus/interface.py
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | |
reset_host(timeout, retry_times)
async
Reset the host, using 5 (0x05): Reboot Device, Reset Host, or Power Off Host.
This command assumes the host's reset line is connected to GPIO[3]. For more information, review your device's datasheet.
This is a privileged API, as it impacts the availability of the host.
Source code in crystalfontz/dbus/interface.py
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | |
send_command_to_lcd_controller(location, data, timeout, retry_times)
async
22 (0x16): Send Command Directly to the LCD Controller
The controller on the CFA533 is HD44780 compatible. Generally, you will not need low-level access to the LCD controller but some arcane functions of the HD44780 are not exposed by the CFA533's command set. This command allows you to access the CFA533's LCD controller directly.
Source code in crystalfontz/dbus/interface.py
648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 | |
send_data(row, column, data, timeout, retry_times)
async
31 (0x1F): Send Data to LCD
This command allows data to be placed at any position on the LCD.
Source code in crystalfontz/dbus/interface.py
792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 | |
set_atx_power_switch_functionality(settings, timeout, retry_times)
async
28 (0x1C): Set ATX Power Switch Functionality
The combination of this device with the Crystalfontz WR-PWR-Y14 cable can be used to replace the function of the power and reset switches in a standard ATX-compatible system.
This functionality comes with a number of caveats. Please review your device's datasheet for more information.
This is a privileged API, as changing these settings can impact the availability of the device.
Source code in crystalfontz/dbus/interface.py
717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 | |
set_backlight(lcd_brightness, keypad_brightness, timeout, retry_times)
async
14 (0x0E): Set LCD & Keypad Backlight
This command sets the brightness of the LCD and keypad backlights.
Source code in crystalfontz/dbus/interface.py
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 | |
set_baud_rate(baud_rate, timeout, retry_times)
async
33 (0x21): Set Baud Rate
This command will change the device's baud rate. This method sends the baud
rate command, waits for a positive acknowledgement from the device at the old
baud rate, and then switches to the new baud rate. The baud rate must be saved
by a call to client.store_boot_state if you want the device to power up at
the new baud rate.
This is a privileged API, as changing the baud rate can impact the availability of the device.
Source code in crystalfontz/dbus/interface.py
811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 | |
set_contrast(contrast, timeout, retry_times)
async
13 (0x0D): Set LCD Contrast
This command sets the contrast or vertical viewing angle of the display.
Source code in crystalfontz/dbus/interface.py
511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 | |
set_cursor_position(row, column, timeout, retry_times)
async
11 (0x0B): Set LCD Cursor Position
This command allows the cursor to be placed at the desired location on the device's LCD screen.
Source code in crystalfontz/dbus/interface.py
474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 | |
set_cursor_style(style, timeout, retry_times)
async
12 (0x0C): Set LCD Cursor Style
This command allows you to select among four hardware generated cursor options.
Source code in crystalfontz/dbus/interface.py
493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 | |
set_gpio(index, output_state, settings, timeout, retry_times)
async
34 (0x22): Set or Set and Configure GPIO Pins
The CFA533 (hardware versions 1.4 and up, firmware versions 1.9 and up) has five pins for user-definable general purpose input / output (GPIO). These pins are shared with the DOW and ATX functions. Be careful when you configure GPIO if you want to use the ATX or DOW at the same time.
This functionality comes with many caveats. Please review the documentation in your device's datasheet.
This is a privileged API, as changing these settings can impact the availability of the device.
Source code in crystalfontz/dbus/interface.py
835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 | |
set_line_1(line, timeout, retry_times)
async
7 (0x07): Set LCD Contents, Line 1
Sets the center 16 characters displayed on the top line of the LCD screen.
Please use this command only if you need backwards compatibility with older
devices. For new applications, please use the more flexible command
client.send_data.
Source code in crystalfontz/dbus/interface.py
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 | |
set_line_2(line, timeout, retry_times)
async
8 (0x08): Set LCD Contents, Line 2
Sets the center 16 characters displayed on the bottom line of the LCD screen.
Please use this command only if you need backwards compatibility with older
devices. For new applications, please use the more flexible command
client.send_data.
Source code in crystalfontz/dbus/interface.py
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | |
set_special_character_data(index, character, timeout, retry_times)
async
9 (0x09): Set LCD Special Character Data
Sets the font definition for one of the special characters (CGRAM).
This is a privileged API, as it modifies the state of the device.
Source code in crystalfontz/dbus/interface.py
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 | |
set_special_character_encoding(character, index)
async
Configure a unicode character to encode to the index of a given special character on CGRAM.
This is a privileged API, as it modifies the configuration of the client.
Source code in crystalfontz/dbus/interface.py
439 440 441 442 443 444 445 446 447 448 449 450 451 452 | |
setup_live_temperature_display(slot, item, timeout, retry_times)
async
21 (0x15): Set Up Live Temperature Display
You can configure the device to automatically update a portion of the LCD with a "live" temperature reading. Once the display is configured using this command, the device will continue to display the live reading on the LCD without host intervention.
Source code in crystalfontz/dbus/interface.py
625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 | |
setup_temperature_reporting(enabled, timeout, retry_times)
async
19 (0x13): Set Up Temperature Reporting
This command will configure the device to report the temperature information to the host every second.
This is a privileged API, as it impacts the availability of temperature reports for other users.
Source code in crystalfontz/dbus/interface.py
574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 | |
shutdown_host(timeout, retry_times)
async
Turn off the host's power, using 5 (0x05): Reboot Device, Reset Host, or Power Off Host.
This command assumes the host's power control line is connected to GPIO[2]. For more information, review your device's datasheet.
This is a privileged API, as it impacts the availability of the host.
Source code in crystalfontz/dbus/interface.py
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | |
store_boot_state(timeout, retry_times)
async
4 (0x04): Store Current State as Boot State
The device loads its power-up configuration from nonvolatile memory when power is applied. The device is configured at the factory to display a "welcome" screen when power is applied. This command can be used to customize the "welcome" screen, as well as the following items:
- Characters shown on LCD
- Special character font definitions
- Cursor position
- Cursor style
- Contrast setting
- LCD backlight setting
- Settings of any "live" displays, such as temperature display
- Key press and release masks
- ATX function enable and pulse length settings
- Baud rate
- GPIO settings
You cannot store the temperature reporting (although the live display of temperatures can be saved). You cannot store the host watchdog. The host software should enable this item once the system is initialized and is ready to receive the data.
This is a privileged API, as it modifies the state of the device.
Source code in crystalfontz/dbus/interface.py
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | |
temperature_reports()
Listen for temperature reports.
Source code in crystalfontz/dbus/interface.py
893 894 895 896 897 898 899 | |
test_connection(timeout, retry_times)
async
Test the connection by sending a ping and checking that the response matches.
Source code in crystalfontz/dbus/interface.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | |
versions(timeout, retry_times)
async
1 (0x01): Get Hardware & Firmware Version
The device will return the hardware and firmware version information to the host.
Source code in crystalfontz/dbus/interface.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
write_user_flash_area(data, timeout, retry_times)
async
2 (0x02): Write User Flash Area
The CFA533 reserves 16 bytes of nonvolatile memory for arbitrary use by the host. This memory can be used to store a serial number, IP address, gateway address, netmask, or any other data required. All 16 bytes must be supplied.
This is a privileged API, as it modifies the state of the device.
Source code in crystalfontz/dbus/interface.py
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | |