Changed unordered_set to vector when checking for duplicate AID
This eliminated the use of unordered_set everywhere in HomeSpan
This commit is contained in:
parent
98d6abeb1f
commit
1e62a038f1
|
|
@ -865,7 +865,7 @@ void Span::processSerialCommand(const char *c){
|
||||||
int nErrors=0;
|
int nErrors=0;
|
||||||
int nWarnings=0;
|
int nWarnings=0;
|
||||||
|
|
||||||
unordered_set<uint32_t> aidValues;
|
vector<uint32_t> aidValues;
|
||||||
char pNames[][7]={"PR","PW","EV","AA","TW","HD","WR"};
|
char pNames[][7]={"PR","PW","EV","AA","TW","HD","WR"};
|
||||||
|
|
||||||
for(auto acc=Accessories.begin(); acc!=Accessories.end(); acc++){
|
for(auto acc=Accessories.begin(); acc!=Accessories.end(); acc++){
|
||||||
|
|
@ -875,10 +875,10 @@ void Span::processSerialCommand(const char *c){
|
||||||
if(acc==Accessories.begin() && (*acc)->aid!=1)
|
if(acc==Accessories.begin() && (*acc)->aid!=1)
|
||||||
LOG0(" *** ERROR #%d! AID of first Accessory must always be 1 ***\n",++nErrors);
|
LOG0(" *** ERROR #%d! AID of first Accessory must always be 1 ***\n",++nErrors);
|
||||||
|
|
||||||
if(aidValues.find((*acc)->aid)!=aidValues.end())
|
if(std::find(aidValues.begin(),aidValues.end(),(*acc)->aid)!=aidValues.end())
|
||||||
LOG0(" *** ERROR #%d! AID already in use for another Accessory ***\n",++nErrors);
|
LOG0(" *** ERROR #%d! AID already in use for another Accessory ***\n",++nErrors);
|
||||||
|
|
||||||
aidValues.insert((*acc)->aid);
|
aidValues.push_back((*acc)->aid);
|
||||||
|
|
||||||
for(auto svc=(*acc)->Services.begin(); svc!=(*acc)->Services.end(); svc++){
|
for(auto svc=(*acc)->Services.begin(); svc!=(*acc)->Services.end(); svc++){
|
||||||
LOG0(" \u279f Service %s: IID=%d, %sUUID=\"%s\"\n",(*svc)->hapName,(*svc)->iid,(*svc)->isCustom?"Custom-":"",(*svc)->type);
|
LOG0(" \u279f Service %s: IID=%d, %sUUID=\"%s\"\n",(*svc)->hapName,(*svc)->iid,(*svc)->isCustom?"Custom-":"",(*svc)->type);
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,6 @@
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <unordered_set>
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <nvs.h>
|
#include <nvs.h>
|
||||||
#include <ArduinoOTA.h>
|
#include <ArduinoOTA.h>
|
||||||
|
|
@ -55,7 +54,6 @@
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using std::unordered_map;
|
using std::unordered_map;
|
||||||
using std::unordered_set;
|
|
||||||
using std::list;
|
using std::list;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|
|
||||||
|
|
@ -28,11 +28,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#include <unordered_set>
|
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
|
|
||||||
using std::unordered_set;
|
|
||||||
|
|
||||||
const int MAX_SSID=32; // max number of characters in WiFi SSID
|
const int MAX_SSID=32; // max number of characters in WiFi SSID
|
||||||
const int MAX_PWD=64; // max number of characters in WiFi Password
|
const int MAX_PWD=64; // max number of characters in WiFi Password
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue