/** * Change DHCP mode to Static. * Even though DHCP was enabled, it can be changed to Static mode through this function * * @param net The addresses you want to set as static addresses * - NULL parameter or NULL member variable will be ignored and internal storage addresses will be used * \n and these address will be returned in this net parameter (if not NULL) */ void dhcp_static_mode(wiz_NetInfo *net) { di.action = DHCP_ACT_NONE; SET_STATE(DHCP_STATE_INIT); if(net != NULL) { if(net->ip[0]!=0 || net->ip[1]!=0 || net->ip[2]!=0 || net->ip[3]!=0) memcpy(storage.ip, net->ip, 4); else memcpy(net->ip, storage.ip, 4); if(net->sn[0]!=0 || net->sn[1]!=0 || net->sn[2]!=0 || net->sn[3]!=0) memcpy(storage.sn, net->sn, 4); else memcpy(net->sn, storage.sn, 4); if(net->gw[0]!=0 || net->gw[1]!=0 || net->gw[2]!=0 || net->gw[3]!=0) memcpy(storage.gw, net->gw, 4); else memcpy(net->gw, storage.gw, 4); if(net->dns[0]!=0 || net->dns[1]!=0 || net->dns[2]!=0 || net->dns[3]!=0) memcpy(storage.dns, net->dns, 4); else memcpy(net->dns, storage.dns, 4); net->dhcp = NETINFO_STATIC; SetNetInfo(net); } else { SetNetInfo(&storage); memset(&workinfo, 0, sizeof(workinfo)); workinfo.dhcp = NETINFO_STATIC; SetNetInfo(&workinfo); } if(dhcp_alarm) alarm_del(dhcp_alarm_cb, -1); //send_checker_NB(); }
void mnp_alarm_instance_raise (MnpAlarmInstance *alarm) { MnpAlarmInstancePrivate *priv = ALARM_INSTANCE_PRIVATE(alarm); MnpAlarmItem *item = priv->item; show_notification(alarm); if (item->sound == MNP_SOUND_BEEP) gdk_beep(); else if(item->sound == MNP_SOUND_MUSIC) { play_music(); } if (!priv->repeat) { /* raised alarm should be deleted */ alarm_del(priv->item); } else { g_signal_emit (alarm, signals[ALARM_CHANGED], 0); } }
int8 dhcp_static_mode(wiz_NetInfo *net) { wiz_NetInfo cur; if(net == NULL) { DBG("NULL arg"); return RET_NOK; } GetNetInfo(&cur); if(cur.DHCP == NETINFO_STATIC) { DBG("Already Static Mode"); return RET_NOK; } di.action = DHCP_ACT_NONE; SET_STATE(DHCP_STATE_INIT); if(net->IP[0]!=0 || net->IP[1]!=0 || net->IP[2]!=0 || net->IP[3]!=0) memcpy(storage.IP, net->IP, 4); else memcpy(net->IP, storage.IP, 4); if(net->SN[0]!=0 || net->SN[1]!=0 || net->SN[2]!=0 || net->SN[3]!=0) memcpy(storage.SN, net->SN, 4); else memcpy(net->SN, storage.SN, 4); if(net->GW[0]!=0 || net->GW[1]!=0 || net->GW[2]!=0 || net->GW[3]!=0) memcpy(storage.GW, net->GW, 4); else memcpy(net->GW, storage.GW, 4); if(net->DNS[0]!=0 || net->DNS[1]!=0 || net->DNS[2]!=0 || net->DNS[3]!=0) memcpy(storage.DNS, net->DNS, 4); else memcpy(net->DNS, storage.DNS, 4); net->DHCP = NETINFO_STATIC; SetNetInfo(net); if(dhcp_alarm) alarm_del(dhcp_alarm_cb, -1); //send_checker_NB(); return RET_OK; }