iipRequestStaticCall method

void iipRequestStaticCall(
  1. int callback,
  2. Guid classId,
  3. int index,
  4. TransmissionType transmissionType,
  5. DC content,
)

Implementation

void iipRequestStaticCall(int callback, Guid classId, int index,
    TransmissionType transmissionType, DC content) {
  var template = Warehouse.getTemplateByClassId(classId);

  if (template == null) {
    _sendError(
        ErrorType.Management, callback, ExceptionCode.TemplateNotFound.index);
    return;
  }

  var ft = template.getFunctionTemplateByIndex(index);

  if (ft == null) {
    // no function at this index
    _sendError(
        ErrorType.Management, callback, ExceptionCode.MethodNotFound.index);
    return;
  }

  // var parsed = Codec.parse(content, 0, this, null, transmissionType);

  // parsed.then((results)
  // {
  //     var arguments = (Map<byte, object>)results;

  //     // un hold the socket to send data immediately
  //     socket?.unhold();

  //     var fi = ft.methodInfo;

  //     if (fi == null)
  //     {
  //         // ft found, fi not found, this should never happen
  //         sendError(ErrorType.Management, callback, (ushort)ExceptionCode.MethodNotFound);
  //         return;
  //     }

  //     // @TODO: Make managers for static calls
  //     //if (r.Instance.Applicable(session, ActionType.Execute, ft) == Ruling.Denied)
  //     //{
  //     //    SendError(ErrorType.Management, callback,
  //     //        (ushort)ExceptionCode.InvokeDenied);
  //     //    return;
  //     //}

  //     InvokeFunction(fi, callback, arguments, IIPPacket.IIPPacketAction.StaticCall, null);

  // }).Error(x =>
  // {
  //     SendError(ErrorType.Management, callback, (ushort)ExceptionCode.ParseError);
  // });
}