HiveMind
BittyBuzzSystem.h
Go to the documentation of this file.
1 #ifndef __BITTYBUZZSYSTEM_H_
2 #define __BITTYBUZZSYSTEM_H_
3 
8 #include <bbzvm.h>
9 #include <bsp/IBSP.h>
10 #include <bsp/IUserInterface.h>
11 #include <logger/ILogger.h>
12 
13 // TODO: Change to a class once bittybuzz support passing context to function and make it a
14 // dependency for the BBVM
15 
19 namespace BittyBuzzSystem {
20 
24  extern IUserInterface* g_ui;
25 
29  extern ILogger* g_logger;
30 
35 
40 
45 
49  extern IBSP* g_bsp;
50 
54  extern IUserUI* g_userUI;
55 
61  void functionCall(uint16_t stringId);
62 
67  void errorReceiver(bbzvm_error errcode);
68 
73  void logVmDump(LogLevel logLevel);
74 
75  const char* getStateString(bbzvm_state state);
76 
77  const char* getErrorString(bbzvm_error error);
78 
79  const char* getInstructionString(bbzvm_instr instruction);
80 
81 } // namespace BittyBuzzSystem
82 
83 #endif // __BITTYBUZZSYSTEM_H_
BittyBuzzSystem::g_closureRegister
IBittyBuzzClosureRegister * g_closureRegister
Function register used by the BBVM to register new functions.
Definition: BittyBuzzSystem.cpp:9
BittyBuzzSystem::logVmDump
void logVmDump(LogLevel logLevel)
Logs the vm dump which contains information about the vm state, heap, stack, etc.
Definition: BittyBuzzSystem.cpp:65
IBittyBuzzClosureRegister
A class to register buzz function/closures id and associate them with a string.
Definition: IBittyBuzzClosureRegister.h:24
BittyBuzzSystem::getStateString
const char * getStateString(bbzvm_state state)
Definition: BittyBuzzSystem.cpp:143
IBittyBuzzMessageService.h
IBSP.h
IUserUI.h
BittyBuzzSystem::errorReceiver
void errorReceiver(bbzvm_error errcode)
Callback to handle errors on bittybuzz vm.
Definition: BittyBuzzSystem.cpp:29
BittyBuzzSystem::getErrorString
const char * getErrorString(bbzvm_error error)
Definition: BittyBuzzSystem.cpp:160
BittyBuzzSystem::g_messageService
IBittyBuzzMessageService * g_messageService
Message service used by the BBVM to send requests to host and remote.
Definition: BittyBuzzSystem.cpp:10
LogLevel
LogLevel
The log level used for the logger.
Definition: ILogger.h:9
IUserUI
Manages the UI available to the user.
Definition: IUserUI.h:7
IBittyBuzzClosureRegister.h
IBSP
Definition: IBSP.h:6
BittyBuzzSystem::g_logger
ILogger * g_logger
Logger used for error reception or user functions.
Definition: BittyBuzzSystem.cpp:6
IBittyBuzzStringResolver
Class that resolves a string from the bittybuzz virtual machine.
Definition: IBittyBuzzStringResolver.h:10
IUserInterface.h
BittyBuzzSystem
Namespace to help manage the bittybuzz system.
Definition: BittyBuzzSystem.h:19
ILogger
A logger class with basic logging capabilities.
Definition: ILogger.h:35
BittyBuzzSystem::g_stringResolver
const IBittyBuzzStringResolver * g_stringResolver
String resolver used for user functions.
Definition: BittyBuzzSystem.cpp:8
IBittyBuzzStringResolver.h
BittyBuzzSystem::functionCall
void functionCall(uint16_t stringId)
Call a bittybuzz function that takes not arguments (init, step, etc),.
Definition: BittyBuzzSystem.cpp:17
BittyBuzzSystem::g_userUI
IUserUI * g_userUI
User interface (LED, Hex display, etc) available to the user via buzz.
Definition: BittyBuzzSystem.cpp:12
IBittyBuzzMessageService
message service use by the BBVM. Constructs the messages and dispatches it at the appropriate place (...
Definition: IBittyBuzzMessageService.h:9
BittyBuzzSystem::g_bsp
IBSP * g_bsp
BSP used by the bbvm for random numbers.
Definition: BittyBuzzSystem.cpp:11
BittyBuzzSystem::getInstructionString
const char * getInstructionString(bbzvm_instr instruction)
Definition: BittyBuzzSystem.cpp:197
IUserInterface
Manages the user interface The user interface can consist of buttons, LED, serial print ports,...
Definition: IUserInterface.h:36
BittyBuzzSystem::g_ui
IUserInterface * g_ui
UserInterface used by the bbvm for printing user logs.
Definition: BittyBuzzSystem.cpp:7
ILogger.h