Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ICBM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
detectors
DSSC
ICBM
Commits
3ccc752f
Commit
3ccc752f
authored
5 months ago
by
Cyril Danilevski
Browse files
Options
Downloads
Patches
Plain Diff
Pin SNMP library to 2.0.0
parent
c7f1d1d6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
Loading
Pipeline
#152077
passed
5 months ago
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+1
-1
1 addition, 1 deletion
README.md
mpod.cpp
+4
-4
4 additions, 4 deletions
mpod.cpp
rest.cpp
+1
-1
1 addition, 1 deletion
rest.cpp
with
6 additions
and
6 deletions
README.md
+
1
−
1
View file @
3ccc752f
...
@@ -69,7 +69,7 @@ Update the Arduino index with:
...
@@ -69,7 +69,7 @@ Update the Arduino index with:
The required libraries are (minimum versions):
The required libraries are (minimum versions):
arduino-cli lib install ethernet
arduino-cli lib install ethernet
arduino-cli lib install
--git-url https://github.com/patricklaf/SNMP.git --config-file arduino-cli.yaml # Awaiting 1.4.1+ tag
arduino-cli lib install
SNMP@2.0.0
arduino-cli lib install MCP23S08@0.5.2
arduino-cli lib install MCP23S08@0.5.2
...
...
This diff is collapsed.
Click to expand it.
mpod.cpp
+
4
−
4
View file @
3ccc752f
...
@@ -17,7 +17,7 @@ MPOD::MPOD() {
...
@@ -17,7 +17,7 @@ MPOD::MPOD() {
// Create an SNMP SETREQUEST message to setup MPOD
// Create an SNMP SETREQUEST message to setup MPOD
SNMP
::
Message
*
MPOD
::
setup
()
{
SNMP
::
Message
*
MPOD
::
setup
()
{
// Use read/write community, not read-only
// Use read/write community, not read-only
SNMP
::
Message
*
message
=
new
SNMP
::
Message
(
SNMP
::
V
ERSION
2C
,
"guru"
,
SNMP
::
T
YPE_SETREQUEST
);
SNMP
::
Message
*
message
=
new
SNMP
::
Message
(
SNMP
::
V
ersion
::
V
2C
,
"guru"
,
SNMP
::
T
ype
::
SetRequest
);
// In SETREQUEST, use node type and set the value.
// In SETREQUEST, use node type and set the value.
// OUTPUT SWITCH, integer type, 0 is OFF and 1 is ON.
// OUTPUT SWITCH, integer type, 0 is OFF and 1 is ON.
message
->
add
(
OID
::
NAMES
[
OID
::
OUTPUTSWITCH
],
new
IntegerBER
(
0
));
message
->
add
(
OID
::
NAMES
[
OID
::
OUTPUTSWITCH
],
new
IntegerBER
(
0
));
...
@@ -32,7 +32,7 @@ SNMP::Message* MPOD::setup() {
...
@@ -32,7 +32,7 @@ SNMP::Message* MPOD::setup() {
// Create an SNMP GETREQUEST message
// Create an SNMP GETREQUEST message
SNMP
::
Message
*
MPOD
::
read
()
{
SNMP
::
Message
*
MPOD
::
read
()
{
SNMP
::
Message
*
message
=
new
SNMP
::
Message
(
SNMP
::
V
ERSION
2C
,
"public"
,
SNMP
::
T
YPE_GETREQUEST
);
SNMP
::
Message
*
message
=
new
SNMP
::
Message
(
SNMP
::
V
ersion
::
V
2C
,
"public"
,
SNMP
::
T
ype
::
GetRequest
);
// In GETREQUEST, values are always of type NULL.
// In GETREQUEST, values are always of type NULL.
message
->
add
(
OID
::
NAMES
[
OID
::
OUTPUTSTATUS
]);
message
->
add
(
OID
::
NAMES
[
OID
::
OUTPUTSTATUS
]);
message
->
add
(
OID
::
NAMES
[
OID
::
OUTPUTMEASUREMENTSENSEVOLTAGE
]);
message
->
add
(
OID
::
NAMES
[
OID
::
OUTPUTMEASUREMENTSENSEVOLTAGE
]);
...
@@ -42,7 +42,7 @@ SNMP::Message* MPOD::read() {
...
@@ -42,7 +42,7 @@ SNMP::Message* MPOD::read() {
// Create an SNMP SETREQUEST message to switch on or off the MPOD
// Create an SNMP SETREQUEST message to switch on or off the MPOD
SNMP
::
Message
*
MPOD
::
output
(
const
bool
on
)
{
SNMP
::
Message
*
MPOD
::
output
(
const
bool
on
)
{
SNMP
::
Message
*
message
=
new
SNMP
::
Message
(
SNMP
::
V
ERSION
2C
,
"guru"
,
SNMP
::
T
YPE_SETREQUEST
);
SNMP
::
Message
*
message
=
new
SNMP
::
Message
(
SNMP
::
V
ersion
::
V
2C
,
"guru"
,
SNMP
::
T
ype
::
SetRequest
);
// In SETREQUEST, use node type and set the value.
// In SETREQUEST, use node type and set the value.
// OUTPUT SWITCH, integer type, 0 is OFF and 1 is ON.
// OUTPUT SWITCH, integer type, 0 is OFF and 1 is ON.
message
->
add
(
OID
::
NAMES
[
OID
::
OUTPUTSWITCH
],
new
IntegerBER
(
on
?
1
:
0
));
message
->
add
(
OID
::
NAMES
[
OID
::
OUTPUTSWITCH
],
new
IntegerBER
(
on
?
1
:
0
));
...
@@ -196,7 +196,7 @@ void onMessage(const SNMP::Message *message, const IPAddress remote, const uint1
...
@@ -196,7 +196,7 @@ void onMessage(const SNMP::Message *message, const IPAddress remote, const uint1
}
}
void
initializeSNMP
()
{
void
initializeSNMP
()
{
snmp
.
begin
(
&
udp
);
snmp
.
begin
(
udp
);
snmp
.
onMessage
(
onMessage
);
snmp
.
onMessage
(
onMessage
);
Serial
.
println
(
"SNMP Server Started"
);
Serial
.
println
(
"SNMP Server Started"
);
}
}
This diff is collapsed.
Click to expand it.
rest.cpp
+
1
−
1
View file @
3ccc752f
...
@@ -143,7 +143,7 @@ void sendSNMP() {
...
@@ -143,7 +143,7 @@ void sendSNMP() {
auto
ipAddr
=
IPAddress
(
192
,
168
,
140
,
79
);
auto
ipAddr
=
IPAddress
(
192
,
168
,
140
,
79
);
if
(
output
!=
NONE
)
{
if
(
output
!=
NONE
)
{
SNMP
::
Message
*
snmp_msg
=
mpod
.
output
(
output
);
SNMP
::
Message
*
snmp_msg
=
mpod
.
output
(
output
);
snmp
.
send
(
snmp_msg
,
ipAddr
,
SNMP
::
P
ORT
::
SNMP
);
snmp
.
send
(
snmp_msg
,
ipAddr
,
SNMP
::
P
ort
::
SNMP
);
delete
snmp_msg
;
delete
snmp_msg
;
success
=
true
;
success
=
true
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment