Skip to content

Commit

Permalink
Fix namespace errors of missing string, list, ... in OZW::std
Browse files Browse the repository at this point in the history
Also fix some tab vs spaces issues while there.
  • Loading branch information
sjorge committed Mar 1, 2019
1 parent d7e38e5 commit ffe5e45
Show file tree
Hide file tree
Showing 11 changed files with 151 additions and 151 deletions.
10 changes: 5 additions & 5 deletions src/callbacks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ Nan::AsyncResource *resource;

// Message passing queue between OpenZWave callback and v8 async handler.
mutex zqueue_mutex;
std::queue<NotifInfo *> zqueue;
::std::queue<NotifInfo *> zqueue;

// Node state.
mutex znodes_mutex;
std::map<uint8_t, NodeInfo *> znodes;
::std::map<uint8_t, NodeInfo *> znodes;

mutex zscenes_mutex;
std::list<SceneInfo *> zscenes;
::std::list<SceneInfo *> zscenes;
/*
* OpenZWave callback, registered in Driver::AddWatcher.
* Just push onto queue and trigger the handler in v8 land.
Expand Down Expand Up @@ -115,7 +115,7 @@ void ozw_ctrlcmd_callback(Driver::ControllerState _state,
notif->event = _err;
notif->notification = _state;
notif->homeid = 0; // use as guard value for legacy mode
notif->help = std::string("Controller State: ")
notif->help = ::std::string("Controller State: ")
.append(getControllerStateAsStr(_state))
.append(", Error: ")
.append(getControllerErrorAsStr(_err));
Expand Down Expand Up @@ -179,7 +179,7 @@ void handleNotification(NotifInfo *notif)
case OpenZWave::Notification::Type_ValueRemoved: {
// ##################
OpenZWave::ValueID value = notif->values.front();
std::list<OpenZWave::ValueID>::iterator vit;
::std::list<OpenZWave::ValueID>::iterator vit;
if ((node = get_node_info(notif->nodeid))) {
for (vit = node->values.begin(); vit != node->values.end(); ++vit) {
if ((*vit) == notif->values.front()) {
Expand Down
16 changes: 8 additions & 8 deletions src/callbacks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@ namespace OZW {
uint8 buttonid;
uint8 sceneid;
uint8 notification;
std::list<OpenZWave::ValueID> values;
std::string help;
::std::list<OpenZWave::ValueID> values;
::std::string help;
} NotifInfo;

typedef struct {
uint32 homeid;
uint8 nodeid;
bool polled;
std::list<OpenZWave::ValueID> values;
::std::list<OpenZWave::ValueID> values;
} NodeInfo;

typedef struct {
uint32 sceneid;
std::string label;
std::list<OpenZWave::ValueID> values;
::std::string label;
::std::list<OpenZWave::ValueID> values;
} SceneInfo;

// OpenZWave callbacks
Expand Down Expand Up @@ -72,16 +72,16 @@ namespace OZW {
* Message passing queue between OpenZWave callback and v8 async handler.
*/
extern mutex zqueue_mutex;
extern std::queue<NotifInfo *> zqueue;
extern ::std::queue<NotifInfo *> zqueue;

/*
* Node state.
*/
extern mutex znodes_mutex;
extern std::map<uint8_t, NodeInfo *> znodes;
extern ::std::map<uint8_t, NodeInfo *> znodes;

extern mutex zscenes_mutex;
extern std::list<SceneInfo *> zscenes;
extern ::std::list<SceneInfo *> zscenes;

} // namespace OZW

