sglvladi / meshquitto

A simple Arduino project, which aims to provide a gateway between a mesh network of ESP8266's and a remote MQTT broker.
https://github.com/sglvladi/meshquitto
MIT License
40 stars 16 forks source link

Lack of two libraries-----HashMap,SimpleList #1

Closed VIRGIL-YAN closed 7 years ago

VIRGIL-YAN commented 7 years ago

Hello!I can't run after download the source because results reminded me of some mistake.

Users/virgilyan/Desktop/mesh_gateway/mesh_gateway.ino: In function 'SimpleList getDifference(SimpleList, SimpleList)': mesh_gateway:235: error: no match for 'operator[]' (operand types are 'SimpleList' and 'int') if (arr1[i] < arr2[j]) ^ mesh_gateway:235: error: no match for 'operator[]' (operand types are 'SimpleList' and 'int') if (arr1[i] < arr2[j]) ^ mesh_gateway:236: error: no match for 'operator[]' (operand types are 'SimpleList' and 'int') diff.push_back(arr1[i++]); ^ mesh_gateway:237: error: no match for 'operator[]' (operand types are 'SimpleList' and 'int') else if (arr2[j] < arr1[i]) ^ mesh_gateway:237: error: no match for 'operator[]' (operand types are 'SimpleList' and 'int') else if (arr2[j] < arr1[i]) ^ mesh_gateway:238: error: no match for 'operator[]' (operand types are 'SimpleList' and 'int') diff.push_back(arr2[j++]); ^ mesh_gateway:246: error: no match for 'operator[]' (operand types are 'SimpleList' and 'int') diff.push_back(arr1[i++]); ^ mesh_gateway:249: error: no match for 'operator[]' (operand types are 'SimpleList' and 'int') diff.push_back(arr2[j++]); ^ /Users/virgilyan/Desktop/mesh_gateway/mesh_gateway.ino: In function 'SimpleList getIntersection(SimpleList, SimpleList)': mesh_gateway:268: error: no match for 'operator[]' (operand types are 'SimpleList' and 'int') if (arr1[i] < arr2[j]) ^ mesh_gateway:268: error: no match for 'operator[]' (operand types are 'SimpleList' and 'int') if (arr1[i] < arr2[j]) ^ mesh_gateway:270: error: no match for 'operator[]' (operand types are 'SimpleList' and 'int') else if (arr2[j] < arr1[i]) ^ mesh_gateway:270: error: no match for 'operator[]' (operand types are 'SimpleList' and 'int') else if (arr2[j] < arr1[i]) ^ mesh_gateway:274: error: no match for 'operator[]' (operand types are 'SimpleList' and 'int') intersect.push_back(arr2[j++]); ^ /Users/virgilyan/Desktop/mesh_gateway/mesh_gateway.ino: In function 'void updateLostConnections()': mesh_gateway:335: error: no match for 'operator[]' (operand types are 'SimpleList' and 'int') if (millis() - lostConnTimeouts[i] > MESH_KEEP_ALIVE) { ^ mesh_gateway:336: error: no match for 'operator[]' (operand types are 'SimpleList' and 'int') String topic = String(String(macAddressMap[lostConnections[i]]) + "/disconnect"); ^ mesh_gateway:346: error: no match for 'operator[]' (operand types are 'SimpleList' and 'int') macAddressMap.remove(lostConnections[i]); ^ mesh_gateway:347: error: 'class SimpleList' has no member named 'remove' lostConnections.remove(i); ^ mesh_gateway:348: error: 'class SimpleList' has no member named 'remove' lostConnTimeouts.remove(i); ^ /Users/virgilyan/Desktop/mesh_gateway/mesh_gateway.ino: In function 'void changedConnectionCallback()': mesh_gateway:423: error: 'class SimpleList' has no member named 'sort' nodes.sort(); ^ mesh_gateway:449: error: 'class SimpleList' has no member named 'indexOf' int index = lostConnections.indexOf(node); ^ mesh_gateway:476: error: 'class SimpleList' has no member named 'indexOf' int index = lostConnections.indexOf(node); ^ mesh_gateway:480: error: 'class SimpleList' has no member named 'remove' lostConnections.remove(index); ^ mesh_gateway:481: error: 'class SimpleList' has no member named 'remove' lostConnTimeouts.remove(index); ^ /Users/virgilyan/Desktop/mesh_gateway/mesh_gateway.ino: In function 'void receiveFromWiFi()': mesh_gateway:619: error: 'class HashMap<int, String, 30u>' has no member named 'indexOfValue' if (macAddressMap.indexOfValue(macAddress) != -1) { ^ mesh_gateway:620: error: 'class HashMap<int, String, 30u>' has no member named 'indexOfValue' uint32_t nodeId = macAddressMap.keyAt(macAddressMap.indexOfValue(macAddress)); ^ /Users/virgilyan/Desktop/mesh_gateway/mesh_gateway.ino: In function 'void loop()': mesh_gateway:677: error: no match for 'operator[]' (operand types are 'SimpleList' and 'int') String msg = mqttMessageBuffer[0]; ^ exit status 1 no match for 'operator[]' (operand types are 'SimpleList' and 'int')

sglvladi commented 7 years ago

@VIRGIL-YAN You are absolutely correct. Thanks for spotting this. SimpleList normally comes with painlessMesh, however I have made some additions to implement the [] indexing operator and a remove index function. I shall include both libraries within the project to ensure compatibility and will let you know when the changes have been committed.

sglvladi commented 7 years ago

Should be all done now. Pull the new version and if you're happy you can close the issue.