From ad4f3dcedab29a690c5eedbb08ba1b393917db0b Mon Sep 17 00:00:00 2001
From: lichao <lichao@aiotlink.com>
Date: 星期三, 21 四月 2021 17:39:34 +0800
Subject: [PATCH] update go api.

---
 src/defs.cpp |   35 +++++++++++++++++++++++++++++++++--
 1 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/src/defs.cpp b/src/defs.cpp
index cab4fc7..0ff671b 100644
--- a/src/defs.cpp
+++ b/src/defs.cpp
@@ -16,15 +16,46 @@
  * =====================================================================================
  */
 #include "defs.h"
+#include "shm.h"
+
 namespace
 {
 
 const MQId kBHTopicBus = boost::uuids::string_generator()("01234567-89ab-cdef-8349-1234567890ff");
-const MQId kBHTopicReqRepCenter = boost::uuids::string_generator()("12345670-89ab-cdef-8349-1234567890ff");
+const MQId kBHTopicCenter = boost::uuids::string_generator()("12345670-89ab-cdef-8349-1234567890ff");
 const MQId kBHUniCenter = boost::uuids::string_generator()("87654321-89ab-cdef-8349-1234567890ff");
+
+struct LastError {
+	int ec_ = 0;
+	std::string msg_;
+};
+
+LastError &LastErrorStore()
+{
+	thread_local LastError le;
+	return le;
+}
 
 } // namespace
 
 const MQId &BHTopicBusAddress() { return kBHTopicBus; }
-const MQId &BHTopicCenterAddress() { return kBHTopicReqRepCenter; }
+const MQId &BHTopicCenterAddress() { return kBHTopicCenter; }
 const MQId &BHUniCenterAddress() { return kBHUniCenter; }
+
+bhome_shm::SharedMemory &BHomeShm()
+{
+	static bhome_shm::SharedMemory shm("bhome_default_shm_v0", 1024 * 1024 * 512);
+	return shm;
+}
+
+void SetLastError(const int ec, const std::string &msg)
+{
+	LastErrorStore().ec_ = ec;
+	LastErrorStore().msg_ = msg;
+}
+
+void GetLastError(int &ec, std::string &msg)
+{
+	ec = LastErrorStore().ec_;
+	msg = LastErrorStore().msg_;
+}
\ No newline at end of file

--
Gitblit v1.8.0