Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
May1624-Wireless-Controller
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
jdkruege
May1624-Wireless-Controller
Commits
559494e9
Commit
559494e9
authored
9 years ago
by
jdkruege
Browse files
Options
Downloads
Patches
Plain Diff
Cleaned up Service and Source files.
parent
c75f4917
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Development/Software/Controller API/Service.cpp
+1
-6
1 addition, 6 deletions
Development/Software/Controller API/Service.cpp
Development/Software/Controller API/Source.cpp
+2
-85
2 additions, 85 deletions
Development/Software/Controller API/Source.cpp
with
3 additions
and
91 deletions
Development/Software/Controller API/Service.cpp
+
1
−
6
View file @
559494e9
#include
"Service.h"
Service
::
Service
(
int
id
,
string
name
,
double
frequency
)
{
_id
=
id
;
_name
=
name
;
_frequency
=
frequency
;
}
Service
::
Service
(
int
id
,
string
name
,
double
frequency
)
:
_id
(
id
),
_name
(
name
),
_frequency
(
frequency
)
{}
ServiceInfo
Service
::
info
()
{
...
...
This diff is collapsed.
Click to expand it.
Development/Software/Controller API/Source.cpp
+
2
−
85
View file @
559494e9
...
...
@@ -2,95 +2,12 @@
#include
<iostream>
#include
<string>
#include
"Client.h"
#include
"Server.h"
#include
"Capsule.h"
#include
"LSM9DS0.h"
using
namespace
std
;
using
namespace
Client
;
using
namespace
Server
;
void
clientSide
()
{
string
address
;
bool
stop
=
false
;
string
message
=
""
;
cout
<<
"MAC Address I need to connect to: "
;
cin
>>
address
;
if
(
!
Client
::
cInit
(
address
))
{
cout
<<
"That address is not properly formatted."
<<
endl
;
return
;
}
Client
::
cConnect
();
cout
<<
"Please input your message, if you would like to stop type
\"
STOP
\"
"
<<
endl
;
while
(
Client
::
cCheckStatus
()
&&
!
stop
)
{
getline
(
cin
,
message
);
Capsule
cap
=
Capsule
(
message
);
if
(
message
.
compare
(
"STOP"
)
==
0
)
stop
=
true
;
Client
::
cSendMessage
((
string
)((
char
*
)
&
cap
));
}
if
(
!
Client
::
cCheckStatus
())
{
perror
(
"Oh no!"
);
}
Client
::
cDisconnect
();
cout
<<
"Shutting Client Down"
<<
endl
;;
return
;
}
void
serverSide
()
{
bool
stop
=
false
;
string
message
=
""
;
Server
::
sInit
();
message
=
Server
::
sListen
();
cout
<<
message
+
" has connected to the server"
<<
endl
;
while
(
!
stop
)
{
message
=
Server
::
sReadMessage
();
Capsule
cap
=
(
Capsule
&
)(
*
message
.
c_str
());
//if (message.compare("STOP") == 0) stop = true;
/*else*/
cout
<<
cap
.
WhatDoIHave
()
<<
endl
;
}
Server
::
sDisconnect
();
cout
<<
"Shutting Server Down."
<<
endl
;
return
;
}
int
main
(
int
argc
,
char
**
argv
)
{
string
choice
;
cout
<<
"Would you like to be Client or Server? "
;
cin
>>
choice
;
if
(
choice
.
compare
(
"Client"
)
==
0
)
clientSide
();
else
if
(
choice
.
compare
(
"Server"
)
==
0
)
serverSide
();
else
cout
<<
"Wrong choice"
<<
endl
;
cout
<<
"Closing program now."
<<
endl
;
return
0
;
}
\ No newline at end of file
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