int image_update() { struct conn *conn = get_conn(); if (conn->capwap_state != CW_STATE_CONFIGURE) { cw_log(LOG_ERR, "Current state not image update"); return 0; } const char *ii = "/c1130"; mbag_set_bstrv(conn->outgoing, CW_ITEM_IMAGE_IDENTIFIER, CW_VENDOR_ID_CISCO, (uint8_t *) ii, strlen(ii)); int rc = cw_send_request(conn, CW_MSG_IMAGE_DATA_REQUEST); if (rc < 0) { } if (rc != 0) { cw_log(LOG_ERR, "AC rejected Image Data Request with code: %d - %s", rc, cw_strresult(rc)); return 0; } cw_dbg(DBG_INFO,"Ready to receive image ..."); conn->capwap_state=CW_STATE_IMAGE_DATA; rc=-11; while (conn->capwap_state == CW_STATE_IMAGE_DATA) { rc = cw_read_messages(conn); if (rc < 0) { if (errno != EAGAIN) break; } } printf("RC: %d %s\n",rc,strerror(errno)); return 1; }
static void do_update(struct conn * conn) { if (!update) return; update=0; mbag_t result = mbag_create(); update_radios(conn,result); cw_dbg(DBG_INFO, "Saving configuration ..."); cfg_to_json(); /* Change State ... */ int rc = cw_send_request(conn,CW_MSG_CHANGE_STATE_EVENT_REQUEST); if ( !cw_rcok(rc) ) { cw_strresult(rc); return ; } }
int changestate() { struct conn * conn = get_conn(); /* Update operational states, so they will be included in the change Change State Event Request message. */ cw_radio_update_oper_states(conn->radios,0); /* Change State ... */ int rc = cw_send_request(conn,CW_MSG_CHANGE_STATE_EVENT_REQUEST); if ( !cw_rcok(rc) ) { cw_strresult(rc); return 0; } return 1; }