mirror of
https://github.com/Telecominfraproject/wlan-cloud-owprov.git
synced 2025-11-02 03:27:51 +00:00
Adding new registration processing for signup.
This commit is contained in:
@@ -126,19 +126,27 @@ namespace OpenWifi {
|
||||
|
||||
bool APConfig::ReplaceVariablesInObject( Poco::JSON::Object::Ptr & Original, Poco::JSON::Object::Ptr & Result) {
|
||||
// get all the names and expand
|
||||
std::cout << __LINE__ << std::endl;
|
||||
auto Names = Original->getNames();
|
||||
for(const auto &i:Names) {
|
||||
std::cout << __LINE__ << std::endl;
|
||||
if(i=="__variableBlock") {
|
||||
std::cout << __LINE__ << std::endl;
|
||||
if(Original->isArray(i)) {
|
||||
std::cout << __LINE__ << std::endl;
|
||||
auto UUIDs = Original->getArray(i);
|
||||
for(const auto &uuid:*UUIDs) {
|
||||
std::cout << __LINE__ << std::endl;
|
||||
ProvObjects::VariableBlock VB;
|
||||
if(StorageService()->VariablesDB().GetRecord("id", uuid, VB)) {
|
||||
std::cout << __LINE__ << std::endl;
|
||||
for(const auto &var:VB.variables) {
|
||||
std::cout << __LINE__ << std::endl;
|
||||
Poco::JSON::Parser P;
|
||||
auto VariableBlockInfo = P.parse(var.value).extract<Poco::JSON::Object::Ptr>();
|
||||
auto VarNames = VariableBlockInfo->getNames();
|
||||
for(const auto &j:VarNames) {
|
||||
std::cout << __LINE__ << std::endl;
|
||||
Result->set(j,VariableBlockInfo->get(j));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -690,16 +690,16 @@ namespace OpenWifi::ProvObjects {
|
||||
info.to_json(Obj);
|
||||
field_to_json( Obj,"managementPolicy",managementPolicy);
|
||||
field_to_json( Obj,"deviceTypes",deviceTypes);
|
||||
field_to_json( Obj,"configuration",configuration);
|
||||
field_to_json( Obj,"inUse",inUse);
|
||||
field_to_json( Obj,"variables",variables);
|
||||
field_to_json( Obj,"rrm",rrm);
|
||||
field_to_json( Obj,"firmwareUpgrade",firmwareUpgrade);
|
||||
field_to_json( Obj,"firmwareRCOnly",firmwareRCOnly);
|
||||
field_to_json( Obj,"subscriberOnly",subscriberOnly);
|
||||
field_to_json( Obj,"entity", entity);
|
||||
field_to_json( Obj,"venue", venue);
|
||||
field_to_json( Obj,"subscriber", subscriber);
|
||||
field_to_json( Obj,"configuration",configuration);
|
||||
field_to_json( Obj,"inUse",inUse);
|
||||
field_to_json( Obj,"variables",variables);
|
||||
field_to_json( Obj,"rrm",rrm);
|
||||
}
|
||||
|
||||
bool DeviceConfiguration::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||
@@ -707,16 +707,16 @@ namespace OpenWifi::ProvObjects {
|
||||
info.from_json(Obj);
|
||||
field_from_json( Obj,"managementPolicy",managementPolicy);
|
||||
field_from_json( Obj,"deviceTypes",deviceTypes);
|
||||
field_from_json( Obj,"configuration",configuration);
|
||||
field_from_json( Obj,"inUse",inUse);
|
||||
field_from_json( Obj,"variables",variables);
|
||||
field_from_json( Obj,"rrm",rrm);
|
||||
field_from_json( Obj,"firmwareUpgrade",firmwareUpgrade);
|
||||
field_from_json( Obj,"firmwareRCOnly",firmwareRCOnly);
|
||||
field_from_json( Obj,"subscriberOnly",subscriberOnly);
|
||||
field_from_json( Obj,"entity", entity);
|
||||
field_from_json( Obj,"venue", venue);
|
||||
field_from_json( Obj,"subscriber", subscriber);
|
||||
field_from_json( Obj,"configuration",configuration);
|
||||
field_from_json( Obj,"rrm",rrm);
|
||||
field_from_json( Obj,"firmwareUpgrade",firmwareUpgrade);
|
||||
field_from_json( Obj,"firmwareRCOnly",firmwareRCOnly);
|
||||
return true;
|
||||
} catch(...) {
|
||||
|
||||
@@ -996,6 +996,26 @@ namespace OpenWifi::ProvObjects {
|
||||
return false;
|
||||
}
|
||||
|
||||
void CompleteDeviceConfiguration::to_json(Poco::JSON::Object &Obj) const {
|
||||
field_to_json( Obj,"configuration", configuration);
|
||||
field_to_json( Obj,"rrm", rrm);
|
||||
field_to_json( Obj,"firmwareRCOnly", firmwareRCOnly);
|
||||
field_to_json( Obj,"firmwareUpgrade", firmwareUpgrade);
|
||||
}
|
||||
|
||||
bool CompleteDeviceConfiguration::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||
try {
|
||||
field_from_json( Obj,"configuration", configuration);
|
||||
field_from_json( Obj,"rrm", rrm);
|
||||
field_from_json( Obj,"firmwareRCOnly", firmwareRCOnly);
|
||||
field_from_json( Obj,"firmwareUpgrade", firmwareUpgrade);
|
||||
return true;
|
||||
} catch(...) {
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void SubscriberDevice::to_json(Poco::JSON::Object &Obj) const {
|
||||
info.to_json(Obj);
|
||||
field_to_json( Obj,"serialNumber", serialNumber);
|
||||
|
||||
@@ -633,6 +633,16 @@ namespace OpenWifi::ProvObjects {
|
||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||
};
|
||||
|
||||
struct CompleteDeviceConfiguration {
|
||||
DeviceConfigurationElementVec configuration;
|
||||
std::string rrm{"inherit"};
|
||||
std::string firmwareUpgrade{"inherit"};
|
||||
std::string firmwareRCOnly{"inherit"};
|
||||
|
||||
void to_json(Poco::JSON::Object &Obj) const;
|
||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||
};
|
||||
|
||||
struct SubscriberDevice {
|
||||
ObjectInfo info;
|
||||
std::string serialNumber;
|
||||
@@ -645,15 +655,15 @@ namespace OpenWifi::ProvObjects {
|
||||
Types::UUID_t serviceClass;
|
||||
std::string qrCode;
|
||||
std::string geoCode;
|
||||
std::string rrm;
|
||||
std::string rrm{"inherit"};
|
||||
std::string state;
|
||||
std::string locale;
|
||||
std::string billingCode;
|
||||
DeviceConfigurationElementVec configuration;
|
||||
bool suspended=false;
|
||||
std::string realMacAddress;
|
||||
std::string firmwareUpgrade;
|
||||
bool firmwareRCOnly=true;
|
||||
std::string firmwareUpgrade{"yes"};
|
||||
std::string firmwareRCOnly{"inherit"};
|
||||
|
||||
void to_json(Poco::JSON::Object &Obj) const;
|
||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace OpenWifi {
|
||||
ORM::Field{"configuration",ORM::FieldType::FT_TEXT},
|
||||
ORM::Field{"suspended",ORM::FieldType::FT_BOOLEAN},
|
||||
ORM::Field{"realMacAddress",ORM::FieldType::FT_TEXT},
|
||||
ORM::Field{"firmwareRCOnly",ORM::FieldType::FT_BOOLEAN},
|
||||
ORM::Field{"firmwareRCOnly",ORM::FieldType::FT_TEXT},
|
||||
ORM::Field{"firmwareUpgrade",ORM::FieldType::FT_TEXT}
|
||||
};
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace OpenWifi {
|
||||
std::string,
|
||||
bool,
|
||||
std::string,
|
||||
bool,
|
||||
std::string,
|
||||
std::string
|
||||
> SubDeviceDBRecordType;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user