void ATEMclient::_parseGetCommands(const char *cmdStr)  {
        uint8_t mE;
  uint16_t videoSource;
  long temp;
  uint8_t readBytesForTlSr;

  if (!strcmp_P(cmdStr, PSTR("AMLv")))  {
    _readToPacketBuffer(36);
  } else if (!strcmp_P(cmdStr, PSTR("TlSr"))) {
    readBytesForTlSr = ((ATEM_packetBufferLength-2)/3)*3+2;
    _readToPacketBuffer(readBytesForTlSr);
  } else {
    _readToPacketBuffer();  // Default
  }

  if(!strcmp_P(cmdStr, PSTR("PrgI"))) {
    
    mE = _packetBuffer[0];
    if (mE<=1) {
      #if ATEM_debug
      temp = atemProgramInputVideoSource[mE];
      #endif          
      atemProgramInputVideoSource[mE] = word(_packetBuffer[2], _packetBuffer[3]);
      #if ATEM_debug
      if ((_serialOutput==0x80 && atemProgramInputVideoSource[mE]!=temp) || (_serialOutput==0x81 && !hasInitialized())) {
        Serial.print(F("atemProgramInputVideoSource[mE=")); Serial.print(mE); Serial.print(F("] = "));
        Serial.println(atemProgramInputVideoSource[mE]);
      }
      #endif
      
    }
  } else 
  if(!strcmp_P(cmdStr, PSTR("PrvI"))) {
    
    mE = _packetBuffer[0];
    if (mE<=1) {
      #if ATEM_debug
      temp = atemPreviewInputVideoSource[mE];
      #endif          
      atemPreviewInputVideoSource[mE] = word(_packetBuffer[2], _packetBuffer[3]);
      #if ATEM_debug
      if ((_serialOutput==0x80 && atemPreviewInputVideoSource[mE]!=temp) || (_serialOutput==0x81 && !hasInitialized())) {
        Serial.print(F("atemPreviewInputVideoSource[mE=")); Serial.print(mE); Serial.print(F("] = "));
        Serial.println(atemPreviewInputVideoSource[mE]);
      }
      #endif
      
    }
  }
}
Ejemplo n.º 2
0
void ATEMmin::_parseGetCommands(const char *cmdStr)	{
	uint8_t mE,keyer,aUXChannel;
	uint16_t sources;
	long temp;
	uint8_t readBytesForTlSr;
	
	_readToPacketBuffer(_cmdLength);
	
	
	if (!strcmp_P(cmdStr, PSTR("_pin")))	{
		if (_packetBuffer[5]=='T')	{
				_ATEMmodel = 0;
		} else
		if (_packetBuffer[5]=='1')	{
				_ATEMmodel = _packetBuffer[29]=='4' ? 4 : 1;
		} else
		if (_packetBuffer[5]=='2')	{
			_ATEMmodel = _packetBuffer[29]=='4' ? 5 : 2;
		} else
		if (_packetBuffer[5]=='P')	{
				_ATEMmodel = 3;
		} 
		
		#if ATEM_debug
		if (_serialOutput>0)	{
			Serial.print(F("Switcher type: "));
			Serial.print(_ATEMmodel);
			switch(_ATEMmodel)	{
				case 0:
					Serial.println(F(" - TeleVision Studio"));
				break;
				case 1:
					Serial.println(F(" - ATEM 1 M/E"));
				break;
				case 2:
					Serial.println(F(" - ATEM 2 M/E"));
				break;
				case 3:
					Serial.println(F(" - ATEM Production Studio 4K"));
				break;
				case 4:
					Serial.println(F(" - ATEM 1 M/E 4K"));
				break;
				case 5:
					Serial.println(F(" - ATEM 2 M/E 4K"));
				break;
			}
		}
		#endif
	}

	



	
	if(!strcmp_P(cmdStr, PSTR("PrgI"))) {
		
		mE = _packetBuffer[0];
		if (mE<=1) {
			#if ATEM_debug
			temp = atemProgramInputVideoSource[mE];
			#endif					
			atemProgramInputVideoSource[mE] = word(_packetBuffer[2], _packetBuffer[3]);
			#if ATEM_debug
			if ((_serialOutput==0x80 && atemProgramInputVideoSource[mE]!=temp) || (_serialOutput==0x81 && !hasInitialized()))	{
				Serial.print(F("atemProgramInputVideoSource[mE=")); Serial.print(mE); Serial.print(F("] = "));
				Serial.println(atemProgramInputVideoSource[mE]);
			}
			#endif
			
		}
	} else 
	if(!strcmp_P(cmdStr, PSTR("PrvI"))) {
		
		mE = _packetBuffer[0];
		if (mE<=1) {
			#if ATEM_debug
			temp = atemPreviewInputVideoSource[mE];
			#endif					
			atemPreviewInputVideoSource[mE] = word(_packetBuffer[2], _packetBuffer[3]);
			#if ATEM_debug
			if ((_serialOutput==0x80 && atemPreviewInputVideoSource[mE]!=temp) || (_serialOutput==0x81 && !hasInitialized()))	{
				Serial.print(F("atemPreviewInputVideoSource[mE=")); Serial.print(mE); Serial.print(F("] = "));
				Serial.println(atemPreviewInputVideoSource[mE]);
			}
			#endif
			
		}
	} else 
	if(!strcmp_P(cmdStr, PSTR("TrPs"))) {
		
		mE = _packetBuffer[0];
		if (mE<=1) {
			#if ATEM_debug
			temp = atemTransitionInTransition[mE];
			#endif					
			atemTransitionInTransition[mE] = _packetBuffer[1];
			#if ATEM_debug
			if ((_serialOutput==0x80 && atemTransitionInTransition[mE]!=temp) || (_serialOutput==0x81 && !hasInitialized()))	{
				Serial.print(F("atemTransitionInTransition[mE=")); Serial.print(mE); Serial.print(F("] = "));
				Serial.println(atemTransitionInTransition[mE]);
			}
			#endif
			
			#if ATEM_debug
			temp = atemTransitionFramesRemaining[mE];
			#endif					
			atemTransitionFramesRemaining[mE] = _packetBuffer[2];
			#if ATEM_debug
			if ((_serialOutput==0x80 && atemTransitionFramesRemaining[mE]!=temp) || (_serialOutput==0x81 && !hasInitialized()))	{
				Serial.print(F("atemTransitionFramesRemaining[mE=")); Serial.print(mE); Serial.print(F("] = "));
				Serial.println(atemTransitionFramesRemaining[mE]);
			}
			#endif
			
			#if ATEM_debug
			temp = atemTransitionPosition[mE];
			#endif					
			atemTransitionPosition[mE] = word(_packetBuffer[4], _packetBuffer[5]);
			#if ATEM_debug
			if ((_serialOutput==0x80 && atemTransitionPosition[mE]!=temp) || (_serialOutput==0x81 && !hasInitialized()))	{
				Serial.print(F("atemTransitionPosition[mE=")); Serial.print(mE); Serial.print(F("] = "));
				Serial.println(atemTransitionPosition[mE]);
			}
			#endif
			
		}
	} else 
	if(!strcmp_P(cmdStr, PSTR("KeOn"))) {
		
		mE = _packetBuffer[0];
		keyer = _packetBuffer[1];
		if (mE<=1 && keyer<=3) {
			#if ATEM_debug
			temp = atemKeyerOnAirEnabled[mE][keyer];
			#endif					
			atemKeyerOnAirEnabled[mE][keyer] = _packetBuffer[2];
			#if ATEM_debug
			if ((_serialOutput==0x80 && atemKeyerOnAirEnabled[mE][keyer]!=temp) || (_serialOutput==0x81 && !hasInitialized()))	{
				Serial.print(F("atemKeyerOnAirEnabled[mE=")); Serial.print(mE); Serial.print(F("][keyer=")); Serial.print(keyer); Serial.print(F("] = "));
				Serial.println(atemKeyerOnAirEnabled[mE][keyer]);
			}
			#endif
			
		}
	} else 
	if(!strcmp_P(cmdStr, PSTR("DskS"))) {
		
		keyer = _packetBuffer[0];
		if (keyer<=1) {
			#if ATEM_debug
			temp = atemDownstreamKeyerOnAir[keyer];
			#endif					
			atemDownstreamKeyerOnAir[keyer] = _packetBuffer[1];
			#if ATEM_debug
			if ((_serialOutput==0x80 && atemDownstreamKeyerOnAir[keyer]!=temp) || (_serialOutput==0x81 && !hasInitialized()))	{
				Serial.print(F("atemDownstreamKeyerOnAir[keyer=")); Serial.print(keyer); Serial.print(F("] = "));
				Serial.println(atemDownstreamKeyerOnAir[keyer]);
			}
			#endif
			
			#if ATEM_debug
			temp = atemDownstreamKeyerInTransition[keyer];
			#endif					
			atemDownstreamKeyerInTransition[keyer] = _packetBuffer[2];
			#if ATEM_debug
			if ((_serialOutput==0x80 && atemDownstreamKeyerInTransition[keyer]!=temp) || (_serialOutput==0x81 && !hasInitialized()))	{
				Serial.print(F("atemDownstreamKeyerInTransition[keyer=")); Serial.print(keyer); Serial.print(F("] = "));
				Serial.println(atemDownstreamKeyerInTransition[keyer]);
			}
			#endif
			
			#if ATEM_debug
			temp = atemDownstreamKeyerIsAutoTransitioning[keyer];
			#endif					
			atemDownstreamKeyerIsAutoTransitioning[keyer] = _packetBuffer[3];
			#if ATEM_debug
			if ((_serialOutput==0x80 && atemDownstreamKeyerIsAutoTransitioning[keyer]!=temp) || (_serialOutput==0x81 && !hasInitialized()))	{
				Serial.print(F("atemDownstreamKeyerIsAutoTransitioning[keyer=")); Serial.print(keyer); Serial.print(F("] = "));
				Serial.println(atemDownstreamKeyerIsAutoTransitioning[keyer]);
			}
			#endif
			
			#if ATEM_debug
			temp = atemDownstreamKeyerFramesRemaining[keyer];
			#endif					
			atemDownstreamKeyerFramesRemaining[keyer] = _packetBuffer[4];
			#if ATEM_debug
			if ((_serialOutput==0x80 && atemDownstreamKeyerFramesRemaining[keyer]!=temp) || (_serialOutput==0x81 && !hasInitialized()))	{
				Serial.print(F("atemDownstreamKeyerFramesRemaining[keyer=")); Serial.print(keyer); Serial.print(F("] = "));
				Serial.println(atemDownstreamKeyerFramesRemaining[keyer]);
			}
			#endif
			
		}
	} else 
	if(!strcmp_P(cmdStr, PSTR("FtbS"))) {
		
		mE = _packetBuffer[0];
		if (mE<=1) {
			#if ATEM_debug
			temp = atemFadeToBlackStateFullyBlack[mE];
			#endif					
			atemFadeToBlackStateFullyBlack[mE] = _packetBuffer[1];
			#if ATEM_debug
			if ((_serialOutput==0x80 && atemFadeToBlackStateFullyBlack[mE]!=temp) || (_serialOutput==0x81 && !hasInitialized()))	{
				Serial.print(F("atemFadeToBlackStateFullyBlack[mE=")); Serial.print(mE); Serial.print(F("] = "));
				Serial.println(atemFadeToBlackStateFullyBlack[mE]);
			}
			#endif
			
			#if ATEM_debug
			temp = atemFadeToBlackStateInTransition[mE];
			#endif					
			atemFadeToBlackStateInTransition[mE] = _packetBuffer[2];
			#if ATEM_debug
			if ((_serialOutput==0x80 && atemFadeToBlackStateInTransition[mE]!=temp) || (_serialOutput==0x81 && !hasInitialized()))	{
				Serial.print(F("atemFadeToBlackStateInTransition[mE=")); Serial.print(mE); Serial.print(F("] = "));
				Serial.println(atemFadeToBlackStateInTransition[mE]);
			}
			#endif
			
			#if ATEM_debug
			temp = atemFadeToBlackStateFramesRemaining[mE];
			#endif					
			atemFadeToBlackStateFramesRemaining[mE] = _packetBuffer[3];
			#if ATEM_debug
			if ((_serialOutput==0x80 && atemFadeToBlackStateFramesRemaining[mE]!=temp) || (_serialOutput==0x81 && !hasInitialized()))	{
				Serial.print(F("atemFadeToBlackStateFramesRemaining[mE=")); Serial.print(mE); Serial.print(F("] = "));
				Serial.println(atemFadeToBlackStateFramesRemaining[mE]);
			}
			#endif
			
		}
	} else 
	if(!strcmp_P(cmdStr, PSTR("AuxS"))) {
		
		aUXChannel = _packetBuffer[0];
		if (aUXChannel<=5) {
			#if ATEM_debug
			temp = atemAuxSourceInput[aUXChannel];
			#endif					
			atemAuxSourceInput[aUXChannel] = word(_packetBuffer[2], _packetBuffer[3]);
			#if ATEM_debug
			if ((_serialOutput==0x80 && atemAuxSourceInput[aUXChannel]!=temp) || (_serialOutput==0x81 && !hasInitialized()))	{
				Serial.print(F("atemAuxSourceInput[aUXChannel=")); Serial.print(aUXChannel); Serial.print(F("] = "));
				Serial.println(atemAuxSourceInput[aUXChannel]);
			}
			#endif
			
		}
	} else 
	if(!strcmp_P(cmdStr, PSTR("TlIn"))) {
		
		sources = word(_packetBuffer[0],_packetBuffer[1]);
		if (sources<=20) {
			#if ATEM_debug
			temp = atemTallyByIndexSources;
			#endif					
			atemTallyByIndexSources = word(_packetBuffer[0], _packetBuffer[1]);
			#if ATEM_debug
			if ((_serialOutput==0x80 && atemTallyByIndexSources!=temp) || (_serialOutput==0x81 && !hasInitialized()))	{
				Serial.print(F("atemTallyByIndexSources = "));
				Serial.println(atemTallyByIndexSources);
			}
			#endif

			for(uint8_t a=0;a<sources;a++)	{
				#if ATEM_debug
				temp = atemTallyByIndexTallyFlags[a];
				#endif					
				atemTallyByIndexTallyFlags[a] = _packetBuffer[2+a];
				#if ATEM_debug
				if ((_serialOutput==0x80 && atemTallyByIndexTallyFlags[a]!=temp) || (_serialOutput==0x81 && !hasInitialized()))	{
					Serial.print(F("atemTallyByIndexTallyFlags[a=")); Serial.print(a); Serial.print(F("] = "));
					Serial.println(atemTallyByIndexTallyFlags[a]);
				}
				#endif
			}			

		}
	} else 
	{}
}