Home | History | Annotate | Download | only in tools
      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/NuggetClient.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 bool IsDirectDeviceClient();
     22 
     23 std::string GetCitadelUSBSerialNo();
     24 
     25 std::unique_ptr<nos::NuggetClientInterface> MakeNuggetClient();
     26 
     27 std::unique_ptr<nos::NuggetClient> MakeDirectNuggetClient();
     28 
     29 // Always does a hard reboot. Use WaitForSleep() if you just want deep sleep.
     30 bool RebootNuggetUnchecked(nos::NuggetClientInterface *client);
     31 // Does a hard reboot and checks the stats to make sure it happened.
     32 bool RebootNugget(nos::NuggetClientInterface *client);
     33 
     34 // Returns true if Citadel entered deep sleep
     35 // Passes back an underestimate of the number of seconds waited if so.
     36 bool WaitForSleep(nos::NuggetClientInterface *client, uint32_t *seconds_waited);
     37 
     38 bool WipeUserData(nos::NuggetClientInterface *client);
     39 
     40 }  // namespace nugget_tools
     41 
     42 #endif  // NUGGET_TOOLS_H
     43