void
app_hasim_user_process(void)
{
struct pms_receive pr;
int i;
/* PMS View check */
/* Periodically attempt to connect if unreachable. Return to initial
state variable settings on reachable to unreachable transition.. */
if (mdi.user_info.pms_view == HASIM_USER_PMS_VIEW_UNREACHABLE)
{
if (pms_connect(PMS_SERVER_PORT_NUMBER_DEFAULT) != 0)
{
}
else
{
mdi.user_info.pms_view = HASIM_USER_PMS_VIEW_REACHABLE;
mdi.user_info.view_cache = PMS_PD_USER_STATUS_PMS_REACHABLE;
}
}
else /* mdi.user_info.pms_view == HASIM_USER_PMS_VIEW_REACHABLE */
{
if (mdi.user_info.view_cache == PMS_PD_USER_STATUS_PMS_UNREACHABLE)
{
/* RND */
for(i=0;i<16;i++)
{
mdi.rnd_info[i].cache_state = HASIM_RND_CACHE_INVALID;
mdi.rnd_info[i].last_update = HASIM_CHECK_INVALID_INTERVAL;
if ((mdi.rnd_info[i].receive_state & HASIM_RND_RECEIVE_REGISTERED) != 0)
{
pr.session.type = PMS_SR_CALL_NO_RETURN;
pr.payload.type = PMS_PD_RND_STATUS;
pr.payload.data.rnd_status.identifier = \
mdi.mgmt_info.rnd_address_identifier[i];
pms_receive(&pr, 0, 0);
mdi.rnd_info[i].receive_state &= !HASIM_RND_RECEIVE_REGISTERED;
}
if ((mdi.rnd_info[i].receive_state & HASIM_RND_MD0_RECEIVE_REGISTERED)\
!= 0)
{
pr.session.type = PMS_SR_CALL_NO_RETURN;
pr.payload.type = PMS_PD_RND_MD0_STATUS;
pr.payload.data.rnd_status.identifier = \
mdi.mgmt_info.rnd_address_identifier[i];
pms_receive(&pr, 0, 0);
mdi.rnd_info[i].receive_state &= !HASIM_RND_MD0_RECEIVE_REGISTERED;
}
}
/* NODE */
mdi.node_info.cache_state = HASIM_NODE_CACHE_INVALID;
mdi.node_info.last_update = HASIM_CHECK_INVALID_INTERVAL;
if (mdi.node_info.service_state == HASIM_NODE_SERVICE_STATE_ACTIVE)
{
mdi.node_info.service_state = HASIM_NODE_SERVICE_STATE_OFFLINE;
}
if (mdi.node_info.rg0_app_name_state ==\
HASIM_NODE_RG0_APP_NAME_REGISTERED)
{
mdi.node_info.rg0_app_name_state = HASIM_NODE_RG0_APP_NAME_UNREGISTERED;
}
if ((mdi.node_info.receive_state &\
HASIM_NODE_RG0_STATUS_RECEIVE_REGISTERED) != 0)
{
pr.session.type = PMS_SR_CALL_NO_RETURN;
pr.payload.type = PMS_PD_NODE_RG0_STATUS;
pms_receive(&pr, 0, 0);
mdi.node_info.receive_state &=\
!HASIM_NODE_RG0_STATUS_RECEIVE_REGISTERED;
}
if ((mdi.node_info.receive_state & \
HASIM_NODE_RG0_APP_STATE_SET_EXECUTE_RECEIVE_REGISTERED) != 0)
{
pr.session.type = PMS_SR_CALL_RETURN_TIMED;
pr.payload.type = PMS_PD_NODE_RG0_APP_STATE_SET_EXECUTE;
pms_receive(&pr, 0, 0);
mdi.node_info.receive_state &= \
!HASIM_NODE_RG0_APP_STATE_SET_EXECUTE_RECEIVE_REGISTERED;
}
/* MGMT */
mdi.mgmt_info.cache_state = HASIM_MGMT_CACHE_INVALID;
mdi.mgmt_info.last_update = HASIM_CHECK_INVALID_INTERVAL;
for(i=0;i<16;i++)
mdi.mgmt_info.rnd_address_identifier[i] = -1;
if (mdi.mgmt_info.rnd_address_state == HASIM_MGMT_RND_ADDRESS_VERIFIED)
{
mdi.mgmt_info.rnd_address_state = HASIM_MGMT_RND_ADDRESS_UNVERIFIED;
}
if (mdi.mgmt_info.pms_state == HASIM_MGMT_PMS_STATE_AVAILABLE)
{
mdi.mgmt_info.pms_state = HASIM_MGMT_PMS_STATE_UNAVAILABLE;
}
if (mdi.mgmt_info.receive_state == HASIM_MGMT_RECEIVE_REGISTERED)
{
pr.session.type = PMS_SR_CALL_NO_RETURN;
pr.payload.type = PMS_PD_MGMT_STATUS;
pms_receive(&pr, 0, 1);
mdi.mgmt_info.receive_state = HASIM_MGMT_RECEIVE_UNREGISTERED;
}
/* USER */
if (mdi.user_info.receive_state == HASIM_USER_RECEIVE_REGISTERED)
{
pr.session.type = PMS_SR_CALL_NO_RETURN;
pr.payload.type = PMS_PD_USER_STATUS;
pms_receive(&pr, 0, 0);
mdi.user_info.receive_state = HASIM_USER_RECEIVE_UNREGISTERED;
}
if (mdi.user_info.pms_view == HASIM_USER_PMS_VIEW_REACHABLE)
{
pms_disconnect();
mdi.user_info.pms_view = HASIM_USER_PMS_VIEW_UNREACHABLE;
}
}
}
/* Receive Check */
/* If USER messages are not receive registered, attempt to register if PMS
is reachable.. */
if (mdi.user_info.pms_view == HASIM_USER_PMS_VIEW_REACHABLE)
{
if (mdi.user_info.receive_state != HASIM_USER_RECEIVE_REGISTERED)
{
pr.session.type = PMS_SR_CALL_NO_RETURN;
pr.payload.type = PMS_PD_USER_STATUS;
if (pms_receive(&pr, app_hasim_receive_post, 0) != -1)
mdi.user_info.receive_state = HASIM_USER_RECEIVE_REGISTERED;
}
}
}
void
app_hasim_mgmt_process(void)
{
struct pms_send ps;
struct pms_receive pr;
int info_get_fail;
int match[HASIM_RND_ADDRESS_AUDIT_ENTRYS];
int mgmt_state;
int rnd_address_identifier[16];
char rnd_address_node_ip_address[16][20];
char rnd_address_drawer_ip_address[16][20];
int rnd_address_node_slot_number[16];
int i, j;
/* Receive Check */
/* If MGMT messages are not receive registered, attempt to register if PMS
is reachable and USER receive messages are registered. If registration
is successful, force an initial cache update.. */
if (mdi.mgmt_info.receive_state != HASIM_MGMT_RECEIVE_REGISTERED)
{
if (mdi.user_info.receive_state == HASIM_USER_RECEIVE_REGISTERED)
{
if (mdi.user_info.pms_view == HASIM_USER_PMS_VIEW_REACHABLE)
{
pr.session.type = PMS_SR_CALL_NO_RETURN;
pr.payload.type = PMS_PD_MGMT_STATUS;
if (pms_receive(&pr, app_hasim_receive_post, 1) != -1)
mdi.mgmt_info.receive_state = HASIM_MGMT_RECEIVE_REGISTERED;
/* Force an info_get immediately after registering.. */
mdi.mgmt_info.last_sync_check = HASIM_SYNCCHECK_INTERVAL;
}
}
}
/* PMS State check */
/* Process PMS state transitions. On an available to unavailable transition
return to pre-NODE and RND operational state variable settings.. */
if (mdi.mgmt_info.pms_state == HASIM_MGMT_PMS_STATE_UNAVAILABLE)
{
if (mdi.mgmt_info.cache_state != HASIM_MGMT_CACHE_INVALID)
{
if (mdi.mgmt_info.mgmt_state_cache != \
PMS_PD_MGMT_INFO_GET_STATUS_UNAVAILABLE)
{
mdi.mgmt_info.pms_state = HASIM_MGMT_PMS_STATE_AVAILABLE;
}
}
}
else /* mdi.mgmt_info.pms_state == HASIM_MGMT_PMS_STATE_AVAILABLE */
{
if (mdi.mgmt_info.cache_state != HASIM_MGMT_CACHE_INVALID)
{
if (mdi.mgmt_info.mgmt_state_cache == \
PMS_PD_MGMT_INFO_GET_STATUS_UNAVAILABLE)
{
/* RND */
for(i=0;i<16;i++)
{
if ((mdi.rnd_info[i].receive_state & \
HASIM_RND_RECEIVE_REGISTERED) != 0)
{
pr.session.type = PMS_SR_CALL_NO_RETURN;
pr.payload.type = PMS_PD_RND_STATUS;
pr.payload.data.rnd_status.identifier = \
mdi.mgmt_info.rnd_address_identifier[i];
pms_receive(&pr, 0, 0);
mdi.rnd_info[i].receive_state &= !HASIM_RND_RECEIVE_REGISTERED;
}
if ((mdi.rnd_info[i].receive_state & HASIM_RND_MD0_RECEIVE_REGISTERED)\
!= 0)
{
pr.session.type = PMS_SR_CALL_NO_RETURN;
pr.payload.type = PMS_PD_RND_MD0_STATUS;
pr.payload.data.rnd_status.identifier = \
mdi.mgmt_info.rnd_address_identifier[i];
pms_receive(&pr, 0, 0);
mdi.rnd_info[i].receive_state &= !HASIM_RND_MD0_RECEIVE_REGISTERED;
}
}
/* NODE */
if (mdi.node_info.service_state == HASIM_NODE_SERVICE_STATE_ACTIVE)
{
mdi.node_info.service_state = HASIM_NODE_SERVICE_STATE_OFFLINE;
}
if (mdi.node_info.rg0_app_name_state == \
HASIM_NODE_RG0_APP_NAME_REGISTERED)
{
mdi.node_info.rg0_app_name_state = HASIM_NODE_RG0_APP_NAME_UNREGISTERED;
}
if ((mdi.node_info.receive_state &\
HASIM_NODE_RG0_STATUS_RECEIVE_REGISTERED) != 0)
{
pr.session.type = PMS_SR_CALL_NO_RETURN;
pr.payload.type = PMS_PD_NODE_RG0_STATUS;
pms_receive(&pr, 0, 0);
mdi.node_info.receive_state &=\
!HASIM_NODE_RG0_STATUS_RECEIVE_REGISTERED;
}
if ((mdi.node_info.receive_state & \
HASIM_NODE_RG0_APP_STATE_SET_EXECUTE_RECEIVE_REGISTERED) != 0)
{
pr.session.type = PMS_SR_CALL_RETURN_TIMED;
pr.payload.type = PMS_PD_NODE_RG0_APP_STATE_SET_EXECUTE;
pms_receive(&pr, 0, 0);
mdi.node_info.receive_state &= \
!HASIM_NODE_RG0_APP_STATE_SET_EXECUTE_RECEIVE_REGISTERED;
}
mdi.mgmt_info.pms_state = HASIM_MGMT_PMS_STATE_UNAVAILABLE;
}
}
}
/* RND Address Check */
/* Check once at startup if the RND address pairs currently in the list
are the same as this control application's defaults. If not, remove
any that differ and add any that are missing. This is a bit contrived
to demonstrate interaction via the address list messages. No point
in starting processing if cache is invalid and PMS is not reachable
and USER registration is not completed.. */
if (mdi.mgmt_info.rnd_address_state != HASIM_MGMT_RND_ADDRESS_VERIFIED)
{
if (mdi.mgmt_info.cache_state != HASIM_MGMT_CACHE_INVALID)
{
if (mdi.user_info.receive_state == HASIM_USER_RECEIVE_REGISTERED)
{
if (mdi.user_info.pms_view == HASIM_USER_PMS_VIEW_REACHABLE)
{
match[0] = 0;
match[1] = 0;
/* Search RND address list for entries not in the app's verify list.. */
for(i=0;i<16;i++)
{
if (mdi.mgmt_info.rnd_address_cache[i].identifier != -1)
{
for(j=0;j<HASIM_RND_ADDRESS_AUDIT_ENTRYS;j++)
{
if (match[j] == 0)
{
/* Use strcmp() for the moment. Use sockaddr_in when \
I get around to it.. */
if \
(strcmp(&mdi.mgmt_info.rnd_address_cache[i].node_ip_address[0], \
&mdi.rnd_address[j].node_ip_address[0]) == 0)
{
if\
(strcmp(&mdi.mgmt_info.rnd_address_cache[i].drawer_ip_address[0], \
&mdi.rnd_address[j].drawer_ip_address[0]) == 0)
{
if (mdi.mgmt_info.rnd_address_cache[i].node_slot_number == \
mdi.rnd_address[j].node_slot_number)
{
match[j] = 1;
break;
}
}
}
}
}
/* Delete entries not in the app's verify list.. */
if (j == HASIM_RND_ADDRESS_AUDIT_ENTRYS)
{
ps.session.type = PMS_SR_CALL_RETURN_TIMED;
ps.session.info.crt.time = 0;
ps.payload.type = PMS_PD_MGMT_RND_ADDRESS_DELETE_EXECUTE;
ps.payload.data.mgmt_rnd_address_delete_execute.identifier = \
mdi.mgmt_info.rnd_address_cache[i].identifier;
if (pms_send(&ps, &pr) == 0)
{
if (pr.payload.data.mgmt_rnd_address_delete_status.err == \
PMS_PD_MGMT_RND_ADDRESS_DELETE_STATUS_ERR_NONE)
{
}
}
}
}
}
/* Add any missing entries.. */
for(i=0;i<HASIM_RND_ADDRESS_AUDIT_ENTRYS;i++)
{
if (match[i] == 0)
{
ps.session.type = PMS_SR_CALL_RETURN_TIMED;
ps.session.info.crt.time = 0;
ps.payload.type = PMS_PD_MGMT_RND_ADDRESS_ADD_EXECUTE;
strncpy(&ps.payload.data.mgmt_rnd_address_add_execute.node_ip_address[0], \
&mdi.rnd_address[i].node_ip_address[0], 20);
strncpy(&ps.payload.data.mgmt_rnd_address_add_execute.drawer_ip_address[0], \
&mdi.rnd_address[i].drawer_ip_address[0], 20);
ps.payload.data.mgmt_rnd_address_add_execute.node_slot_number = \
mdi.rnd_address[i].node_slot_number;
if (pms_send(&ps, &pr) == 0)
{
if (pr.payload.data.mgmt_rnd_address_add_status.err == \
PMS_PD_MGMT_RND_ADDRESS_ADD_STATUS_ERR_NONE)
{
}
}
}
}
mdi.mgmt_info.rnd_address_state = HASIM_MGMT_RND_ADDRESS_VERIFIED;
}
}
}
}
/* RND Address Identifier check */
/* Process RND address identifier transitions. On in-use to not-in-use
transitions, return state variables to pre-RND initialized state for that
identifier. Check whether any list entries have been deleted and re-added
since last processing and do an available->unavailable->available transition.. */
for(i=0;i<16;i++)
{
if (mdi.mgmt_info.rnd_address_identifier[i] == -1)
{
if (mdi.mgmt_info.cache_state != HASIM_MGMT_CACHE_INVALID)
{
if (mdi.mgmt_info.rnd_address_cache[i].identifier != -1)
{
mdi.mgmt_info.rnd_address_identifier[i] =\
mdi.mgmt_info.rnd_address_cache[i].identifier;
}
}
}
else /* mdi.mgmt_info.rnd_address_identifier[i] != -1 */
{
if (mdi.mgmt_info.cache_state != HASIM_MGMT_CACHE_INVALID)
{
if (mdi.mgmt_info.rnd_address_cache[i].identifier == -1)
{
/* RND */
if ((mdi.rnd_info[i].receive_state & HASIM_RND_RECEIVE_REGISTERED)\
!= 0)
{
pr.session.type = PMS_SR_CALL_NO_RETURN;
pr.payload.type = PMS_PD_RND_STATUS;
pr.payload.data.rnd_status.identifier = \
mdi.mgmt_info.rnd_address_identifier[i];
pms_receive(&pr, 0, 0);
mdi.rnd_info[i].receive_state &= !HASIM_RND_RECEIVE_REGISTERED;
}
if ((mdi.rnd_info[i].receive_state & HASIM_RND_MD0_RECEIVE_REGISTERED)\
!= 0)
{
pr.session.type = PMS_SR_CALL_NO_RETURN;
pr.payload.type = PMS_PD_RND_MD0_STATUS;
pr.payload.data.rnd_status.identifier = \
mdi.mgmt_info.rnd_address_identifier[i];
pms_receive(&pr, 0, 0);
mdi.rnd_info[i].receive_state &= !HASIM_RND_MD0_RECEIVE_REGISTERED;
}
mdi.mgmt_info.rnd_address_identifier[i] = -1;
}
else
{
if (mdi.mgmt_info.rnd_address_identifier[i] != \
mdi.mgmt_info.rnd_address_cache[i].identifier)
{
/* RND */
if ((mdi.rnd_info[i].receive_state & HASIM_RND_RECEIVE_REGISTERED)\
!= 0)
{
pr.session.type = PMS_SR_CALL_NO_RETURN;
pr.payload.type = PMS_PD_RND_STATUS;
pr.payload.data.rnd_status.identifier = \
mdi.mgmt_info.rnd_address_identifier[i];
pms_receive(&pr, 0, 0);
mdi.rnd_info[i].receive_state &= !HASIM_RND_RECEIVE_REGISTERED;
}
if ((mdi.rnd_info[i].receive_state & \
HASIM_RND_MD0_RECEIVE_REGISTERED) != 0)
{
pr.session.type = PMS_SR_CALL_NO_RETURN;
pr.payload.type = PMS_PD_RND_MD0_STATUS;
pr.payload.data.rnd_status.identifier = \
mdi.mgmt_info.rnd_address_identifier[i];
pms_receive(&pr, 0, 0);
mdi.rnd_info[i].receive_state &= !HASIM_RND_MD0_RECEIVE_REGISTERED;
}
mdi.mgmt_info.rnd_address_identifier[i] =\
mdi.mgmt_info.rnd_address_cache[i].identifier;
}
}
}
}
}
/* Sync Check */
/* Policy: Sync update checked every SYNCCHECK_INTERVAL seconds.. */
if (mdi.mgmt_info.last_sync_check > HASIM_SYNCCHECK_INTERVAL)
{
/* Policy: Don't attempt a sync update if any async partial updates have
been received within SYNCCHECK_INTERVAL.. */
if (mdi.mgmt_info.last_update > HASIM_SYNCCHECK_INTERVAL)
{
/* Policy: Don't attempt a sync update if registration for async
updates have not succeeded.. */
if (mdi.mgmt_info.receive_state == HASIM_MGMT_RECEIVE_REGISTERED)
{
if (mdi.user_info.receive_state == HASIM_USER_RECEIVE_REGISTERED)
{
if (mdi.user_info.pms_view == HASIM_USER_PMS_VIEW_REACHABLE)
{
mdi.mgmt_info.last_sync_check = 0;
info_get_fail = 0;
/* Get MGMT base information.. */
ps.session.type = PMS_SR_CALL_RETURN_TIMED;
ps.session.info.crt.time = 0;
ps.payload.type = PMS_PD_MGMT_INFO_GET_EXECUTE;
if (pms_send(&ps, &pr) == 0)
{
if (pr.payload.data.mgmt_info_get_status.err == \
PMS_PD_MGMT_INFO_GET_STATUS_SUCCESS)
{
mgmt_state = pr.payload.data.mgmt_info_get_status.state;
}
else
{
info_get_fail = 1;
}
}
else
{
info_get_fail = 1;
}
/* Get MGMT rnd address information.. */
ps.session.type = PMS_SR_CALL_RETURN_TIMED;
ps.session.info.crt.time = 0;
ps.payload.type = PMS_PD_MGMT_RND_ADDRESS_INFO_GET_EXECUTE;
for(i=0;i<16;i++)
{
ps.payload.data.mgmt_rnd_address_info_get_execute.index = i;
if (pms_send(&ps, &pr) == 0)
{
if (pr.payload.data.mgmt_rnd_address_info_get_status.err == \
PMS_PD_MGMT_RND_ADDRESS_INFO_GET_STATUS_ERR_NONE)
{
rnd_address_identifier[i] = \
pr.payload.data.mgmt_rnd_address_info_get_status.identifier;
strncpy(&rnd_address_node_ip_address[i][0], \
&pr.payload.data.mgmt_rnd_address_info_get_status.node_ip_address[0], 20);
strncpy(&rnd_address_drawer_ip_address[i][0], \
&pr.payload.data.mgmt_rnd_address_info_get_status.drawer_ip_address[0], 20);
rnd_address_node_slot_number[i] = \
pr.payload.data.mgmt_rnd_address_info_get_status.node_slot_number;
}
else
{
info_get_fail = 1;
}
}
else
{
info_get_fail = 1;
}
}
/* Only mark MGMT update as successful if all pieces of data
were received successfully.. */
if (info_get_fail == 0)
{
mdi.mgmt_info.mgmt_state_cache = mgmt_state;
for(i=0;i<16;i++)
{
mdi.mgmt_info.rnd_address_cache[i].identifier = \
rnd_address_identifier[i];
strncpy(&mdi.mgmt_info.rnd_address_cache[i].node_ip_address[0], \
&rnd_address_node_ip_address[i][0], 20);
strncpy(&mdi.mgmt_info.rnd_address_cache[i].drawer_ip_address[0],\
&rnd_address_drawer_ip_address[i][0], 20);
mdi.mgmt_info.rnd_address_cache[i].node_slot_number = \
rnd_address_node_slot_number[i];
}
mdi.mgmt_info.last_update = 0;
}
}
}
}
}
else
{
mdi.mgmt_info.last_sync_check = 0;
}
}
/* Validity Check */
/* Process cache state validity transitions. The policy is on a MGMT cache
transition to invalid, return state variables to initial configuration.. */
if(mdi.mgmt_info.last_update < HASIM_CHECK_VALID_INTERVAL)
{
if (mdi.mgmt_info.cache_state != HASIM_MGMT_CACHE_VALID)
mdi.mgmt_info.cache_state = HASIM_MGMT_CACHE_VALID;
}
else if((mdi.mgmt_info.last_update >= HASIM_CHECK_VALID_INTERVAL && \
mdi.mgmt_info.last_update < HASIM_CHECK_INVALID_INTERVAL))
{
if (mdi.mgmt_info.cache_state == HASIM_MGMT_CACHE_VALID)
mdi.mgmt_info.cache_state = HASIM_MGMT_CACHE_OLD;
}
else if(mdi.mgmt_info.last_update >= HASIM_CHECK_INVALID_INTERVAL)
{
if (mdi.mgmt_info.cache_state == HASIM_MGMT_CACHE_OLD)
{
/* RND */
for(i=0;i<16;i++)
{
mdi.rnd_info[i].cache_state = HASIM_RND_CACHE_INVALID;
mdi.rnd_info[i].last_update = HASIM_CHECK_INVALID_INTERVAL;
if ((mdi.rnd_info[i].receive_state & HASIM_RND_RECEIVE_REGISTERED) != 0)
{
pr.session.type = PMS_SR_CALL_NO_RETURN;
pr.payload.type = PMS_PD_RND_STATUS;
pr.payload.data.rnd_status.identifier = \
mdi.mgmt_info.rnd_address_identifier[i];
pms_receive(&pr, 0, 0);
mdi.rnd_info[i].receive_state &= !HASIM_RND_RECEIVE_REGISTERED;
}
if ((mdi.rnd_info[i].receive_state & HASIM_RND_MD0_RECEIVE_REGISTERED)\
!= 0)
{
pr.session.type = PMS_SR_CALL_NO_RETURN;
pr.payload.type = PMS_PD_RND_MD0_STATUS;
pr.payload.data.rnd_status.identifier = \
mdi.mgmt_info.rnd_address_identifier[i];
pms_receive(&pr, 0, 0);
mdi.rnd_info[i].receive_state &= !HASIM_RND_MD0_RECEIVE_REGISTERED;
}
}
/* NODE*/
mdi.node_info.cache_state = HASIM_NODE_CACHE_INVALID;
mdi.node_info.last_update = HASIM_CHECK_INVALID_INTERVAL;
if (mdi.node_info.service_state == HASIM_NODE_SERVICE_STATE_ACTIVE)
{
mdi.node_info.service_state = HASIM_NODE_SERVICE_STATE_OFFLINE;
}
if (mdi.node_info.rg0_app_name_state ==\ HASIM_NODE_RG0_APP_NAME_REGISTERED)
{
mdi.node_info.rg0_app_name_state = HASIM_NODE_RG0_APP_NAME_UNREGISTERED;
}
if ((mdi.node_info.receive_state &\
HASIM_NODE_RG0_STATUS_RECEIVE_REGISTERED) != 0)
{
pr.session.type = PMS_SR_CALL_NO_RETURN;
pr.payload.type = PMS_PD_NODE_RG0_STATUS;
pms_receive(&pr, 0, 0);
mdi.node_info.receive_state &=\ !HASIM_NODE_RG0_STATUS_RECEIVE_REGISTERED;
}
if ((mdi.node_info.receive_state & \
HASIM_NODE_RG0_APP_STATE_SET_EXECUTE_RECEIVE_REGISTERED) != 0)
{
pr.session.type = PMS_SR_CALL_RETURN_TIMED;
pr.payload.type = PMS_PD_NODE_RG0_APP_STATE_SET_EXECUTE;
pms_receive(&pr, 0, 0);
mdi.node_info.receive_state &=\
!HASIM_NODE_RG0_APP_STATE_SET_EXECUTE_RECEIVE_REGISTERED;
}
/* MGMT */
mdi.mgmt_info.cache_state = HASIM_MGMT_CACHE_INVALID;
for(i=0;i<16;i++)
mdi.mgmt_info.rnd_address_identifier[i] = -1;
if (mdi.mgmt_info.rnd_address_state == HASIM_MGMT_RND_ADDRESS_VERIFIED)
{
mdi.mgmt_info.rnd_address_state = HASIM_MGMT_RND_ADDRESS_UNVERIFIED;
}
if (mdi.mgmt_info.pms_state == HASIM_MGMT_PMS_STATE_AVAILABLE)
{
mdi.mgmt_info.pms_state = HASIM_MGMT_PMS_STATE_UNAVAILABLE;
}
if (mdi.mgmt_info.receive_state == HASIM_MGMT_RECEIVE_REGISTERED)
{
pr.session.type = PMS_SR_CALL_NO_RETURN;
pr.payload.type = PMS_PD_MGMT_STATUS;
pms_receive(&pr, 0, 1);
mdi.mgmt_info.receive_state = HASIM_MGMT_RECEIVE_UNREGISTERED;
}
/* USER */
if (mdi.user_info.receive_state == HASIM_USER_RECEIVE_REGISTERED)
{
pr.session.type = PMS_SR_CALL_NO_RETURN;
pr.payload.type = PMS_PD_USER_STATUS;
pms_receive(&pr, 0, 0);
mdi.user_info.receive_state = HASIM_USER_RECEIVE_UNREGISTERED;
}
if (mdi.user_info.pms_view == HASIM_USER_PMS_VIEW_REACHABLE)
{
pms_disconnect();
mdi.user_info.pms_view = HASIM_USER_PMS_VIEW_UNREACHABLE;
}
}
}
}
|