MCPcopy Create free account
hub / github.com/HomeSpan/HomeSpan / setValidValues

Method setValidValues

src/HomeSpan.cpp:2727–2760  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2725///////////////////////////////
2726
2727SpanCharacteristic *SpanCharacteristic::setValidValues(int n, ...){
2728
2729 String s="[";
2730 va_list vl;
2731 va_start(vl,n);
2732 for(int i=0;i<n;i++){
2733 switch(format){
2734 case FORMAT::UINT8:
2735 s+=(uint8_t)va_arg(vl,uint32_t);
2736 break;
2737 case FORMAT::UINT16:
2738 s+=(uint16_t)va_arg(vl,uint32_t);
2739 break;
2740 case FORMAT::UINT32:
2741 s+=(uint32_t)va_arg(vl,uint32_t);
2742 break;
2743 case FORMAT::INT:
2744 s+=(int)va_arg(vl,uint32_t);
2745 break;
2746 default:
2747 setValidValuesError=true;
2748 return(this);
2749 }
2750 if(i!=n-1)
2751 s+=",";
2752 }
2753 va_end(vl);
2754 s+="]";
2755
2756 validValues=(char *)HS_REALLOC(validValues, strlen(s.c_str()) + 1);
2757 strcpy(validValues,s.c_str());
2758
2759 return(this);
2760}
2761
2762///////////////////////////////
2763

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected