Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

JLObuSDK.js 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. var JLSDK = require("./JLDeviceWechat+33Protocol"),
  2. code = require("./errorCode");
  3. export function ScanDevice(t, e) {
  4. JLSDK.scanDevice(t, 1e4, t => {
  5. e.call(this, t)
  6. })
  7. }
  8. export function StopScanDevice(t) {
  9. JLSDK.stopScanDevice(e => {
  10. t.call(this, e)
  11. })
  12. }
  13. export function ConnectDevice(t, e, c) {
  14. JLSDK.connectDevice(t, t => {
  15. c.call(this, t), 0 == t.code && JLSDK.onDisconnet(t => {
  16. e.call(this, t)
  17. })
  18. })
  19. }
  20. export function DisconnectDevice(t) {
  21. JLSDK.disConnectDevice(e => {
  22. t.call(this, e)
  23. })
  24. }
  25. export function OpenChannel(t) {
  26. JLSDK.ESAMRset(e => {
  27. t.call(this, e)
  28. })
  29. }
  30. export function GetSerialNo(t) {
  31. JLSDK.getObuSN(e => {
  32. t.call(this, e)
  33. })
  34. }
  35. export function checkCardExists(t) {
  36. JLSDK.checkCard(e => {
  37. t.call(this, e)
  38. })
  39. }
  40. export function OpenCard(t) {
  41. JLSDK.ICCReset(e => {
  42. t.call(this, e)
  43. })
  44. }
  45. export function GetCardNo(t) {
  46. JLSDK.getCardNum(e => {
  47. t.call(this, e)
  48. })
  49. }
  50. export function GetCardFile15(t) {
  51. JLSDK.getCardInfo(e => {
  52. t.call(this, e)
  53. })
  54. }
  55. export function GetCardFile16(t) {
  56. JLSDK.getCardholderInfo(e => {
  57. t.call(this, e)
  58. })
  59. }
  60. export function GetCardFileCustom(t, e, c) {
  61. JLSDK.readRetainFile(t, e, t => {
  62. c.call(this, t)
  63. })
  64. }
  65. export function SetCardFile0015(t, e) {
  66. JLSDK.getCardRandNum(0, c => {
  67. c.code == code.successCode() ? t.call(this, c.data, t => {
  68. 0 == t.code ? JLSDK.writeCardInfomation(1, t.data, t => {
  69. e.call(this, t)
  70. }) : e.call(this, t)
  71. }) : e.call(this, c)
  72. })
  73. }
  74. export function SetCardFile0016(t, e) {
  75. JLSDK.getCardRandNum(1, c => {
  76. c.code == code.successCode() ? t.call(this, c.data, t => {
  77. 0 == t.code ? JLSDK.writeCardInfomation(0, t.data, t => {
  78. e.call(this, t)
  79. }) : e.call(this, t)
  80. }) : e.call(this, c)
  81. })
  82. }
  83. export function SetCardFileCustomer(t, e) {
  84. JLSDK.getCardRandNum(0, c => {
  85. c.code == code.successCode() ? t.call(this, c.data, t => {
  86. 0 == t.code ? JLSDK.writeRetainFile(t.data, t => {
  87. e.call(this, t)
  88. }) : e.call(this, t)
  89. }) : e.call(this, c)
  90. })
  91. }
  92. export function InitLoad(t, e, c, a, o, i) {
  93. JLSDK.creditForLoad_Init(t, "01", a, e, t => {
  94. console.log(JSON.stringify(t)), t.code === code.successCode() ? o.call(this, t.data.rand, t.data.trade_no, t.data.mac1, t.data.balance, t => {
  95. 0 == t.code ? JLSDK.creditForLoad_Load(c, t.data, t => {
  96. i.call(this, t)
  97. }) : i.call(this, t)
  98. }) : i.call(this, t)
  99. })
  100. }
  101. export function GetSystemInfo(t) {
  102. JLSDK.getSystemInfo(e => {
  103. t.call(this, e)
  104. })
  105. }
  106. export function GetVehicleInfo(t, e) {
  107. JLSDK.getCarInfo(t, t => {
  108. e.call(this, t)
  109. })
  110. }
  111. export function SetSystemInfo(t, e) {
  112. JLSDK.getObuRadom(0, c => {
  113. c.code == code.successCode() ? t.call(this, c.data, t => {
  114. 0 == t.code ? JLSDK.writeObuIfo(1, t.data, t => {
  115. e.call(this, t)
  116. }) : e.call(this, t)
  117. }) : e.call(this, c)
  118. })
  119. }
  120. export function SetVehicleInfo(t, e) {
  121. JLSDK.getObuRadom(1, c => {
  122. c.code == code.successCode() ? t.call(this, c.data, t => {
  123. 0 == t.code ? JLSDK.writeObuIfo(1, t.data, t => {
  124. e.call(this, t)
  125. }) : e.call(this, t)
  126. }) : e.call(this, c)
  127. })
  128. }
  129. export function Activate(t, e) {
  130. JLSDK.getObuRadom(0, c => {
  131. c.code == code.successCode() ? t.call(this, c.data, t => {
  132. 0 == t.code ? JLSDK.writeSystemInfo(t.data, t => {
  133. e.call(this, t)
  134. }) : e.call(this, t)
  135. }) : e.call(this, c)
  136. })
  137. }
  138. export function CpuCommand(t, e) {
  139. JLSDK.ICCChannel(t, t => {
  140. e.call(this, t)
  141. })
  142. }
  143. export function ObuCommand(t, e) {
  144. JLSDK.ESAMChannel(t, t => {
  145. e.call(this, t)
  146. })
  147. }