function remove_accesspoint($json)
{
    $database = new Database();
    $apTbl = $database->getAccessPointTbl();
    $success = $apTbl->remove($json->{'AccessPointId'});
    if ($success) {
        echo_rm_suc_msg();
    } else {
        echo_rm_unsuc_msg();
    }
}
function save_accesspoint($json)
{
    $database = new Database();
    $apTbl = $database->getAccessPointTbl();
    $isExist = $apTbl->isExisted($json->{'BSSID'});
    if ($isExist) {
        echo_dup_bssid_msg();
    }
    $ap = new AccessPoint();
    $ap->Name = $json->{'Name'};
    $ap->BSSID = $json->{'BSSID'};
    $ap->ShopId = $json->{'ShopId'};
    $success = $apTbl->save($ap);
    if ($success) {
        echo_save_suc_msg();
    } else {
        echo_save_unsuc_msg();
    }
}
function get_access_point($json)
{
    $database = new Database();
    $apTbl = $database->getAccessPointTbl();
    $aps = $apTbl->getAllByShopId($json->{'ShopId'});
    //print_r($aps);
    $ret_array = array();
    $cnt = 0;
    foreach ($aps as $ap) {
        $ret_array[$cnt++] = array("AccessPointId" => $ap->AccessPointId, "BSSID" => $ap->BSSID, "Name" => $ap->Name, "ShopId" => $ap->ShopId);
    }
    echo "{Access point : " . json_encode($ret_array) . "}";
    exit;
}