GalaxyGuy Posted December 12, 2012 Posted December 12, 2012 Pretty sure it's Delphi or Pascal. Would need context.
antinode Posted December 12, 2012 Posted December 12, 2012 Makes too much sense for Welsh! Trade Member
PeterJames Posted December 13, 2012 Author Posted December 13, 2012 Its a language used to write a PIC in our CCTV software. We have some prewritten PIC' s along with standard modules like AND OR XOR Gates and programable calanders etc. I need to write a PIC to maximise the a camera when an input is triggered. I can get it to work with the older software but since they updated the software the first line of the PIC doesnt work (I am guessing they have changed the name in the software but I cant see where)
Joe Harris Posted December 13, 2012 Posted December 13, 2012 I;'m no guru but there is some recognisable code there. There's a chunk of code missing also, but as you can see it is declaring a bunch of variables initially: varPicEvents: TPicEvents;PicUID: Int64;PicName: string;InputsCount,OutputsCount: integer;Inputs: array[0..15] of TPicPin;Outputs: array[0..15] of TPicPin; Declares each variable stating the variable name followed by : followed by type, e.g. string (text) / integer (number) etc... followed by term ; In the case of the inputs and outputs variables the content of those is the result of a previously declared array variable called TPicPin. You should be able to call this up to display current content of each declared variable / previously completed variables like the TPicPin array. // system threadprocedure OnPinMessage(Sender: TObject; const User: string; const PinUID: Int64; State: boolean; const DataType: TRCadDataType; const Data: string);varidx: integer;begin try Declared the OnPinMessage proc, again notice punctuation - the index variable is then created followed by the usage: // translate inputs to outputs idx:=(PinUID and $1F)-1; if (idx>=0) and (idx<InputsCount) and (PinUID=Inputs[idx].UID) then begin Inputs[idx].State:=State; Inputs[idx].DataType:=DataType; Inputs[idx].Data:=Data; Strange that it is looking for a restriction based on the inputsCount when that wasn't previously declared (must have come before or somewhere else?).
Ronnie Posted December 13, 2012 Posted December 13, 2012 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
james.wilson Posted December 13, 2012 Posted December 13, 2012 new language on me that ronnie? is it like basic? securitywarehouse Security Supplies from Security Warehouse Trade Members please contact us for your TSI vetted trade discount.
Ronnie Posted December 13, 2012 Posted December 13, 2012 new language on me that ronnie? is it like basic? ha ha
PeterJames Posted December 13, 2012 Author Posted December 13, 2012 I;'m no guru but there is some recognisable code there. There's a chunk of code missing also, but as you can see it is declaring a bunch of variables initially: Declares each variable stating the variable name followed by : followed by type, e.g. string (text) / integer (number) etc... followed by term ; In the case of the inputs and outputs variables the content of those is the result of a previously declared array variable called TPicPin. You should be able to call this up to display current content of each declared variable / previously completed variables like the TPicPin array. Declared the OnPinMessage proc, again notice punctuation - the index variable is then created followed by the usage: Strange that it is looking for a restriction based on the inputsCount when that wasn't previously declared (must have come before or somewhere else?). I probably hadnt posted the complete program program PicFilter; uses VServer,RCad,Classes; type TPicPin=record UID: Int64; Name: string; State: boolean; Changed: boolean; DataType: TRCadDataType; Data: string; end; var PicEvents: TPicEvents; PicUID: Int64; PicName: string; InputsCount, OutputsCount: integer; Inputs: array[0..15] of TPicPin; Outputs: array[0..15] of TPicPin; // system thread procedure OnPinMessage(Sender: TObject; const User: string; const PinUID: Int64; State: boolean; const DataType: TRCadDataType; const Data: string); var idx: integer; begin try // translate inputs to outputs idx:=(PinUID and $1F)-1; if (idx>=0) and (idx<InputsCount) and (PinUID=Inputs[idx].UID) then begin Inputs[idx].State:=State; Inputs[idx].DataType:=DataType; Inputs[idx].Data:=Data; // Call Maximize Camera function MaximizeCamera(CameraIndex); // CameraIndex: Index of Camera to call preset; starting form 0 if Inputs[idx].State then begin DebugOut(Format('%s.%s.pin=%d (State=%d Data="%s").', [PicName,Inputs[idx].Name,idx,byte(Inputs[idx].State) and 1, Inputs[idx].Data])); MaximizeCamera(idx); // SelectLayout(idx); end; // if (DataType=rcdStr) and (Inputs[idx].Data<>'') then Data:=Format('+ PIC Filter + %s',[inputs[idx].Data]); if Outputs[idx].UID<>0 then SetPinState('',Outputs[idx].UID,Inputs[idx].State, Inputs[idx].DataType, Data); end; except DebugOut(ExceptionToString(ExceptionType,ExceptionParam)); end; end; // system thread procedure Initialize; var idx: integer; begin GetPicUID(PicUID); GetPicName(PicName); DebugOut(Format('%s Started.',[PicName])); GetInputsCount(InputsCount); GetOutputsCount(OutputsCount); for idx:=InputsCount-1 downto 0 do begin GetInputUID(idx,Inputs[idx].UID); GetPinName(Inputs[idx].UID,Inputs[idx].Name); GetPinState(Inputs[idx].UID,Inputs[idx].State); end; for idx:=OutputsCount-1 downto 0 do begin GetOutputUID(idx,Outputs[idx].UID); GetPinName(Outputs[idx].UID,Outputs[idx].Name); GetPinState(Outputs[idx].UID,Outputs[idx].State); end; PicEvents:=TPicEvents.Create(Self); PicEvents.OnPinMessage:=@OnPinMessage; SetTextColor(clLime); end; // system thread procedure Finalize; var i: integer; begin PicEvents.Free; PicEvents:=nil; for i:=0 to OutputsCount-1 do SetPinState('',Outputs.UID,false,rcdUnknown,''); SetTextColor(clSilver); DebugOut(Format('%s Stopped.',[PicName])); end; // pic thread procedure sleep(ms: dword); var T: Int64; tms: dword; begin T:=GetUsCount; tms:=0; while tms<ms do begin if waitEvent(ms-tms) then begin if terminated then begin DebugOut(Format('%s terminated',[PicName])); Finalize(); halt; end; end; tms:=(GetUsCount-T) div 1000; end; end; // pic thread begin synchronize('Initialize'); while not terminated do sleep(5000); synchronize('Finalize'); end.
james.wilson Posted December 13, 2012 Posted December 13, 2012 c++ imo securitywarehouse Security Supplies from Security Warehouse Trade Members please contact us for your TSI vetted trade discount.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.