1 #ifndef NUGGET_TOOLS_H
2 #define NUGGET_TOOLS_H
3 
4 #include <app_nugget.h>
5 #include <application.h>
6 #include <nos/debug.h>
7 #include <nos/NuggetClientInterface.h>
8 
9 #include <memory>
10 #include <string>
11 
12 #define ASSERT_NO_ERROR(code, msg) \
13   do { \
14     int value = code; \
15     ASSERT_EQ(value, app_status::APP_SUCCESS) \
16         << value << " is " << nos::StatusCodeString(value) << msg; \
17   } while(0)
18 
19 namespace nugget_tools {
20 
21 std::string GetCitadelUSBSerialNo();
22 
23 std::unique_ptr<nos::NuggetClientInterface> MakeNuggetClient();
24 
25 // Always does a hard reboot. Use WaitForSleep() if you just want deep sleep.
26 bool RebootNugget(nos::NuggetClientInterface *client);
27 
28 // Returns true if Citadel entered deep sleep
29 // Passes back an underestimate of the number of seconds waited if so.
30 bool WaitForSleep(nos::NuggetClientInterface *client, uint32_t *seconds_waited);
31 
32 bool WipeUserData(nos::NuggetClientInterface *client);
33 
34 }  // namespace nugget_tools
35 
36 #endif  // NUGGET_TOOLS_H
37