Skip to content

Commit

Permalink
Fixed #23 - Gauge misspelt in several places.
Browse files Browse the repository at this point in the history
  • Loading branch information
shortbloke committed Oct 30, 2022
1 parent 67da60a commit d0b9df5
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 29 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG for SNMP Manager For ESP8266/ESP32/Arduino

## 1.1.10

- Fixed spelling error `Guage` now corrected all references to `Gauge`. This maybe a breaking change if for example you are were using `addGuageHandler` or referencing the type `GUAGG32`, which now should be updated to `addGaugeHandler` and `GAUGG32`.

## 1.1.9

- Added a new example file for ESP MCU to show polling of multiple devices and storing results in a device record array. #20
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The library supports:
- String (Arduino data type: char*)
- Counter32 (Arduino data type: unsigned int)
- Counter64 (Arduino data type: long long unsigned int)
- Guage32 (Arduino data type: unsigned int)
- Gauge32 (Arduino data type: unsigned int)
- Timestamp (Arduino data type: unsigned int)

If you find this useful, consider providing some support:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ IPAddress router(192, 168, 200, 1);
const char *community = "public";
const int snmpVersion = 1; // SNMP Version 1 = 0, SNMP Version 2 = 1
// OIDs
const char *oidIfSpeedGuage = ".1.3.6.1.2.1.10.94.1.1.4.1.2.4"; // Guage ADSL Down Sync Speed (interface 4)
// const char *oidIfSpeedGuage = ".1.3.6.1.2.1.2.2.1.5.4"; // Guage Regular ethernet interface ifSpeed.4
const char *oidIfSpeedGauge = ".1.3.6.1.2.1.10.94.1.1.4.1.2.4"; // Gauge ADSL Down Sync Speed (interface 4)
// const char *oidIfSpeedGauge = ".1.3.6.1.2.1.2.2.1.5.4"; // Gauge Regular ethernet interface ifSpeed.4
const char *oidInOctetsCount32 = ".1.3.6.1.2.1.2.2.1.10.4"; // Counter32 ifInOctets.4
const char *oidUptime = ".1.3.6.1.2.1.1.3.0"; // TimeTicks uptime (hundredths of seconds)
//************************************
Expand Down Expand Up @@ -86,7 +86,7 @@ void setup()
snmp.begin(); // start the SNMP Manager

// Get callbacks from creating a handler for each of the OID
callbackIfSpeed = snmp.addGuageHandler(router, oidIfSpeedGuage, &ifSpeedResponse);
callbackIfSpeed = snmp.addGaugeHandler(router, oidIfSpeedGauge, &ifSpeedResponse);
callbackInOctets= snmp.addCounter32Handler(router, oidInOctetsCount32, &inOctetsResponse);
callbackUptime = snmp.addTimestampHandler(router, oidUptime, &uptime);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ IPAddress router(192, 168, 200, 1);
const char *community = "public";
const int snmpVersion = 1; // SNMP Version 1 = 0, SNMP Version 2 = 1
// OIDs
const char *oidIfSpeedGuage = ".1.3.6.1.2.1.10.94.1.1.4.1.2.4"; // Guage ADSL Down Sync Speed (interface 4)
// const char *oidIfSpeedGuage = ".1.3.6.1.2.1.2.2.1.5.4"; // Guage Regular ethernet interface ifSpeed.4
const char *oidIfSpeedGauge = ".1.3.6.1.2.1.10.94.1.1.4.1.2.4"; // Gauge ADSL Down Sync Speed (interface 4)
// const char *oidIfSpeedGauge = ".1.3.6.1.2.1.2.2.1.5.4"; // Gauge Regular ethernet interface ifSpeed.4
const char *oidInOctetsCount32 = ".1.3.6.1.2.1.2.2.1.10.4"; // Counter32 ifInOctets.4
const char *oidServiceCountInt = ".1.3.6.1.2.1.1.7.0"; // Integer sysServices
const char *oidSysName = ".1.3.6.1.2.1.1.5.0"; // OctetString SysName
Expand Down Expand Up @@ -94,7 +94,7 @@ void setup()
snmp.begin(); // start the SNMP Manager

