champ-ipmi/src/main/scala/com/cyclone/ipmi/command/ipmiMessagingSupport/GetDeviceGuid.scala
package com.cyclone.ipmi.command.ipmiMessagingSupport
import akka.util.ByteString
import com.cyclone.ipmi.codec._
import com.cyclone.ipmi.command.global.DeviceGuid
import com.cyclone.ipmi.command.{CommandCode, NetworkFunction, StatusCodeTranslator}
import com.cyclone.ipmi.protocol.packet.{CommandResultCodec, IpmiCommandResult, IpmiStandardCommand}
/**
* Get Device GUID command and response
*/
object GetDeviceGuid {
object CommandResult {
implicit val decoder: Decoder[CommandResult] = new Decoder[CommandResult] {
def decode(data: ByteString): CommandResult = {
val iterator = data.iterator
val is = iterator.asInputStream
val guid = is.read(16).as[DeviceGuid]
CommandResult(guid)
}
}
implicit val statusCodeTranslator: StatusCodeTranslator[CommandResult] =
StatusCodeTranslator[CommandResult]()
}
case class CommandResult(guid: DeviceGuid) extends IpmiCommandResult
object Command extends IpmiStandardCommand {
implicit val coder: Coder[Command.type] = new Coder[Command.type] {
def encode(request: Command.type): ByteString = ByteString.empty
}
implicit val codec: CommandResultCodec[Command.type, CommandResult] =
CommandResultCodec.commandResultCodecFor[Command.type, CommandResult]
val networkFunction: NetworkFunction = NetworkFunction.ApplicationRequest
val commandCode = CommandCode(0x08)
}
}