mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-25 15:50:03 +02:00
WIP
This commit is contained in:
parent
8c279695de
commit
4155e301b8
@ -453,6 +453,8 @@ class CmdProxy {
|
||||
{"cyclesl", "triggersl"},
|
||||
{"clkdivider", "speed"},
|
||||
|
||||
/** dacs */
|
||||
|
||||
/* acquisition */
|
||||
{"busy", "clearbusy"},
|
||||
{"receiver", "rx_status"},
|
||||
@ -505,13 +507,13 @@ class CmdProxy {
|
||||
{"i_b", "im_b"},
|
||||
{"i_c", "im_c"},
|
||||
{"i_d", "im_d"},
|
||||
{"i_io", "im_io"}
|
||||
{"i_io", "im_io"},
|
||||
|
||||
/* Pattern */
|
||||
/* Moench */
|
||||
/* Advanced */
|
||||
/* Insignificant */
|
||||
|
||||
{"frameindex", "rx_frameindex"}
|
||||
|
||||
|
||||
};
|
||||
@ -523,6 +525,7 @@ class CmdProxy {
|
||||
//{"config", &CmdProxy::config},
|
||||
{"parameters", &CmdProxy::parameters},
|
||||
{"hostname", &CmdProxy::Hostname},
|
||||
{"virtual", &CmdProxy::VirtualServer},
|
||||
{"versions", &CmdProxy::Versions},
|
||||
{"packageversion", &CmdProxy::PackageVersion},
|
||||
{"clientversion", &CmdProxy::ClientVersion},
|
||||
@ -561,9 +564,10 @@ class CmdProxy {
|
||||
{"temp_sodr", &CmdProxy::temp_sodr},
|
||||
{"temp_fpgafl", &CmdProxy::temp_fpgafl},
|
||||
{"temp_fpgafr", &CmdProxy::temp_fpgafr},
|
||||
// dacs
|
||||
{"timing", &CmdProxy::timing},
|
||||
|
||||
/* dacs */
|
||||
|
||||
/* acquisition */
|
||||
{"clearbusy", &CmdProxy::clearbusy},
|
||||
{"rx_start", &CmdProxy::rx_start},
|
||||
@ -766,6 +770,7 @@ class CmdProxy {
|
||||
{"now", &CmdProxy::now},
|
||||
{"timestamp", &CmdProxy::timestamp},
|
||||
{"user", &CmdProxy::UserDetails},
|
||||
{"rx_frameindex", &CmdProxy::rx_frameindex},
|
||||
|
||||
|
||||
|
||||
@ -783,6 +788,7 @@ class CmdProxy {
|
||||
std::string ListCommands(int action);
|
||||
/* configuration */
|
||||
std::string Hostname(int action);
|
||||
std::string VirtualServer(int action);
|
||||
std::string FirmwareVersion(int action);
|
||||
std::string Versions(int action);
|
||||
std::string PackageVersion(int action);
|
||||
@ -930,11 +936,12 @@ class CmdProxy {
|
||||
GET_IND_COMMAND(temp_fpgafr, getTemperature, slsDetectorDefs::TEMPERATURE_FPGA3, " °C",
|
||||
"[n_value]\n\t[Eiger]Temperature of the left front end board fpga");
|
||||
|
||||
//dacs
|
||||
|
||||
INTEGER_COMMAND(timing, getTimingMode, setTimingMode, sls::StringTo<slsDetectorDefs::timingMode>,
|
||||
"[auto|trigger|gating|burst_trigger]\n\tTiming Mode of detector.\n\t[Jungfrau][Gotthard][Ctb] [auto|trigger]\n\t[Eiger] [auto|trigger|gating|burst_trigger]");
|
||||
|
||||
/* dacs */
|
||||
|
||||
|
||||
/* acquisition */
|
||||
|
||||
EXECUTE_SET_COMMAND_NOID(clearbusy, clearAcquiringFlag,
|
||||
@ -1361,6 +1368,9 @@ class CmdProxy {
|
||||
TIME_GET_COMMAND(timestamp, getMeasurementTime,
|
||||
"[(optional unit) ns|us|ms|s]\n\t[Jungfrau][CTB] Timestamp at a frame start.");
|
||||
|
||||
GET_COMMAND(rx_frameindex, getRxCurrentFrameIndex,
|
||||
"\n\tCurrent frame index received in receiver.");
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -49,6 +49,9 @@ class Detector {
|
||||
* and updates local detector cache */
|
||||
void setHostname(const std::vector<std::string> &hostname);
|
||||
|
||||
/** connects to n servers at local host starting at specific control port */
|
||||
void setVirtualDetectorServers(int numServers, int startingPort);
|
||||
|
||||
/** Gets shared memory ID */
|
||||
int getShmId() const;
|
||||
|
||||
@ -178,6 +181,33 @@ class Detector {
|
||||
/** [Gotthard][Jungfrau][CTB] */
|
||||
void setADCPhaseInDegrees(int value, Positions pos = {});
|
||||
|
||||
/** [Gotthard2] Hz */
|
||||
Result<int> getClockFrequency(int clkIndex, Positions pos = {});
|
||||
|
||||
/** [not implemented] Hz */
|
||||
void setClockFrequency(int clkIndex, int value, Positions pos = {});
|
||||
|
||||
/** [Gotthard2] */
|
||||
Result<int> getClockPhase(int clkIndex, Positions pos = {});
|
||||
|
||||
/** [Gotthard2] */
|
||||
void setClockPhase(int clkIndex, int value, Positions pos = {});
|
||||
|
||||
/** [Gotthard2] */
|
||||
Result<int> getMaxClockPhaseShift(int clkIndex, Positions pos = {});
|
||||
|
||||
/** [Gotthard2] */
|
||||
Result<int> getClockPhaseinDegrees(int clkIndex, Positions pos = {});
|
||||
|
||||
/** [Gotthard2] */
|
||||
void setClockPhaseinDegrees(int clkIndex, int value, Positions pos = {});
|
||||
|
||||
/** [Gotthard2] */
|
||||
Result<int> getClockDivider(int clkIndex, Positions pos = {});
|
||||
|
||||
/** [Gotthard2] */
|
||||
void setClockDivider(int clkIndex, int value, Positions pos = {});
|
||||
|
||||
Result<int> getHighVoltage(Positions pos = {}) const;
|
||||
|
||||
/**
|
||||
@ -1201,33 +1231,6 @@ class Detector {
|
||||
|
||||
Result<uint64_t> getRxCurrentFrameIndex(Positions pos = {}) const;
|
||||
|
||||
/** [Gotthard2] Hz */
|
||||
Result<int> getClockFrequency(int clkIndex, Positions pos = {});
|
||||
|
||||
/** [unknown] Hz */
|
||||
void setClockFrequency(int clkIndex, int value, Positions pos = {});
|
||||
|
||||
/** [Gotthard2] */
|
||||
Result<int> getClockPhase(int clkIndex, Positions pos = {});
|
||||
|
||||
/** [Gotthard2] */
|
||||
void setClockPhase(int clkIndex, int value, Positions pos = {});
|
||||
|
||||
/** [Gotthard2] */
|
||||
Result<int> getMaxClockPhaseShift(int clkIndex, Positions pos = {});
|
||||
|
||||
/** [Gotthard2] */
|
||||
Result<int> getClockPhaseinDegrees(int clkIndex, Positions pos = {});
|
||||
|
||||
/** [Gotthard2] */
|
||||
void setClockPhaseinDegrees(int clkIndex, int value, Positions pos = {});
|
||||
|
||||
/** [Gotthard2] */
|
||||
Result<int> getClockDivider(int clkIndex, Positions pos = {});
|
||||
|
||||
/** [Gotthard2] */
|
||||
void setClockDivider(int clkIndex, int value, Positions pos = {});
|
||||
|
||||
private:
|
||||
std::vector<int> getPortNumbers(int start_port);
|
||||
};
|
||||
|
@ -43,10 +43,8 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
||||
static std::string helpAcquire(int action);
|
||||
static std::string helpData(int action);
|
||||
static std::string helpFree(int action);
|
||||
static std::string helpHostname(int action);
|
||||
static std::string helpExitServer(int action);
|
||||
static std::string helpThreaded(int action);
|
||||
static std::string helpSettings(int action);
|
||||
static std::string helpSN(int action);
|
||||
static std::string helpDigiTest(int action);
|
||||
static std::string helpDAC(int action);
|
||||
@ -61,10 +59,8 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
||||
std::string cmdAcquire(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdData(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdFree(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdHostname(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdHelp(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdExitServer(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdSettings(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdSN(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdDigiTest(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdDAC(int narg, const char * const args[], int action, int detPos = -1);
|
||||
|
@ -169,6 +169,28 @@ std::string CmdProxy::Hostname(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::VirtualServer(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[n_servers] [starting_port_number]\n\tConnecs to n virtual server at local host starting at specific control port." << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
throw sls::RuntimeError("cannot get");
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() != 2) {
|
||||
WrongNumberOfParameters(2);
|
||||
}
|
||||
if (det_id != -1) {
|
||||
throw sls::RuntimeError("Cannot execute this at module level");
|
||||
}
|
||||
det->setVirtualDetectorServers(std::stoi(args[0]), std::stoi(args[1]));
|
||||
os << sls::ToString(args);
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::FirmwareVersion(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
@ -482,6 +504,7 @@ std::string CmdProxy::ClockDivider(int action) {
|
||||
}
|
||||
|
||||
|
||||
/* dacs */
|
||||
|
||||
/* acquisition */
|
||||
/* Network Configuration (Detector<->Receiver) */
|
||||
|
@ -33,6 +33,10 @@ void Detector::setHostname(const std::vector<std::string> &value) {
|
||||
pimpl->setHostname(value);
|
||||
}
|
||||
|
||||
void Detector::setVirtualDetectorServers(int numServers, int startingPort) {
|
||||
pimpl->setVirtualDetectorServers(numServers, startingPort);
|
||||
}
|
||||
|
||||
int Detector::getShmId() const { return pimpl->getMultiId(); }
|
||||
|
||||
std::string Detector::getPackageVersion() const {
|
||||
@ -201,6 +205,42 @@ void Detector::setADCPhaseInDegrees(int value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setSpeed, pos, defs::ADC_PHASE, value, 1);
|
||||
}
|
||||
|
||||
Result<int> Detector::getClockFrequency(int clkIndex, Positions pos) {
|
||||
return pimpl->Parallel(&slsDetector::getClockFrequency, pos, clkIndex);
|
||||
}
|
||||
|
||||
void Detector::setClockFrequency(int clkIndex, int value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setClockFrequency, pos, clkIndex, value);
|
||||
}
|
||||
|
||||
Result<int> Detector::getClockPhase(int clkIndex, Positions pos) {
|
||||
return pimpl->Parallel(&slsDetector::getClockPhase, pos, clkIndex, false);
|
||||
}
|
||||
|
||||
void Detector::setClockPhase(int clkIndex, int value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setClockPhase, pos, clkIndex, value, false);
|
||||
}
|
||||
|
||||
Result<int> Detector::getMaxClockPhaseShift(int clkIndex, Positions pos) {
|
||||
return pimpl->Parallel(&slsDetector::getMaxClockPhaseShift, pos, clkIndex);
|
||||
}
|
||||
|
||||
Result<int> Detector::getClockPhaseinDegrees(int clkIndex, Positions pos) {
|
||||
return pimpl->Parallel(&slsDetector::getClockPhase, pos, clkIndex, true);
|
||||
}
|
||||
|
||||
void Detector::setClockPhaseinDegrees(int clkIndex, int value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setClockPhase, pos, clkIndex, value, true);
|
||||
}
|
||||
|
||||
Result<int> Detector::getClockDivider(int clkIndex, Positions pos) {
|
||||
return pimpl->Parallel(&slsDetector::getClockDivider, pos, clkIndex);
|
||||
}
|
||||
|
||||
void Detector::setClockDivider(int clkIndex, int value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setClockDivider, pos, clkIndex, value);
|
||||
}
|
||||
|
||||
Result<int> Detector::getHighVoltage(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::setDAC, pos, -1, defs::HIGH_VOLTAGE,
|
||||
0);
|
||||
@ -1576,42 +1616,6 @@ Result<uint64_t> Detector::getRxCurrentFrameIndex(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getReceiverCurrentFrameIndex, pos);
|
||||
}
|
||||
|
||||
Result<int> Detector::getClockFrequency(int clkIndex, Positions pos) {
|
||||
return pimpl->Parallel(&slsDetector::getClockFrequency, pos, clkIndex);
|
||||
}
|
||||
|
||||
void Detector::setClockFrequency(int clkIndex, int value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setClockFrequency, pos, clkIndex, value);
|
||||
}
|
||||
|
||||
Result<int> Detector::getClockPhase(int clkIndex, Positions pos) {
|
||||
return pimpl->Parallel(&slsDetector::getClockPhase, pos, clkIndex, false);
|
||||
}
|
||||
|
||||
void Detector::setClockPhase(int clkIndex, int value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setClockPhase, pos, clkIndex, value, false);
|
||||
}
|
||||
|
||||
Result<int> Detector::getMaxClockPhaseShift(int clkIndex, Positions pos) {
|
||||
return pimpl->Parallel(&slsDetector::getMaxClockPhaseShift, pos, clkIndex);
|
||||
}
|
||||
|
||||
Result<int> Detector::getClockPhaseinDegrees(int clkIndex, Positions pos) {
|
||||
return pimpl->Parallel(&slsDetector::getClockPhase, pos, clkIndex, true);
|
||||
}
|
||||
|
||||
void Detector::setClockPhaseinDegrees(int clkIndex, int value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setClockPhase, pos, clkIndex, value, true);
|
||||
}
|
||||
|
||||
Result<int> Detector::getClockDivider(int clkIndex, Positions pos) {
|
||||
return pimpl->Parallel(&slsDetector::getClockDivider, pos, clkIndex);
|
||||
}
|
||||
|
||||
void Detector::setClockDivider(int clkIndex, int value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setClockDivider, pos, clkIndex, value);
|
||||
}
|
||||
|
||||
std::vector<int> Detector::getPortNumbers(int start_port) {
|
||||
int num_sockets_per_detector = 1;
|
||||
switch (getDetectorType({}).squash()) {
|
||||
|
@ -165,13 +165,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdFree;
|
||||
++i;
|
||||
|
||||
/*! \page config
|
||||
- <b>virtual [n] [p]</b> \c connects to n virtual detector servers at local host starting at port p \c Returns the list of the hostnames of the multi-detector structure. \c (string)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName = "virtual";
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdHostname;
|
||||
++i;
|
||||
|
||||
|
||||
/*! \page config
|
||||
\section configstatus Status
|
||||
@ -284,20 +277,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
||||
*/
|
||||
|
||||
|
||||
/*! \page settings
|
||||
- <b>trimbits [fname] </b> loads/stores the trimbits to/from the detector. If no extension is specified, the serial number of each module will be attached. \c Returns \c (string) fname
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName = "trimbits";
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdSettings;
|
||||
++i;
|
||||
|
||||
/*! \page settings
|
||||
- <b>trimval [i]</b> sets all trimbits to i. Used in EIGER only. \c Returns \c (int)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName = "trimval";
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdSettings;
|
||||
++i;
|
||||
|
||||
/* pots */
|
||||
/*! \page settings
|
||||
\section settingsdacs DACs
|
||||
@ -790,13 +769,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdReceiver;
|
||||
++i;
|
||||
|
||||
/*! \page receiver
|
||||
- <b>frameindex [i]</b> gets the current frame index of receiver. Average of all for multi-detector command. Only get! \c Returns \c (int)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName = "frameindex";
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdReceiver;
|
||||
++i;
|
||||
|
||||
|
||||
/* pattern generator */
|
||||
|
||||
@ -965,47 +937,6 @@ std::string slsDetectorCommand::helpFree(int action) {
|
||||
return std::string("free \t frees the shared memory\n");
|
||||
}
|
||||
|
||||
std::string slsDetectorCommand::cmdHostname(int narg, const char * const args[], int action, int detPos) {
|
||||
#ifdef VERBOSE
|
||||
std::cout << std::string("Executing command ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
||||
#endif
|
||||
|
||||
if (action == HELP_ACTION) {
|
||||
return helpHostname(HELP_ACTION);
|
||||
}
|
||||
|
||||
if (action == PUT_ACTION) {
|
||||
if (detPos >= 0) {
|
||||
return std::string("Wrong usage - setting hostname/virtual only from "
|
||||
"multiDetector level");
|
||||
}
|
||||
|
||||
if (cmd == "virtual") {
|
||||
int port = -1;
|
||||
int numDetectors = 0;
|
||||
if (!sscanf(args[1], "%d", &numDetectors)) {
|
||||
throw sls::RuntimeError("Cannot scan number of detector servers from virtual command\n");
|
||||
}
|
||||
if (!sscanf(args[2], "%d", &port)) {
|
||||
throw sls::RuntimeError("Cannot scan port from virtual command\n");
|
||||
}
|
||||
myDet->setVirtualDetectorServers(numDetectors, port);
|
||||
} else {
|
||||
throw sls::RuntimeError("unknown command\n");
|
||||
}
|
||||
}
|
||||
return myDet->getHostname(detPos);
|
||||
}
|
||||
|
||||
std::string slsDetectorCommand::helpHostname(int action) {
|
||||
std::ostringstream os;
|
||||
|
||||
if (action == PUT_ACTION || action == HELP_ACTION) {
|
||||
os << std::string("virtual [n] [p]\t connects to n virtual detector servers at local host starting at port p \n");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
|
||||
std::string slsDetectorCommand::cmdHelp(int narg, const char * const args[], int action, int detPos) {
|
||||
#ifdef VERBOSE
|
||||
@ -1086,38 +1017,6 @@ std::string slsDetectorCommand::helpThreaded(int action) {
|
||||
|
||||
|
||||
|
||||
std::string slsDetectorCommand::cmdSettings(int narg, const char * const args[], int action, int detPos) {
|
||||
|
||||
if (action == HELP_ACTION)
|
||||
return helpSettings(action);
|
||||
int val = -1; //ret,
|
||||
char ans[1000];
|
||||
|
||||
|
||||
if (cmd == "trimval") {
|
||||
if (action == PUT_ACTION) {
|
||||
if (sscanf(args[1], "%d", &val))
|
||||
myDet->setAllTrimbits(val, detPos);
|
||||
else
|
||||
return std::string("invalid trimbit value ") + cmd;
|
||||
}
|
||||
sprintf(ans, "%d", myDet->setAllTrimbits(-1, detPos));
|
||||
return ans;
|
||||
}
|
||||
return std::string("unknown settings command ") + cmd;
|
||||
}
|
||||
|
||||
std::string slsDetectorCommand::helpSettings(int action) {
|
||||
|
||||
std::ostringstream os;
|
||||
if (action == PUT_ACTION || action == HELP_ACTION) {
|
||||
os << "trimval i \n sets all the trimbits to i" << std::endl;
|
||||
}
|
||||
if (action == GET_ACTION || action == HELP_ACTION) {
|
||||
os << "trimval \n returns the value all trimbits are set to. If they are different, returns -1." << std::endl;
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string slsDetectorCommand::cmdSN(int narg, const char * const args[], int action, int detPos) {
|
||||
|
||||
@ -1576,14 +1475,6 @@ std::string slsDetectorCommand::cmdReceiver(int narg, const char * const args[],
|
||||
}
|
||||
}
|
||||
|
||||
else if (cmd == "frameindex") {
|
||||
if (action == PUT_ACTION)
|
||||
return std::string("cannot put");
|
||||
else {
|
||||
sprintf(answer, "%lu", myDet->getReceiverCurrentFrameIndex(detPos));
|
||||
return std::string(answer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return std::string("could not decode command");
|
||||
@ -1595,10 +1486,6 @@ std::string slsDetectorCommand::helpReceiver(int action) {
|
||||
if (action == PUT_ACTION || action == HELP_ACTION) {
|
||||
os << "resetframescaught [any value] \t resets frames caught by receiver" << std::endl;
|
||||
|
||||
}
|
||||
if (action == GET_ACTION || action == HELP_ACTION) {
|
||||
os << "frameindex \t returns the current frame index of receiver(average for multi)" << std::endl;
|
||||
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
@ -9,6 +9,11 @@
|
||||
auto GET = slsDetectorDefs::GET_ACTION;
|
||||
auto PUT = slsDetectorDefs::PUT_ACTION;
|
||||
|
||||
TEST_CASE("rx_frameindex", "[.cmd]") {
|
||||
REQUIRE_NOTHROW(multiSlsDetectorClient("rx_frameindex", GET));
|
||||
REQUIRE_THROWS(multiSlsDetectorClient("rx_frameindex bla", PUT));
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("user", "[.cmd]") {
|
||||
REQUIRE_NOTHROW(multiSlsDetectorClient("user", GET));
|
||||
|
Loading…
x
Reference in New Issue
Block a user