Newer
Older
DTRAMServer / src / main / java / com / example / test / rest_controllers / ElementsController.java
package com.example.test.rest_controllers;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.example.test.services.ButtonService;

@RestController
@RequestMapping("/api/elements")
public class ElementsController {
	
	private final ButtonService buttonService;
	
	ElementsController(ButtonService bs){
		buttonService = bs;
	}
	
	@PostMapping("/buttonPressed")
	public void buttonPressed(@RequestParam("id") String id) {
		buttonService.onButtonPressed(id);
	}
	
	@PostMapping("/buttonReleased")
	public void buttonReleased(@RequestParam("id") String id) {
		buttonService.onButtonReleased(id);
	}
	
}