main.qml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. import QtQuick 2.7
  2. import QtQuick.Window 2.2
  3. import gfa.plugins.qml.tivaflash 1.0
  4. Window {
  5. visible: true
  6. width: 640
  7. height: 480
  8. property int statNr: 1
  9. property int mbAddr: 100
  10. Rectangle {
  11. anchors.fill: parent
  12. gradient: Gradient {
  13. GradientStop { position: 0.0; color: "gray" }
  14. GradientStop { position: 0.5; color: "black" }
  15. GradientStop { position: 1.0; color: "dimgray" }
  16. }
  17. }
  18. Text {
  19. id: headline
  20. x: 250
  21. y: 5
  22. color: "white"
  23. font.pixelSize: 24
  24. text: qsTr("GfA Tiva Flash Utility")
  25. }
  26. Text {
  27. id: stationNr
  28. x: 700
  29. y: 50
  30. color: "white"
  31. font.pixelSize: 24
  32. text: statNr
  33. }
  34. Text {
  35. id: idExecOut
  36. x: 5
  37. y: 60
  38. width: 630
  39. height: 300
  40. color: "white"
  41. font.pixelSize: 14
  42. text: "Test"
  43. }
  44. Text {
  45. id: materialEepromText
  46. x: 500
  47. y: 100
  48. color: "white"
  49. font.pixelSize: 14
  50. text: idTivaFlash.materialEeprom[statNr]
  51. }
  52. Text {
  53. id: serialEepromText
  54. x: 500
  55. y: 120
  56. color: "white"
  57. font.pixelSize: 14
  58. text: idTivaFlash.serialEeprom[statNr]
  59. }
  60. Rectangle
  61. {
  62. x: 500
  63. y: 50
  64. width: 100
  65. height: 40
  66. color: "green"
  67. Text {
  68. text: "getMatSer"
  69. anchors.centerIn: parent
  70. color: "white"
  71. }
  72. MouseArea
  73. {
  74. anchors.fill: parent
  75. onClicked: idTivaFlash.getMatSer(statNr)
  76. }
  77. }
  78. TivaFlash {
  79. id: idTivaFlash
  80. tivaFlashUtilPath: "/opt/GfA/tivaflashutil/gfativaflashutil"
  81. itfName: "/dev/ttyO4"
  82. slvIdIsNodeAddr: false
  83. imgFile: "/opt/GfA/tivaflashutil/OLS-1V1_0009_crc.bin"
  84. verbosity: 3
  85. onMaterialFileChanged:
  86. {
  87. // materialEepromText.text = materialEeprom[1];
  88. }
  89. onExecOut:
  90. {
  91. idExecOut.text += msg + "\n";
  92. idExecOut.update();
  93. console.log(msg);
  94. }
  95. }
  96. MouseArea {
  97. x: 0
  98. y: 0
  99. width: 400
  100. height: 480
  101. // anchors.fill: parent
  102. onClicked:
  103. {
  104. // var statNr = 1;
  105. // var mbAddr = 100;
  106. var ret = false;
  107. idExecOut.text = "";
  108. ret = idTivaFlash.pingTarget(statNr);
  109. // ret = idTivaFlash.startBootloader(statNr, mbAddr);
  110. // ret = idTivaFlash.resetBootloader(statNr, mbAddr);
  111. // ret = idTivaFlash.validateImgFile(statNr, mbAddr);
  112. ret = false;
  113. }
  114. }
  115. }