Difference between revisions of "Project:Tool Access Control/Solexious Proposal"

From London Hackspace Wiki
Jump to navigation Jump to search
 
(25 intermediate revisions by 4 users not shown)
Line 21: Line 21:
 
I have made a prototype shield for testing code while the full design remains to be tested and produced. http://www.flickr.com/photos/solexious/6865500239/
 
I have made a prototype shield for testing code while the full design remains to be tested and produced. http://www.flickr.com/photos/solexious/6865500239/
  
Design for the full ACNode at: https://github.com/solexious/ACNode
+
Design for the full ACNode at: https://github.com/solexious/ACNode Embedded code at: https://github.com/solexious/ACNodeEmbedCode
 +
 
 +
The server side component is now complete - it's available at https://github.com/mentarus/acserver and a test version of the code is running on babbage on port 1234. See https://github.com/mentarus/acserver/blob/master/application/controllers/api.php for usage examples.
  
 
==Network protocol==
 
==Network protocol==
 +
This is mostly RESTful, but not entirely because we're using text/plain (for the small atmega).  In particular, the /sync request could actually use /card with weird Range headers, but that's pretty awkward.  It should be easy to upgrade to a full JSON or hypertext system.
 +
 
===Get card permissions===
 
===Get card permissions===
'''GET /[nodeID]/card/'''
+
'''GET /[nodeID]/card/[cardID]'''
  
 
i.e.
 
i.e.
Line 34: Line 38:
 
* 1 - user
 
* 1 - user
 
* 2 - maintainer
 
* 2 - maintainer
 +
 +
''STATUS: Done''
  
 
===Add card===
 
===Add card===
'''POST /[nodeID]/card/'''
+
'''POST /[nodeID]/grant-to-card/[card_being_granted_to]/by-card/[card_with_admin_permissions]'''
  
 
i.e.
 
i.e.
* POST /1/card/
+
* POST /1/grant-to-card/04FF7922E40080/by-card/04FF792AAAAAA
04FF7922E40080,04FF1234540080
 
  
 
returns
 
returns
 
* 0 - card not added
 
* 0 - card not added
 
* 1 - card added
 
* 1 - card added
 +
 +
''STATUS: Done''
  
 
===Check DB sync===
 
===Check DB sync===
Line 66: Line 73:
 
or when out of cards returns
 
or when out of cards returns
 
* END
 
* END
 +
 +
 +
''STATUS: Done - tested on UI, but not with ACNode''
 +
''NOTE: Due to CodeIgniter REST limitations, the ACNode code will have to strip any leading and trailing quote characters from the card.'' 04FF7922E40080 is incorrectly returned as '04FF7922E40080', and the quotes must be stripped off if supplied
  
 
===Report tool status===
 
===Report tool status===
'''PUT /[nodeID]/status/'''
+
'''POST /[nodeID]/status/[new_status]/by/[cardWithAdminPermissions]'''
  
 
i.e.
 
i.e.
* PUT /1/status/
+
* POST /1/status/0/by/04FF7922E40080
1
 
  
 
* 0 - out of service
 
* 0 - out of service
Line 80: Line 90:
 
* 0 - not saved
 
* 0 - not saved
 
* 1 - saved
 
* 1 - saved
 +
 +
''STATUS: Done - tested on UI, but not with ACNode''
 +
 +
''QUESTION: should any user be able to take a tool out of service? Should it even require a card ID?''
  
 
===Check tool status===
 
===Check tool status===
''' GET /[nodeID]/status/'''
+
'''GET /[nodeID]/status/'''
  
 
Check if the ACNode has been remotely taken out of service, or put back in service
 
Check if the ACNode has been remotely taken out of service, or put back in service
Line 89: Line 103:
 
* 0 - out of service
 
* 0 - out of service
 
* 1 - in service
 
* 1 - in service
 +
 +
''STATUS: Done''
  
 
===Tool usage (live)===
 
===Tool usage (live)===
'''PUT /[nodeID]/tooluse/'''
+
'''POST /[nodeID]/tooluse/[status]/[cardID]'''
  
 
i.e.
 
i.e.
* PUT /1/tooluse/report
+
* POST /1/tooluse/0/04FF7922E40080
1,04FF7922E40080
 
  
 +
Status is one of:
 
* 0 - tool use stopped
 
* 0 - tool use stopped
 
* 1 - tool in use
 
* 1 - tool in use
Line 103: Line 119:
 
* 0 - not saved
 
* 0 - not saved
 
* 1 - saved
 
* 1 - saved
 +
 +
''STATUS: Done''
  
 
===Tool usage (usage time)===
 
===Tool usage (usage time)===
'''POST /[nodeID]/tooluse/time/'''
+
'''POST /[nodeID]/tooluse/time/for/[cardID]/[timeUsed]'''
  
 
i.e.
 
