Skip to content

Commit

Permalink
Fix previous commit qca#2
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Heimpold <[email protected]>
  • Loading branch information
mhei committed Nov 2, 2017
1 parent d597e6f commit 5aef89f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
12 changes: 8 additions & 4 deletions slac/evse.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,11 @@ static void UnmatchedState (struct session * session, struct channel * channel,
session->state = EVSE_STATE_UNOCCUPIED;
return;
}
if (_allset( session->flags, SLAC_SOUNDONLY))
{
session->state = EVSE_STATE_UNOCCUPIED;
return;
}
slac_debug (session, 0, __func__, "Matching ...");
if (evse_cm_slac_match (session, channel, message))
{
Expand Down Expand Up @@ -397,7 +402,6 @@ int main (int argc, char const * argv [])
char const * profile = PROFILE;
char const * section = SECTION;
signed c;
int sound_only = 0;
int dont_loop = 0;
memset (& session, 0, sizeof (session));
memset (& message, 0, sizeof (message));
Expand Down Expand Up @@ -445,7 +449,7 @@ int main (int argc, char const * argv [])
break;

case 'K':
sound_only = 1;
_setbits (session.flags, SLAC_SOUNDONLY);
break;
case 'l':
dont_loop = 1;
Expand Down Expand Up @@ -482,7 +486,7 @@ int main (int argc, char const * argv [])
openchannel (& channel);
initialize (& session, profile, section);
identifier (& session, & channel);
if (!sound_only)
if (_allclr (session.flags, SLAC_SOUNDONLY))
{
if (evse_cm_set_key (& session, & channel, & message))
{
Expand All @@ -502,7 +506,7 @@ int main (int argc, char const * argv [])
UnmatchedState (& session, & channel, & message);
continue;
}
if (sound_only)
if (_allset (session.flags, SLAC_SOUNDONLY))
{
break;
}
Expand Down
12 changes: 8 additions & 4 deletions slac/pev.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,11 @@ static void UnmatchedState (struct session * session, struct channel * channel,
session->state = PEV_STATE_DISCONNECTED;
return;
}
if (_allset( session->flags, SLAC_SOUNDONLY))
{
session->state = PEV_STATE_DISCONNECTED;
return;
}
slac_debug (session, 0, __func__, "Matching ...");
if (pev_cm_slac_match (session, channel, message))
{
Expand Down Expand Up @@ -423,7 +428,6 @@ int main (int argc, char const * argv [])
char const * profile = PROFILE;
char const * section = SECTION;
signed c;
int sound_only = 0;
memset (& session, 0, sizeof (session));
memset (& message, 0, sizeof (message));
channel.timeout = SLAC_TIMEOUT;
Expand Down Expand Up @@ -469,7 +473,7 @@ int main (int argc, char const * argv [])

break;
case 'K':
sound_only = 1;
_setbits (session.flags, SLAC_SOUNDONLY);
break;
case 'l':
state = PEV_STATE_DISCONNECTED;
Expand Down Expand Up @@ -506,7 +510,7 @@ int main (int argc, char const * argv [])
openchannel (& channel);
identifier (& session, & channel);
initialize (& session, profile, section);
if (!sound_only)
if (_allset (session.flags, SLAC_SOUNDONLY))
{
if (pev_cm_set_key (& session, & channel, & message))
{
Expand All @@ -526,7 +530,7 @@ int main (int argc, char const * argv [])
UnmatchedState (& session, & channel, & message);
continue;
}
if (sound_only)
if (_allset (session.flags, SLAC_SOUNDONLY))
{
break;
}
Expand Down
9 changes: 5 additions & 4 deletions slac/slac.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,11 @@
#define SLAC_CHARGETIME 2
#define SLAC_FLAGS 0

#define SLAC_SILENCE (1 << 0)
#define SLAC_VERBOSE (1 << 1)
#define SLAC_SESSION (1 << 2)
#define SLAC_COMPARE (1 << 3)
#define SLAC_SILENCE (1 << 0)
#define SLAC_VERBOSE (1 << 1)
#define SLAC_SESSION (1 << 2)
#define SLAC_COMPARE (1 << 3)
#define SLAC_SOUNDONLY (1 << 4)

#define SLAC_CM_SETKEY_KEYTYPE 0x01
#define SLAC_CM_SETKEY_PID 0x02
Expand Down

0 comments on commit 5aef89f

Please sign in to comment.