sicshipacaba.c
SICS-418 Make sure hnotify sends messages as hdbevents when using the JSON protocl site_ansto/instrument/config/hmm/hmm_object.tcl Initialise the hmm object to make sure the read type is set. nxscripts_common_1.tcl Set the read type when saving the hmm data. server_config.tcl Fix the autosave command so that you can enable/disable autosave while the histogram memory is running. protocol.c Reduce noise in log files when using the JSON protocol. Don't log messages generated during macro execution (ie within a TCL proc). motor.c:MotorStatus Abort the current operation, the scan command and batch files when a motor object returns a hardware fault status value. motor_dmc2280.c set driver status to HWFault when the driver is in the error state. r3251 | ffr | 2011-09-23 08:49:00 +1000 (Fri, 23 Sep 2011) | 25 lines
This commit is contained in:
committed by
Douglas Clowes
parent
c765c33f6d
commit
d778dd2bfe
4
motor.c
4
motor.c
@@ -395,6 +395,10 @@ static void handleMoveCallback(pMotor self, SConnection *pCon)
|
||||
{
|
||||
handleMoveCallback(self,pCon);
|
||||
}
|
||||
if(status == HWFault) {
|
||||
SCSetInterrupt(pCon,eAbortBatch);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
@@ -703,9 +703,11 @@ int SCWriteJSON_String(SConnection *pCon, char *pBuffer, int iOut)
|
||||
{
|
||||
iRet = 0;
|
||||
}
|
||||
sprintf(pBueffel,"Next line intended for socket: %d",iRet);
|
||||
SICSLogWrite(pBueffel,eInternal);
|
||||
SICSLogWrite(pBuffer,iOut);
|
||||
if(pCon->iMacro != 1) {
|
||||
sprintf(pBueffel,"Next line intended for socket: %d",iRet);
|
||||
SICSLogWrite(pBueffel,eInternal);
|
||||
SICSLogWrite(pBuffer,iOut);
|
||||
}
|
||||
|
||||
/* write to commandlog if user or manager privilege */
|
||||
if(SCGetRights(pCon) <= usUser)
|
||||
|
||||
@@ -339,13 +339,14 @@ typedef struct {
|
||||
int internalID;
|
||||
}HdbCBInfo;
|
||||
|
||||
static Protocol isJSON(SConnection *pCon) {
|
||||
static Protocol isJSON(SConnection *pCon, int notify) {
|
||||
char proName[128];
|
||||
void *pData;
|
||||
|
||||
if(SCinMacro(pCon)){
|
||||
if(notify == 0 && SCinMacro(pCon)){
|
||||
return normal_protocol;
|
||||
}
|
||||
|
||||
pData = FindCommandData(pServ->pSics, "protocol","Protocol");
|
||||
ProtocolGet(pCon, pData, proName, 128);
|
||||
if (strcmp(proName, "json") == 0)
|
||||
@@ -537,7 +538,7 @@ static hdbCallbackReturn SICSNotifyCallback(pHdb node, void *userData,
|
||||
|
||||
pPath = GetHipadabaPath(node);
|
||||
result = CreateDynString(128,128);
|
||||
if ((protocol = isJSON(cbInfo->pCon)) == 1)
|
||||
if ((protocol = isJSON(cbInfo->pCon, 1)) == 1)
|
||||
outCode = eHdbEvent;
|
||||
else
|
||||
outCode = eEvent;
|
||||
@@ -654,7 +655,7 @@ static hdbCallbackReturn TreeChangeCallback(pHdb node, void *userData,
|
||||
return hdbAbort;
|
||||
}
|
||||
path = GetHipadabaPath(node);
|
||||
if ((protocol = isJSON(cbInfo->pCon)) == 1)
|
||||
if ((protocol = isJSON(cbInfo->pCon, 1)) == 1)
|
||||
outCode = eHdbEvent;
|
||||
else
|
||||
outCode = eEvent;
|
||||
@@ -2344,7 +2345,7 @@ static int GetHdbNode(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
SCWrite(pCon,"ERROR: out of memory formatting data",eError);
|
||||
return 0;
|
||||
}
|
||||
if ((protocol = isJSON(pCon)) == 1)
|
||||
if ((protocol = isJSON(pCon, 0)) == 1)
|
||||
outCode = eHdbEvent;
|
||||
else
|
||||
outCode = eEvent;
|
||||
@@ -2386,7 +2387,7 @@ static int GetHdbVal(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
SCWrite(pCon,"ERROR: out of memory formatting data",eError);
|
||||
return 0;
|
||||
} else {
|
||||
if ((protocol = isJSON(pCon)) == 1)
|
||||
if ((protocol = isJSON(pCon, 0)) == 1)
|
||||
outCode = eHdbEvent;
|
||||
else
|
||||
outCode = eEvent;
|
||||
@@ -2672,7 +2673,7 @@ static int ListHdbNode(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
} else if(strcmp(argv[1],"-cli") == 0){
|
||||
listData = formatClientList(node);
|
||||
} else {
|
||||
if ((protocol = isJSON(pCon)) == 1) {
|
||||
if ((protocol = isJSON(pCon, 0)) == 1) {
|
||||
listData = formatJSONList(node);
|
||||
outCode = eHdbEvent;
|
||||
} else {
|
||||
|
||||
@@ -173,7 +173,6 @@ proc ::histogram_memory::hmm_set_read_type {type} {
|
||||
set hmm_ext [select_read_type $type]
|
||||
}
|
||||
$HMOBJ configure hmm_ext $hmm_ext
|
||||
$HMOBJ init
|
||||
} msg ] {
|
||||
return -code error "([info level 0]) $msg"
|
||||
}
|
||||
|
||||
@@ -861,6 +861,7 @@ proc ::nexus::histmem::save {hm nxalias hpath data_type filestatus args} {
|
||||
} elseif { $max_period > 0} {
|
||||
$HMOBJ configure read_data_period_number $point
|
||||
}
|
||||
::histogram_memory::hmm_set_read_type [hgetpropval $::histogram_memory::HP_HMM datatype_savelist]
|
||||
nxscript putslab $nxalias [join [list $point $hmmslabstart ]] [join [list 1 $hmmslabend]] $HMOBJ 0 $datsize 1
|
||||
#####
|
||||
if {$filestatus == "newfile"} {
|
||||
|
||||
@@ -233,6 +233,8 @@ proc server_set_sobj_attributes {} {
|
||||
}
|
||||
|
||||
proc server_init {} {
|
||||
global AUTOSAVE_STATE
|
||||
|
||||
set catch_status [ catch {
|
||||
::source::isc_initialize
|
||||
::counter::isc_initialize
|
||||
@@ -259,8 +261,7 @@ proc server_init {} {
|
||||
sicslist setatt sics_suid nxsave true
|
||||
sicslist setatt sics_suid long_name sics_suid
|
||||
|
||||
VarMake AUTOSAVE_STATE Text user
|
||||
AUTOSAVE_STATE "DISABLED"
|
||||
set AUTOSAVE_STATE "DISABLED"
|
||||
|
||||
if [file exists ../extraconfig.tcl] {
|
||||
fileeval ../extraconfig.tcl
|
||||
@@ -273,8 +274,10 @@ proc server_init {} {
|
||||
}
|
||||
|
||||
proc doAutosave {} {
|
||||
global AUTOSAVE_STATE
|
||||
|
||||
# Reset the AUTOSAVE_STATE variable in case some naughty user sets it directly
|
||||
AUTOSAVE_STATE "ENABLED"
|
||||
set AUTOSAVE_STATE "ENABLED"
|
||||
set HMSTATE [SplitReply [hmm configure daq]]
|
||||
set FSTATE [SplitReply [file_status]]
|
||||
#broadcast CALLED: [info level 0], HMSTATE = $HMSTATE, FSTATE = $FSTATE
|
||||
@@ -286,20 +289,25 @@ proc doAutosave {} {
|
||||
}
|
||||
publish doAutosave user
|
||||
proc autosave { {interval 300} } {
|
||||
set stateVal [SplitReply [AUTOSAVE_STATE]]
|
||||
global AUTOSAVE_STATE
|
||||
|
||||
if {$interval == "check"} {
|
||||
return [AUTOSAVE_STATE]
|
||||
if { $AUTOSAVE_STATE == "ENABLED" } {
|
||||
return "AUTOSAVE $AUTOSAVE_STATE [sicspoll intervall doAutosave]"
|
||||
} else {
|
||||
return "AUTOSAVE $AUTOSAVE_STATE"
|
||||
}
|
||||
} elseif {[string is integer $interval]} {
|
||||
if {$interval <= 0} {
|
||||
if { $stateVal == "ENABLED" } {
|
||||
if { $AUTOSAVE_STATE == "ENABLED" } {
|
||||
sicspoll del doAutosave
|
||||
AUTOSAVE_STATE "DISABLED"
|
||||
set AUTOSAVE_STATE "DISABLED"
|
||||
}
|
||||
} else {
|
||||
if {$stateVal == "DISABLED"} {
|
||||
if {$AUTOSAVE_STATE == "DISABLED"} {
|
||||
sicspoll add doAutosave script $interval doAutosave
|
||||
sicspoll listen
|
||||
AUTOSAVE_STATE "ENABLED"
|
||||
# sicspoll listen # WARNING:When the listening client exits it leaves SICSPOLL task with a corrupt connection object.
|
||||
set AUTOSAVE_STATE "ENABLED"
|
||||
} else {
|
||||
sicspoll intervall doAutosave $interval
|
||||
}
|
||||
|
||||
@@ -2655,6 +2655,7 @@ static void DMCState_Error(pDMC2280Driv self, pEvtEvent event) {
|
||||
break;
|
||||
}
|
||||
unhandled_event(self, event);
|
||||
self->driver_status = HWFault;
|
||||
self->errorCode = STATEERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user