コード例 #1
0
ファイル: gateway.c プロジェクト: tdautc19841202/lora-gateway
void ProcessTelemetryMessage(int Channel, char *Message)
{
	if (strlen(Message+1) < 150)
	{
		int i;
		unsigned char *startmessage, *endmessage;

		ChannelPrintf(Channel, 4, 1, "Telemetry %d bytes       ", strlen(Message+1));

		endmessage = Message;
								
		startmessage = endmessage;
		endmessage = strchr(startmessage, '\n');

		if (endmessage != NULL)
		{
			*endmessage = '\0';

			LogTelemetryPacket(startmessage);
			
			UploadTelemetryPacket(startmessage);

			ProcessLine(Channel, startmessage);
		
			LogMessage("Ch %d: %s\n", Channel, startmessage);
		}
		
		// DoPositionCalcs(Channel);
		
		Config.LoRaDevices[Channel].TelemetryCount++;								
	}
}
コード例 #2
0
ファイル: gateway.c プロジェクト: zhanwwan/lora-gateway
void ProcessTelemetryMessage(int Channel, char *Message)
{
	if (strlen(Message+1) < 150)
	{
		char *startmessage, *endmessage;

		ChannelPrintf(Channel, 4, 1, "Telemetry %d bytes       ", strlen(Message+1));

		endmessage = Message;
								
		startmessage = endmessage;
		endmessage = strchr(startmessage, '\n');

		if (endmessage != NULL)
		{
			time_t now;
			struct tm *tm;
			
			*endmessage = '\0';

			LogTelemetryPacket(startmessage);
			
			UploadTelemetryPacket(startmessage);

			ProcessLine(Channel, startmessage);
		

			now = time(0);
			tm = localtime(&now);
		
			LogMessage("%02d:%02d:%02d Ch%d: %s\n", tm->tm_hour, tm->tm_min, tm->tm_sec, Channel, startmessage);
		}
		
		// DoPositionCalcs(Channel);
		
		Config.LoRaDevices[Channel].TelemetryCount++;								
	}
}