// Get callbacks from creating a handler for each of the OID
callbackIfSpeed = snmp.addGuageHandler(router, oidIfSpeedGuage, &ifSpeedResponse);
callbackIfSpeed = snmp.addGaugeHandler(router, oidIfSpeedGauge, &ifSpeedResponse);
callbackInOctets= snmp.addCounter32Handler(router, oidInOctetsCount32, &inOctetsResponse);
callbackServices = snmp.addIntegerHandler(router, oidServiceCountInt, &servicesResponse);
callbackSysName = snmp.addStringHandler(router, oidSysName, &sysNameResponse);
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SNMP Manager",
"version": "1.1.9",
"version": "1.1.10",
"description": "An SNMP Manager library to make SNMP requests to other SNMP enabled devices. Supporting SNMP v1 and v2, SNMP requests can be sent (GetRequest) and their responses received (GetResponse) for various SNMP data types.",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=SNMP Manager
version=1.1.9
version=1.1.10
author=Martin Rowan <martin@martinrowan.co.uk>
maintainer=Martin Rowan <martin@martinrowan.co.uk>
sentence=An SNMP Manager library to make SNMP requests to other SNMP enabled devices.
Expand Down
22 changes: 11 additions & 11 deletions src/Arduino_SNMP_Manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ class Counter32Callback : public ValueCallback
uint32_t *value;
};

class Guage32Callback : public ValueCallback
class Gauge32Callback : public ValueCallback
{
public:
Guage32Callback() : ValueCallback(ASN_TYPE::GUAGE32){};
Gauge32Callback() : ValueCallback(ASN_TYPE::GAUGE32){};
uint32_t *value;
};

Expand Down Expand Up @@ -112,7 +112,7 @@ class SNMPManager
ValueCallback *addOIDHandler(IPAddress ip, const char *oid, char *value);
ValueCallback *addCounter64Handler(IPAddress ip, const char *oid, uint64_t *value);
ValueCallback *addCounter32Handler(IPAddress ip, const char *oid, uint32_t *value);
ValueCallback *addGuageHandler(IPAddress ip, const char *oid, uint32_t *value);
ValueCallback *addGaugeHandler(IPAddress ip, const char *oid, uint32_t *value);

void setUDP(UDP *udp);
bool begin();
Expand Down Expand Up @@ -354,14 +354,14 @@ bool SNMPManager::parsePacket()
delete value;
}
break;
case GUAGE32:
case GAUGE32:
{
#ifdef DEBUG
Serial.println("[DEBUG] Type: Guage32");
Serial.println("[DEBUG] Type: Gauge32");
#endif
Guage *value = new Guage();
*(((Guage32Callback *)callback)->value) = ((Guage *)responseContainer)->_value;
value->_value = *(((Guage32Callback *)callback)->value);
Gauge *value = new Gauge();
*(((Gauge32Callback *)callback)->value) = ((Gauge *)responseContainer)->_value;
value->_value = *(((Gauge32Callback *)callback)->value);
delete value;
}
break;
Expand Down Expand Up @@ -517,12 +517,12 @@ ValueCallback *SNMPManager::addCounter32Handler(IPAddress ip, const char *oid, u
return callback;
}

ValueCallback *SNMPManager::addGuageHandler(IPAddress ip, const char *oid, uint32_t *value)
ValueCallback *SNMPManager::addGaugeHandler(IPAddress ip, const char *oid, uint32_t *value)
{
ValueCallback *callback = new Guage32Callback();
ValueCallback *callback = new Gauge32Callback();
callback->OID = (char *)malloc((sizeof(char) * strlen(oid)) + 1);
strcpy(callback->OID, oid);
((Guage32Callback *)callback)->value = value;
((Gauge32Callback *)callback)->value = value;
callback->ip = ip;
addHandler(callback);
return callback;
Expand Down
18 changes: 9 additions & 9 deletions src/BER.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ typedef enum ASN_TYPE_WITH_VALUE
STRUCTURE = 0x30,
NETWORK_ADDRESS = 0x40,
COUNTER32 = 0x41,
GUAGE32 = 0x42, // USIGNED32
GAUGE32 = 0x42, // UNSIGNED32
TIMESTAMP = 0x43,
OPAQUE = 0x44,
COUNTER64 = 0x46,
Expand Down Expand Up @@ -518,18 +518,18 @@ class Counter32 : public IntegerType
~Counter32(){};
};

class Guage : public IntegerType
class Gauge : public IntegerType
{ // Unsigned int
public:
Guage() : IntegerType()
Gauge() : IntegerType()
{
_type = GUAGE32;
_type = GAUGE32;
};
Guage(unsigned int value) : IntegerType(value)
Gauge(unsigned int value) : IntegerType(value)
{
_type = GUAGE32;
_type = GAUGE32;
};
~Guage(){};
~Gauge(){};
};

typedef struct BER_LINKED_LIST
Expand Down Expand Up @@ -639,8 +639,8 @@ class ComplexType : public BER_CONTAINER
case COUNTER32:
newObj = new Counter32();
break;
case GUAGE32:
newObj = new Guage();
case GAUGE32:
newObj = new Gauge();
break;
case COUNTER64:
newObj = new Counter64();
Expand Down

0 comments on commit d0b9df5

Please sign in to comment.