github.com/racerxdl/gonx@v0.0.0-20210103083128-c5afc43bcbd2/services/am/isc.go (about)

     1  package am
     2  
     3  import (
     4  	"encoding/binary"
     5  	"github.com/racerxdl/gonx/nx/nxerrors"
     6  	"github.com/racerxdl/gonx/services/ipc"
     7  )
     8  
     9  func IscCreateManagedDisplayLayer() (uint64, error) {
    10  	if amInitializations <= 0 {
    11  		return 0, nxerrors.AMNotInitialized
    12  	}
    13  
    14  	rq := ipc.MakeDefaultRequest(40)
    15  	rs := ipc.ResponseFmt{}
    16  	rs.RawData = make([]byte, 8) // one uint64
    17  
    18  	err := ipc.Send(iSelfControllerObject, &rq, &rs)
    19  	if err != nil {
    20  		return 0, err
    21  	}
    22  
    23  	return binary.LittleEndian.Uint64(rs.RawData), nil
    24  }
    25  
    26  func IscApproveToDisplay() error {
    27  	if amInitializations <= 0 {
    28  		return nxerrors.AMNotInitialized
    29  	}
    30  
    31  	rq := ipc.MakeDefaultRequest(51)
    32  	rs := ipc.ResponseFmt{}
    33  
    34  	return ipc.Send(iSelfControllerObject, &rq, &rs)
    35  }