i.e.
* POST /1/tooluse/time/
+
* POST /1/tooluse/time/for/04FF7922E40080/34000
34000,04FF7922E40080
 
  
 
returns
 
returns
 
* 0 - not saved
 
* 0 - not saved
 
* 1 - saved
 
* 1 - saved
 +
 +
''STATUS: Done - tested on UI, but not with ACNode''
  
 
===Case alert===
 
===Case alert===
'''PUT /[nodeID]/case/'''
+
'''POST /[nodeID]/case/change/[new_status]'''
  
 
i.e.
 
i.e.
* PUT /1/case/
+
* POST /1/case/1
1
 
  
 
Alert if the ACNode case is opened
 
Alert if the ACNode case is opened
Line 129: Line 147:
 
* 0 - not saved
 
* 0 - not saved
 
* 1 - saved
 
* 1 - saved
 +
 +
 +
 +
''STATUS: Done - tested on UI, but not with ACNode''

Latest revision as of 04:45, 18 July 2014

(ACN refers to Access Control Node, a physical node attached to a tool)

I plan to

  • Base the device on the Duemilanove arduino as it fits our needs and has a wide base of users.
  • Use the wiznet chip for ethernet support
  • Use i2c sm030 rfid readers
  • allow different control outputs (relay, Darlington, servo control etc)
  • use eeprom memory for internal storage

Services

Mission critical

These must function without networking or main server available:

  • Check if card in ACN local db and allow use if is
  • Set tool into "out of order" mode

Non critical

  • Add cards
  • Report back to central server (usage etc)

Progress

I have made a prototype shield for testing code while the full design remains to be tested and produced. http://www.flickr.com/photos/solexious/6865500239/

Design for the full ACNode at: https://github.com/solexious/ACNode Embedded code at: https://github.com/solexious/ACNodeEmbedCode

The server side component is now complete - it's available at https://github.com/mentarus/acserver and a test version of the code is running on babbage on port 1234. See https://github.com/mentarus/acserver/blob/master/application/controllers/api.php for usage examples.

Network protocol

This is mostly RESTful, but not entirely because we're using text/plain (for the small atmega). In particular, the /sync request could actually use /card with weird Range headers, but that's pretty awkward. It should be easy to upgrade to a full JSON or hypertext system.

Get card permissions

GET /[nodeID]/card/[cardID]

i.e.

  • GET /1/card/04FF7922E40080

returns

  • 0 - no permissions
  • 1 - user
  • 2 - maintainer

STATUS: Done

Add card

POST /[nodeID]/grant-to-card/[card_being_granted_to]/by-card/[card_with_admin_permissions]

i.e.

  • POST /1/grant-to-card/04FF7922E40080/by-card/04FF792AAAAAA

returns

  • 0 - card not added
  • 1 - card added

STATUS: Done

Check DB sync

GET /[nodeID]/sync/

Returns first card in db

i.e.

  • GET /1/sync/

returns the first card in the DB i.e.

  • 04FF7922E40080

GET /[nodeID/sync/[last received card]/

i.e.

  • GET /1/sync/04FF7922E40080/

returns either the next card in DB i.e.

  • 03FF7922FF008F

or when out of cards returns

  • END


STATUS: Done - tested on UI, but not with ACNode NOTE: Due to CodeIgniter REST limitations, the ACNode code will have to strip any leading and trailing quote characters from the card. 04FF7922E40080 is incorrectly returned as '04FF7922E40080', and the quotes must be stripped off if supplied

Report tool status

POST /[nodeID]/status/[new_status]/by/[cardWithAdminPermissions]

i.e.

  • POST /1/status/0/by/04FF7922E40080
  • 0 - out of service
  • 1 - in service

returns

  • 0 - not saved
  • 1 - saved

STATUS: Done - tested on UI, but not with ACNode

QUESTION: should any user be able to take a tool out of service? Should it even require a card ID?

Check tool status

GET /[nodeID]/status/

Check if the ACNode has been remotely taken out of service, or put back in service

returns

  • 0 - out of service
  • 1 - in service

STATUS: Done

Tool usage (live)

POST /[nodeID]/tooluse/[status]/[cardID]

i.e.

  • POST /1/tooluse/0/04FF7922E40080

Status is one of:

  • 0 - tool use stopped
  • 1 - tool in use

returns

  • 0 - not saved
  • 1 - saved

STATUS: Done

Tool usage (usage time)

POST /[nodeID]/tooluse/time/for/[cardID]/[timeUsed]

i.e.

  • POST /1/tooluse/time/for/04FF7922E40080/34000

returns

  • 0 - not saved
  • 1 - saved

STATUS: Done - tested on UI, but not with ACNode

Case alert

POST /[nodeID]/case/change/[new_status]

i.e.

  • POST /1/case/1

Alert if the ACNode case is opened

  • 0 - case closed
  • 1 - case opened

returns

  • 0 - not saved
  • 1 - saved


STATUS: Done - tested on UI, but not with ACNode