The field version of the solarnano grid on the ionQubes
Fork of SolarNanoGridv3 by
Hmi/HubLogging.h@11:87ab310924f0, 2016-06-08 (annotated)
- Committer:
- epgmdm
- Date:
- Wed Jun 08 22:12:52 2016 +0000
- Revision:
- 11:87ab310924f0
Utility up
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
epgmdm | 11:87ab310924f0 | 1 | /** |
epgmdm | 11:87ab310924f0 | 2 | * HubLogging.h |
epgmdm | 11:87ab310924f0 | 3 | * |
epgmdm | 11:87ab310924f0 | 4 | * Logging utility functions for the main control hub mbed. |
epgmdm | 11:87ab310924f0 | 5 | * |
epgmdm | 11:87ab310924f0 | 6 | * Author: Daniel Yang |
epgmdm | 11:87ab310924f0 | 7 | */ |
epgmdm | 11:87ab310924f0 | 8 | |
epgmdm | 11:87ab310924f0 | 9 | #ifndef HUBLOGGING_H |
epgmdm | 11:87ab310924f0 | 10 | #define HUBLOGGING_H |
epgmdm | 11:87ab310924f0 | 11 | |
epgmdm | 11:87ab310924f0 | 12 | #include "mbed.h" |
epgmdm | 11:87ab310924f0 | 13 | #include "HubUser.h" |
epgmdm | 11:87ab310924f0 | 14 | |
epgmdm | 11:87ab310924f0 | 15 | /* |
epgmdm | 11:87ab310924f0 | 16 | * these actions depend on a known user using the system |
epgmdm | 11:87ab310924f0 | 17 | */ |
epgmdm | 11:87ab310924f0 | 18 | enum HubActionForLogging { |
epgmdm | 11:87ab310924f0 | 19 | hubAction_BatteryRfidScanned, /**< Battery Rfid was scanned */ |
epgmdm | 11:87ab310924f0 | 20 | hubAction_PoshoRfidScanned, /**< Posho Rfid was scanned */ |
epgmdm | 11:87ab310924f0 | 21 | hubAction_IncubatorRfidScanned, /**< Incubator Rfid was scanned */ |
epgmdm | 11:87ab310924f0 | 22 | hubAction_Exit, /**< User hits exit */ |
epgmdm | 11:87ab310924f0 | 23 | hubAction_OneBatteryDropped, /**< One battery dropped off */ |
epgmdm | 11:87ab310924f0 | 24 | hubAction_TwoBatteryDropped, /**< Two batteries dropped off */ |
epgmdm | 11:87ab310924f0 | 25 | hubAction_ThreeBatteryDropped, /**< Three batteries dropped off */ |
epgmdm | 11:87ab310924f0 | 26 | hubAction_OneBatteryPicked, /**< One battery picked off */ |
epgmdm | 11:87ab310924f0 | 27 | hubAction_TwoBatteryPicked, /**< Two batteries picked off */ |
epgmdm | 11:87ab310924f0 | 28 | hubAction_ThreeBatteryPicked, /**< Three batteries picked off */ |
epgmdm | 11:87ab310924f0 | 29 | hubAction_OneKiloPosho, /**< One kilo of posho usage */ |
epgmdm | 11:87ab310924f0 | 30 | hubAction_TwoKiloPosho, /**< Two kilos of posho usage */ |
epgmdm | 11:87ab310924f0 | 31 | hubAction_ThreeKiloPosho /**< Three kilos of posho usage */ |
epgmdm | 11:87ab310924f0 | 32 | }; |
epgmdm | 11:87ab310924f0 | 33 | |
epgmdm | 11:87ab310924f0 | 34 | /* |
epgmdm | 11:87ab310924f0 | 35 | * any rfid can log errors regarding an unknown tag being read |
epgmdm | 11:87ab310924f0 | 36 | */ |
epgmdm | 11:87ab310924f0 | 37 | enum HubLoggingRfidSource { |
epgmdm | 11:87ab310924f0 | 38 | source_battery, /**< From battery rfid */ |
epgmdm | 11:87ab310924f0 | 39 | source_posho, /**< From posho rfid */ |
epgmdm | 11:87ab310924f0 | 40 | source_incubator /**< From incubator rfid */ |
epgmdm | 11:87ab310924f0 | 41 | }; |
epgmdm | 11:87ab310924f0 | 42 | |
epgmdm | 11:87ab310924f0 | 43 | /** |
epgmdm | 11:87ab310924f0 | 44 | * Log an action from a selection of predefined actions done by the current user |
epgmdm | 11:87ab310924f0 | 45 | * Actions used with this method should require a known user to be using system |
epgmdm | 11:87ab310924f0 | 46 | * @param action - enumerated HubActionForLogging that selects from predefined actions |
epgmdm | 11:87ab310924f0 | 47 | * @param userIndex - int corresponding to the index of the user in the user table |
epgmdm | 11:87ab310924f0 | 48 | */ |
epgmdm | 11:87ab310924f0 | 49 | void logActionWithUserInfo(enum HubActionForLogging action, HubUser *user); |
epgmdm | 11:87ab310924f0 | 50 | |
epgmdm | 11:87ab310924f0 | 51 | /** |
epgmdm | 11:87ab310924f0 | 52 | * Log an error - RFID not associated with a known user is scanned |
epgmdm | 11:87ab310924f0 | 53 | * @param unknownRfid - uint32 for the unique ID of the unknown rfid tag |
epgmdm | 11:87ab310924f0 | 54 | */ |
epgmdm | 11:87ab310924f0 | 55 | void logErrorUnknownRfidScanned(uint32_t unknownRfid, enum HubLoggingRfidSource source); |
epgmdm | 11:87ab310924f0 | 56 | |
epgmdm | 11:87ab310924f0 | 57 | #endif |