Lock in $30 Savings on PRO—Offer Ends Soon! ⏳

Plugin-able POS Solutions by Javascript @HDM9 T...

Plugin-able POS Solutions by Javascript @HDM9 Taiwan

Introduction XULRunner
Javascript Full-Stack Framework
Plugin-able design

Rack Lin (阿土伯)

December 06, 2012
Tweet

More Decks by Rack Lin (阿土伯)

Other Decks in Programming

Transcript

  1. about:me •  ViViPOS  Co.,  Ltd    技術總監   –  利用

    javascript  寫 〞收銀機〞(傳統產業,全新感受)   •  CoCo  都可、50嵐、歇腳亭、Yamaha  、星聚點KTV……     •  PHP  /  Javascript  /  Java  Programmer  (目前移情於 Scala  )     •  [email protected]   •  hSps://twiSer.com/racklin   •  hSp://www.plurk.com/racklin   •  hSps://www.facebook.com/racklin1002   •  hSp://racklin.blogspot.tw/      (生小孩後就變癈墟)  
  2. POS  Development •  Delphi   – 曾經王者 ,目前依然是   •  Java

      –   非 Windows  Solu\ons  首選     •  VIVIPOS  SDK   – Javascript  /  html  /  xul        based  on  XULRunner  
  3. WHY  XULRunner •  Cross-­‐Pla_orm   •  Update  and  Packages  mechanism

     *   •  XPCOM  *   •  Networking  *   •  Storage  -­‐  SQLite  interface  *   •  Chrome  Registra\on  *   •  Gecko  rendering  engine  *   –  HTML5  /  CSS3   –  XBL  /  XUL  /  Javascript  1.8   –  XML  (XSLT,  XMLHSpRequest,  DOMParser,  etc.)   •  Coding  For  Fun  
  4. WHY  NOT  blablabla… •  Before  2010   – Why  not  Delphi

     /  VB  /  Java   •  A[er  2010   – Why  not  Nodejs   •  v0.1.102.zip  —  2010.07.25,  Version  0.1.102     – Why  not  Chrome   •  0.2.149    2008.09.08   •  VIVIPOS  Start  at  2008  
  5. About  VIVIPOS  (2008)   •  Hardware:  Via  Eden  1G  512MB

     Ram     •  OS:  Ubuntu  Linux  8.04   •  DB:  SQLite3  /  JSON   •  XULRunner  1.8.1   •  Languages:  C(vala)  /  Javascript    
  6. Project  or  Product •  經常 Branch  /  Code  Generator  

      •  流行名言:你以為在創新、其實是在代工 Customer  A Customer  B Customer  C
  7. Components  Based •  Upstream  Core  Components     •  Customiza\on

      – Customer  A  (  SDK  +  POS  +  A1  +  B1  +  C1  ….)   – Customer  B  (  SDK    +  POS  +  A1  +  C1  +  D1  …)   – Customer  C  (  SDK  +  POS  +  A1  +  E1  +  F1  …)   VIVIPOS  SDK VIVIECR  (POS  Main  UI)
  8. 自給自足,豐衣足食 •  當 POS  主流開發是 WinForm  /  JFrame  /  

    TForm  時,我在 VIM.   •  #1:GREU\ls  and  XPCOM     •  #2:GeckoJS   •  #3:SDK  and  XBLs  
  9. GREU\ls •  2007.09  Released  and  open  source   •  Object

     Namespace   •  Charset  Conversion   •  Crypto  Hash  U\li\es  –  md5  /  sha1  /sha256   •  File  And  Directory  IO     •  JSON  encode  /  decode  use  na\ve  C++   implemented.   •  Threading  –  Na\ve  Mul\-­‐Threading  support   •  XPCOM  Helper
  10. GeckoJS •  MVC  Architecture   –  Dispatcher  /  Controller  

    –  Model  –  Ac\veRecord  Like  and  Associa.ons  Support   –  VIVIPOS  Query  Language  (VQL)     •  Database  Adapter   –  SQLite  and  JSON   •  Configure  /  Registry  System   –  Preference  System   •  Applica\on  Scope  Session   •  Logging  –  Log4js  !?   •  i18n  /  l10n   •  Event  System  –  NOT  DOM  Event
  11. C++  XPCOM •  On-­‐Screen-­‐Display  (OSD)   •  DBUS  No\fica\on  

    •  Matchbox  Virtual  Keyboard   •  IO  Control   –  Serial  Port  /  USB     –  Parallel  Port   –  DIO   –  GPIO     •  JSLoader    
  12. XBL  Components •  ACL  /  Config  /  Session  aware  containers

      •  Data  aware  UI  components   – Label     – BuSon     – BuSons  Group  
  13. Debug  Tools •  JS  Console   •  JS  Debuger  

    •  DOM  Inspector   •  SQLite  Manager   •  SDK  Console  #
  14. Core  Values •  Pla_orm  For  3rd  Party  Developers   • 

    Plugins  Anywhere   – User  Interface  /  Layouts  /  Skins   – I18n/l10n   – Devices   – Reports   – Promo\ons  Modules   – Second  Display  Modules   – Inventory  System  
  15. Core  Values •  Services  Registry   – Binding  To  UI  

    – Binding  To  Hotkey   – Remove  Invoke  (  IPC  /  Protocol)   •  NO  Linux  Na\ve  UI   •  Open  Source  Addons  
  16. Reports •  Reports   – CSV  –  Template  Engine   – HTML

     –  Template  Engine   – PDF   •  Print  To  PDF  By  Gecko   – Export  about  100  pages  PDF  more  than  30mins   •  Print  To  PDF  By  WebKit  (libwkhtmltox)   – Export  about  100  pages  PDF  less  than  3mins   – But  Buggy  –  NOT  Support  thead/tbody/_oot.  
  17. Promo\on  framework •  Cart  is  Simple  !?   好的 PM

     勝過好的 Programmers   – 二件九折 -­‐>  第二件八折  -­‐>  第三件七折 …..   (呀不就是全部打九折)   •  Promo\on  Modules  *   – Base  Condi\ons   – Product  Trigger  –  Plugin-­‐able   – Discount  Type  –  Plugin-­‐able    
  18. VIVIPOS  Architecture VIVIPOS  APP   ECR-­‐like  User  Interface  /  Func;ons

      LINUX  BASE   Display   Driver   USB   Driver   Keypad   Driver   Touch   Driver   Audio   Driver   LAN   Driver   Power   Management   Others   LIBRARIES                                                         XPCOM   GPIO   Database   Serial  IO   Parallel  IO   Network   Others   VIVIPOS  SDK   Core  Libraries   Signature  Func.on   FRAMEWORK   Plug-­‐in  /  Add-­‐on  Manager   Network   Manager   Backup   Manager   Restore   Manager   Others   Peripheral   Manager   UI   Manager   Func.on   Manager   Language   Manager   Update   Manager   Window   Manager   Content   Manager   View   System   Message   Dispatch   Database   Interface   Report   Module   Cart   Module   APPLICATIONS   Clerk   Opera.ons   Stock   Control   Repor.ng   System   Func.on   Others   Add-­‐on     -­‐  Member  Management   -­‐  SMS  Promo.on   -­‐  Special  Discount   -­‐  …  etc.                  Add-­‐on                    -­‐  Cash  Flow  Report                  -­‐  Gi]  Card  Payment                  -­‐  …  etc.  
  19. VIVIPOS  Add-­‐ons  For  Produc\on •  Main  POS  Add-­‐on    -­‐

     VIVIECR   – 690  pages  PDF  Manual     – En  /  zhTW  /  zhCN  /  Jp  /  Thai  /  Fr     •  Taiwan  Invoice  Add-­‐on   •  Customer  Management  Add-­‐on   •  Taiwan  Receipts  Format  Add-­‐on   •  Simple  Browser   •  Second  Display  Add-­‐on      Open  Source
  20. Simple  Web  Browser  Add-­‐on •  Embedded  Firefox  browser   • 

    Gecko  1.9.2  Engine   – HTML5  Support   – CSS3  Support   •  Binding  To  BuSon   •  Binding  To  Hotkey   •  Disable  Popup  Window
  21. DEMO  Descrip\on •  A  Produc\on  POS  Solu\on  is  combina\on  of

      many  add-­‐ons  not  ONE  App.   •  Every  individual  Add-­‐ons  CAN  online  update.   •  Add-­‐on  can  hook  the  event  and  change  the   shopping  flow.   •  EX.  ONLY  ONE  Customer  Need  BEEP  when   product  not  found  !?   Add  a  add-­‐on  for  him,  Not  add  BEEP  feature  in   upstream  version.
  22. IPC •  DBUS     •  Javascript  implemented  HSp  server

      – Binding  on  localhost:8888   •  Dispatch  Command     •  No\fy  Observer   •  Session  Opera\on   •  ...    
  23. IPC  Samples •  AddItem  To  Cart   –  curl  hSp://localhost:8888/dispatch?

    controller=Cart&command=addItemByBarcode&data=123456789   •  Get  Current  Login  Clerk   –   curl  hSp://localhost:8888/session?ac\on=get&key=user.username   •  Shutdown  –  Trigger  Event/Observe   –   curl  hSp://localhost:8888/observer?topic=shutdown   •  Ex.  Installed  HelloWorld.xpi   –   curl  hSp://localhost:8888/dispatch? controller=Helloworld&command=sayHello&data=Rack  
  24. Last  Mile  of  the  O2O •  Add  a  Protocol  Handler,

     ‘vivipos’  scheme.   – Proxy  to  exists  JS  HSpd  Services.   •  Remote/Local  Website  CAN   – Callback  VIVIPOS  Func\ons   – Use  VIVIPOS  Hardwares  (  Printer  /  Cash  Drawer)   – Use  VIVIPOS  Cart  and  Promo\ons   – Use  VIVIPOS  Reports    
  25. VIVIPOS  Scheme  Samples •  Remote  website  HTML   – AddItem  To

     Cart   <a  href=“vivipos:dispatch?   controller=Cart&command=addItemByBarcode&data=123456789”>A ddItem</a>   – Shutdown  –  Trigger  Event/Observe   <a  href=“vivipos:observer?topic=shutdown”>Shutdown</a>   –   Ex.  Installed  HelloWorld.xpi    <a  href="vivipos:dispatch? controller=Helloworld&command=sayHello&data=Rack">Hello</a>  
  26. What  is  Online2OffLine •  線上訂位  /  線上團購 <>實體消費   • 

    會員積點 /  折扣   •  線上促銷<>實體促銷   •  線上銷售<>實體銷售   •  消費分析  
  27. SDK  -­‐  Last  Mile  of  O2O •  Online  Services  開發者不用重覆造輪子,為

    了整合服務而開發陽春 POS 系統.   VIVIPOS 是完整的收銀系統且 Open  Source   •  除了整合服務,更可開發自己的 POS  系統   •  使用您熟悉的平台語言開發 POS     JAVA  /  PHP  /  RAILS  /  NODEJS  ……..     •  可以不需要學習 VIVIPOS  SDK.  (盡量啦)
  28. 3rd  Party  interes.ng  Addons •  Singapore  Bugis  Street   – NetPayment

     /  EZLinks   •  Microprogram 悠遊卡 and  Life+   •  OpenLife   •  24卷 (大陸團購-好像掛了 orz  )   •  USA  -­‐  KIOSK   •  Media  Player  
  29. About  Cloud? •  Running  Web  Based  Applica\on  in  Cloud  

    –  Yes  ,  Simple  Web  Browser  with     HTML5  /  CSS3  Supported   •  Sending  Data  to  Cloud  real\me   –  Yes,  Using  AJAX   •  Packing  Data  to  Cloud  when  Day-­‐End   –  YES  ,  VIVIConnect  Add-­‐on  support  Client-­‐Side  ETL  to  packing   Databases  to  your  own  Back-­‐End  Server.   –  HTTP/HTTPs   –  FTP   –  S3   •  Running  your  own  scripts   –  PHP  /  Python    installed  on  every  VIVIPOS  Terminal.  
  30. JS  Loader •  Javascript  Encoder  For  3rd  party  Developer  

    – NOT  obfuscator   •  Add  Trial  Version  to  your  Add-­‐on   •  Add  Expire  Date  to  your  Add-­‐on   •  Lock  your  Add-­‐on  on  a  special  Terminal  
  31. Resources •  Slide:     hSp://goo.gl/TlHKf     •  GREU\ls:

      hSps://github.com/racklin/greu\ls   •  XULRunner  –  MDN   hSps://developer.mozilla.org/en-­‐US/docs/ XULRunner