2496 float newDeadband = 0;
2499 IntItemNode* intNode = 0;
2501 unsigned int count = 0;
2503 if ((*issueParam).size <=
sizeof(newDeadband)) {
2504 (*issueParam).size = 0;
2506 "FeeServer command for setting dead band contained invalid parameter.",
2508 return FEE_INVALID_PARAM;
2511 nameLength = (*issueParam).size -
sizeof(newDeadband);
2513 if (nameLength <= 0) {
2514 (*issueParam).size = 0;
2516 "FeeServer command for setting dead band contained no service name.",
2518 return FEE_INVALID_PARAM;
2521 itemName = (
char*)
malloc(nameLength + 1);
2522 if (itemName == 0) {
2523 (*issueParam).size = 0;
2524 return FEE_INSUFFICIENT_MEMORY;
2527 memcpy(&newDeadband, (*issueParam).command,
sizeof(newDeadband));
2528 memcpy(itemName, (*issueParam).command +
sizeof(newDeadband), nameLength);
2529 itemName[nameLength] = 0;
2531 if (itemName[0] !=
'*') {
2538 if ((node == 0) && (intNode == 0)) {
2540 msg[
sprintf(msg,
"Item %s not found in list.", itemName)] = 0;
2543 printf(
"Item %s not found in list.\n", itemName);
2548 (*issueParam).size = 0;
2550 "FeeServer command for setting dead band contained invalid parameter.",
2552 return FEE_INVALID_PARAM;
2556 node->threshold = newDeadband / 2;
2558 intNode->threshold = newDeadband / 2;
2561 printf(
"Set deadband on item %s to %f.\n", itemName, newDeadband);
2564 msg[
sprintf(msg,
"New dead band (%f) is set for item %s.",
2565 newDeadband, itemName)] = 0;
2573 printf(
"Set deadband for %d items (%s) to %f.\n", count, itemName, newDeadband);
2576 msg[
sprintf(msg,
"New dead band (%f) is set for %d items (%s).",
2577 newDeadband, count, itemName)] = 0;
2582 (*issueParam).size = 0;
ItemNode * findItem(char *name)
unsigned int setDeadbandBroadcast(char *name, float newDeadbandBC)
void createLogMessage(unsigned int type, char *description, char *origin)
IntItemNode * findIntItem(char *name)
sprintf(name1,"NewService%d", i)