Expand Down
76 changes: 38 additions & 38 deletions src/openzwave-driver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace OZW {
Nan::HandleScope scope;
CheckMinArgs(1, "path");

std::string path(*Nan::Utf8String( info[0] ));
::std::string path(*Nan::Utf8String( info[0] ));

uv_async_init(uv_default_loop(), &async, async_cb_handler);

Expand All @@ -49,7 +49,7 @@ namespace OZW {
OpenZWave::Manager* mgr = OpenZWave::Manager::Get();
mgr->AddWatcher(ozw_watcher_callback, NULL);
mgr->AddDriver(path);
std::string version(OpenZWave::Manager::getVersionAsString());
::std::string version(OpenZWave::Manager::getVersionAsString());

Local < v8::Value > cbinfo[16];
cbinfo[0] = Nan::New<String>("connected").ToLocalChecked();
Expand All @@ -64,7 +64,7 @@ namespace OZW {
{
Nan::HandleScope scope;
CheckMinArgs(1, "path");
std::string path(*Nan::Utf8String( info[0] ));
::std::string path(*Nan::Utf8String( info[0] ));

OpenZWave::Manager::Get()->RemoveDriver(path);
OpenZWave::Manager::Get()->RemoveWatcher(ozw_watcher_callback, NULL);
Expand Down Expand Up @@ -100,8 +100,8 @@ namespace OZW {
// ===================================================================
{
Nan::HandleScope scope;
uint8 ctrlid = OpenZWave::Manager::Get()->GetControllerNodeId (homeid);
info.GetReturnValue().Set(
uint8 ctrlid = OpenZWave::Manager::Get()->GetControllerNodeId (homeid);
info.GetReturnValue().Set(
Nan::New<Integer>(ctrlid)
);
}
Expand All @@ -111,8 +111,8 @@ namespace OZW {
// ===================================================================
{
Nan::HandleScope scope;
uint8 sucid = OpenZWave::Manager::Get()->GetSUCNodeId (homeid);
info.GetReturnValue().Set(
uint8 sucid = OpenZWave::Manager::Get()->GetSUCNodeId (homeid);
info.GetReturnValue().Set(
Nan::New<Integer>(sucid)
);
}
Expand All @@ -127,8 +127,8 @@ namespace OZW {
// ===================================================================
{
Nan::HandleScope scope;
bool isprimary = OpenZWave::Manager::Get()->IsPrimaryController (homeid);
info.GetReturnValue().Set(Nan::New<Boolean>(isprimary));
bool isprimary = OpenZWave::Manager::Get()->IsPrimaryController (homeid);
info.GetReturnValue().Set(Nan::New<Boolean>(isprimary));
}

/* Query if the controller is a static update controller. A Static
Expand All @@ -141,8 +141,8 @@ namespace OZW {
// ===================================================================
{
Nan::HandleScope scope;
bool issuc = OpenZWave::Manager::Get()->IsStaticUpdateController (homeid);
info.GetReturnValue().Set(Nan::New<Boolean>(issuc));
bool issuc = OpenZWave::Manager::Get()->IsStaticUpdateController (homeid);
info.GetReturnValue().Set(Nan::New<Boolean>(issuc));
}

/* Query if the controller is using the bridge controller library.
Expand All @@ -154,47 +154,47 @@ namespace OZW {
// ===================================================================
{
Nan::HandleScope scope;
bool isbridge = OpenZWave::Manager::Get()->IsBridgeController (homeid);
info.GetReturnValue().Set(Nan::New<Boolean>(isbridge));
bool isbridge = OpenZWave::Manager::Get()->IsBridgeController (homeid);
info.GetReturnValue().Set(Nan::New<Boolean>(isbridge));
}

/* Get the version of the Z-Wave API library used by a controller.
*/
// ===================================================================
/* Get the version of the Z-Wave API library used by a controller.
*/
// ===================================================================
NAN_METHOD(OZW::GetLibraryVersion)
// ===================================================================
{
Nan::HandleScope scope;
std::string libver = OpenZWave::Manager::Get()->GetLibraryVersion (homeid);
info.GetReturnValue().Set(
::std::string libver = OpenZWave::Manager::Get()->GetLibraryVersion (homeid);
info.GetReturnValue().Set(
Nan::New<String>(
libver.c_str()
).ToLocalChecked()
);
}

/* Get a string containing the Z-Wave API library type used by a
* controller. The possible library types are:
* Static Controller
* Controller
* Enhanced Slave
* Slave
* Installer
* Routing Slave
* Bridge Controller
* Device Under Test
*
* The controller should never return a slave library type. For a
* more efficient test of whether a controller is a Bridge Controller,
* use the IsBridgeController method.
*/
// ===================================================================
/* Get a string containing the Z-Wave API library type used by a
* controller. The possible library types are:
* Static Controller
* Controller
* Enhanced Slave
* Slave
* Installer
* Routing Slave
* Bridge Controller
* Device Under Test
*
* The controller should never return a slave library type. For a
* more efficient test of whether a controller is a Bridge Controller,
* use the IsBridgeController method.
*/
// ===================================================================
NAN_METHOD(OZW::GetLibraryTypeName)
// ===================================================================
{
Nan::HandleScope scope;
std::string libtype = OpenZWave::Manager::Get()->GetLibraryTypeName (homeid);
info.GetReturnValue().Set(
::std::string libtype = OpenZWave::Manager::Get()->GetLibraryTypeName (homeid);
info.GetReturnValue().Set(
Nan::New<String>(
libtype.c_str()
).ToLocalChecked()
Expand All @@ -206,8 +206,8 @@ namespace OZW {
// ===================================================================
{
Nan::HandleScope scope;
uint32 cnt = OpenZWave::Manager::Get()->GetSendQueueCount (homeid);
info.GetReturnValue().Set(Nan::New<Integer>(cnt));
uint32 cnt = OpenZWave::Manager::Get()->GetSendQueueCount (homeid);
info.GetReturnValue().Set(Nan::New<Integer>(cnt));
}

}
2 changes: 1 addition & 1 deletion src/openzwave-groups.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ namespace OZW {
uint8 nodeid = info[0]->Uint32Value();
uint8 groupidx = info[1]->Uint32Value();

std::string groupLabel = OpenZWave::Manager::Get()->GetGroupLabel(
::std::string groupLabel = OpenZWave::Manager::Get()->GetGroupLabel(
homeid, nodeid, groupidx
);

Expand Down
24 changes: 12 additions & 12 deletions src/openzwave-nodes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ namespace OZW {
Nan::HandleScope scope;
CheckMinArgs(2, "nodeid, location");
uint8 nodeid = info[0]->Uint32Value();
std::string location(*Nan::Utf8String( info[1] ));
::std::string location(*Nan::Utf8String( info[1] ));
OpenZWave::Manager::Get()->SetNodeLocation(homeid, nodeid, location);
}

Expand All @@ -137,7 +137,7 @@ namespace OZW {
Nan::HandleScope scope;
CheckMinArgs(2, "nodeid, name");
uint8 nodeid = info[0]->Uint32Value();
std::string name(*Nan::Utf8String( info[1] ));
::std::string name(*Nan::Utf8String( info[1] ));
OpenZWave::Manager::Get()->SetNodeName(homeid, nodeid, name);
}

Expand Down Expand Up @@ -171,7 +171,7 @@ namespace OZW {
Nan::HandleScope scope;
CheckMinArgs(1, "nodeid");
uint8 nodeid = info[0]->Uint32Value();
std::string result = OpenZWave::Manager::Get()->GetNodeManufacturerName(homeid, nodeid);
::std::string result = OpenZWave::Manager::Get()->GetNodeManufacturerName(homeid, nodeid);
info.GetReturnValue().Set(Nan::New<String>(result.c_str()).ToLocalChecked());
}

Expand Down Expand Up @@ -367,7 +367,7 @@ namespace OZW {
Nan::HandleScope scope;
CheckMinArgs(1, "nodeid");
uint8 nodeid = info[0]->Uint32Value();
std::string result = OpenZWave::Manager::Get()->GetNodeType(homeid, nodeid);
::std::string result = OpenZWave::Manager::Get()->GetNodeType(homeid, nodeid);
info.GetReturnValue().Set(Nan::New<String>(result.c_str()).ToLocalChecked());
}

Expand All @@ -381,7 +381,7 @@ namespace OZW {
Nan::HandleScope scope;
CheckMinArgs(1, "nodeid");
uint8 nodeid = info[0]->Uint32Value();
std::string result = OpenZWave::Manager::Get()->GetNodeProductName(homeid, nodeid);
::std::string result = OpenZWave::Manager::Get()->GetNodeProductName(homeid, nodeid);
info.GetReturnValue().Set(Nan::New<String>(result.c_str()).ToLocalChecked());
}

Expand All @@ -395,7 +395,7 @@ namespace OZW {
Nan::HandleScope scope;
CheckMinArgs(1, "nodeid");
uint8 nodeid = info[0]->Uint32Value();
std::string result = OpenZWave::Manager::Get()->GetNodeName(homeid, nodeid);
::std::string result = OpenZWave::Manager::Get()->GetNodeName(homeid, nodeid);
info.GetReturnValue().Set(Nan::New<String>(result.c_str()).ToLocalChecked());
}

Expand All @@ -409,7 +409,7 @@ namespace OZW {
Nan::HandleScope scope;
CheckMinArgs(1, "nodeid");
uint8 nodeid = info[0]->Uint32Value();
std::string result = OpenZWave::Manager::Get()->GetNodeLocation(homeid, nodeid);
::std::string result = OpenZWave::Manager::Get()->GetNodeLocation(homeid, nodeid);
info.GetReturnValue().Set(Nan::New<String>(result.c_str()).ToLocalChecked());
}

Expand All @@ -423,7 +423,7 @@ namespace OZW {
Nan::HandleScope scope;
CheckMinArgs(1, "nodeid");
uint8 nodeid = info[0]->Uint32Value();
std::string result = OpenZWave::Manager::Get()->GetNodeManufacturerId(homeid, nodeid);
::std::string result = OpenZWave::Manager::Get()->GetNodeManufacturerId(homeid, nodeid);
info.GetReturnValue().Set(Nan::New<String>(result.c_str()).ToLocalChecked());
}

Expand All @@ -437,7 +437,7 @@ namespace OZW {
Nan::HandleScope scope;
CheckMinArgs(1, "nodeid");
uint8 nodeid = info[0]->Uint32Value();
std::string result = OpenZWave::Manager::Get()->GetNodeProductType(homeid, nodeid);
::std::string result = OpenZWave::Manager::Get()->GetNodeProductType(homeid, nodeid);
info.GetReturnValue().Set(Nan::New<String>(result.c_str()).ToLocalChecked());
}

Expand All @@ -451,7 +451,7 @@ namespace OZW {
Nan::HandleScope scope;
CheckMinArgs(1, "nodeid");
uint8 nodeid = info[0]->Uint32Value();
std::string result = OpenZWave::Manager::Get()->GetNodeProductId(homeid, nodeid);
::std::string result = OpenZWave::Manager::Get()->GetNodeProductId(homeid, nodeid);
info.GetReturnValue().Set(Nan::New<String>(result.c_str()).ToLocalChecked());
}

Expand All @@ -465,7 +465,7 @@ namespace OZW {
Nan::HandleScope scope;
CheckMinArgs(1, "nodeid");
uint8 nodeid = info[0]->Uint32Value();
std::string name(*Nan::Utf8String( info[1] ));
::std::string name(*Nan::Utf8String( info[1] ));
OpenZWave::Manager::Get()->SetNodeManufacturerName(homeid, nodeid, name);
}

Expand All @@ -479,7 +479,7 @@ namespace OZW {
Nan::HandleScope scope;
CheckMinArgs(1, "nodeid");
uint8 nodeid = info[0]->Uint32Value();
std::string name(*Nan::Utf8String( info[1] ));
::std::string name(*Nan::Utf8String( info[1] ));
OpenZWave::Manager::Get()->SetNodeProductName(homeid, nodeid, name);
}

Expand Down
Loading

0 comments on commit ffe5e45

Please sign in to comment.