Price Tags ============================================ Introduction ---------------------- Assume you have a small convenient store and going to put electronic price tags beside your products. You will refresh the contents of the price tags from time to time. Now you already have a 'Store Management System', which maintains all the product information including 'SKU', 'Title', 'Price', 'Manufacturer', 'Image', and more. This system also provides API so we can fetch the price data and send updates to the SyncSign. You also build a simple 'price server', to interface between the Store Management System, and the SyncSign Hub. You can create a Plug-in and run it on Hub. The setup workflow is as below: - Let all the display tags join the Hub using SyncSign's Admin Portal - The Hub uploads all associated Display node's ID on to the 'Price Server' - Use a bar-code scanner to bind each display tag's node ID with an SKU (Stock Keeping Unit) - The 'Price Server' remember the association of SKU - Tag - The Hub uses HTTPS request to fetch one or more SKUs detail information - The Hub parse the details and create a layout template then send to the tag screen Then, how to update the tag whenever an SKU's price changed? The Hub itself doesn't know the price has been changed, because it happens on 'Price Server'. A simple polling mechanism is as below: - The Hub queries the 'Price Server' every N minutes, and it's an HTTPS GET request - If there are prices changed, the 'Price Server' returns a Modified-List - Now the Hub knows what tags should be refreshed, then it requests the 'Price Server' for details and sends to the display tag one by one - Eventually, the Hub reports the update result to the 'Price Server', indicates whether any failure occurred. Some nodes may dead or off-line and need maintenance. Source Code and Setup ---------------------- TBD. Coming soon. .. 假设您有一家小商店,并打算为您的商品放置一个Price Tag。您需要经常更新它们的显示内容。此时,您需要创建一个Price Server,用来记录需要显示的信息;同时,您需要编写Hub上的EAPP,来获取Price Server上的数据并送到Display上显示。一个简单的流程如下: .. - 在Hub上,将每个Display的Id上传到您的Price Server; .. - 操作人员在Price Server的后台管理页面上为每一个Display Id绑定一个商品的SKU(每个SKU有相应的Title/Photo/Price/Manufacturer...); .. - Hub通过HTTP REQUEST,从Price Server上获取一个或多个商品的信息; .. - Hub分析收到的信息,创建需要显示的内容描述,发送给Display显示。 .. 那么,在日常使用时,如何实现价格等显示信息的更新呢?因为Hub并不自动地知道您在Price Server上修改了什么数据,因此,需要“通知”Hub,哪一个Display的数据发生了变化并需要刷新显示了。最简单地,这可以通过以下方法来实现: .. - Hub每隔N分钟,向Price Server发出一个Query (HTTP GET);假如有需要更新的displays,Price Server返回一个refresh list; .. - Hub知道了哪些display需要刷新,就一个个地向Price Server发出请求,获取每一个商品的信息,然后发送给display显示; .. - Hub通过一个HTTP POST,向Price Server汇报哪些display已经被成功刷新,哪些因为offline等原因未能成功。 .. 作为一个特殊情况,在最开始阶段每个Price Tag都是空白的。因此在这个初始阶段,Price Server会返回全部的display清单,然后Hub主动获取全部的商品信息,然后逐个发送给Display更新显示。 .. 其实Price Tag这个场景,比Weather Display 复杂的地方,一方面是存在多个displays需要管理,另一方面是需要访问您自己建立的Web Service,而不是公共的API。